Exemple #1
0
    async def set_acl(self, path, acl, force=False):
        """
        Set ACL to the znode.

        :param str path: Path of znode

        :param acl: ACL for the znode
        :type acl: aiozk.ACL

        :param bool force: True for ignoring ACL version of the znode when
            setting ACL to the actual znode. False for using ACL version from
            the stat cache.

        :raises aiozk.exc.NoNode: Raised if znode does not exist

        :raises aiozk.exc.BadVersion: Raised if force parameter is False and
            only if the supplied version from stat cache does not match the
            actual ACL version of the znode.
        """
        path = self.normalize_path(path)

        if not force and path in self.stat_cache:
            version = self.stat_cache[path].version
        else:
            version = -1

        await self.send(
            protocol.SetACLRequest(path=path, acl=acl, version=version))
Exemple #2
0
    async def set_acl(self, path, acl, force=False):
        path = self.normalize_path(path)

        if not force and path in self.stat_cache:
            version = self.stat_cache[path].version
        else:
            version = -1

        await self.send(protocol.SetACLRequest(path=path, acl=acl, version=version))