huskar_api/models/znode.py
def save(self, version=None):
        """Saves the data in this instance to ZooKeeper.

        It is concurrency-safe if you never break the :attr:`ZnodeModel.stat`.

        :param version: Optional. The alternative version instead of
                        :attr:`ZnodeModel.stat`.
        :raises OutOfSyncError: The local data is outdated.
        :raises marshmallow.ValidationError: :attr:`ZnodeModel.data` is invalid
        """
        data, _ = self.MARSHMALLOW_SCHEMA.dumps(self.data)
        self.MARSHMALLOW_SCHEMA.loads(data)  # raise ValidationError if need
        if self.stat is None:
            try:
                self.client.create(self.path, data, makepath=True)
                zk_payload(payload_data=data, payload_type='create')
            except NodeExistsError as e:
                raise OutOfSyncError(e)
            self.load()
        else:
            if version is None:
                version = self.stat.version
            try:
                self.stat = self.client.set(self.path, data, version=version)
                zk_payload(payload_data=data, payload_type='set')
            except (NoNodeError, BadVersionError) as e:
                raise OutOfSyncError(e)
Saves the data in this instance to ZooKeeper.

        It is concurrency-safe if you never break the :attr:`ZnodeModel.stat`.

        :param version: Optional. The alternative version instead of
                        :attr:`ZnodeModel.stat`.
        :raises OutOfSyncError: The local data is outdated.
        :raises marshmallow.ValidationError: :attr:`ZnodeModel.data` is invalid
        
Saves the data in this instance to ZooKeeper.
It is concurrency-safe if you never break the :attr:`ZnodeModel.stat`.
Saves the data in this instance to ZooKeeper . It is concurrency - safe if you never break the : attr : ` ZnodeModel . stat ` .
def save(self, version=None):
        data, _ = self.MARSHMALLOW_SCHEMA.dumps(self.data)
        self.MARSHMALLOW_SCHEMA.loads(data)  
        if self.stat is None:
            try:
                self.client.create(self.path, data, makepath=True)
                zk_payload(payload_data=data, payload_type='create')
            except NodeExistsError as e:
                raise OutOfSyncError(e)
            self.load()
        else:
            if version is None:
                version = self.stat.version
            try:
                self.stat = self.client.set(self.path, data, version=version)
                zk_payload(payload_data=data, payload_type='set')
            except (NoNodeError, BadVersionError) as e:
                raise OutOfSyncError(e)
def save ( self , version = None ) : data , _ = self . MARSHMALLOW_SCHEMA . dumps ( self . data ) self . MARSHMALLOW_SCHEMA . loads ( data ) if self . stat is None : try : self . client . create ( self . path , data , makepath = True ) zk_payload ( payload_data = data , payload_type = 'create' ) except NodeExistsError as e : raise OutOfSyncError ( e ) self . load ( ) else : if version is None : version = self . stat . version try : self . stat = self . client . set ( self . path , data , version = version ) zk_payload ( payload_data = data , payload_type = 'set' ) except ( NoNodeError , BadVersionError ) as e : raise OutOfSyncError ( e )
Saves the data in this instance to ZooKeeper.
Saves the data in this instance to ZooKeeper .
"""Saves the data in this instance to ZooKeeper.

        It is concurrency-safe if you never break the :attr:`ZnodeModel.stat`.

        :param version: Optional. The alternative version instead of
                        :attr:`ZnodeModel.stat`.
        :raises OutOfSyncError: The local data is outdated.
        :raises marshmallow.ValidationError: :attr:`ZnodeModel.data` is invalid
        """ # raise ValidationError if need
The local data is outdated.
The local data is outdated .
OutOfSyncError
:attr:`ZnodeModel.data` is invalid
: attr : ` ZnodeModel . data ` is invalid
marshmallow.ValidationError
self
version
Optional. The alternative version instead of
:attr:`ZnodeModel.stat`.
Optional . The alternative version instead of : attr : ` ZnodeModel . stat ` .