def set_data(self, path, value, version=-1): """Add a set ZNode value to the transaction. Takes the same arguments as :meth:`KazooClient.set`. """ if not isinstance(path, basestring): raise TypeError("path must be a string") if not isinstance(value, bytes): raise TypeError("value must be a byte string") if not isinstance(version, int): raise TypeError("version must be an int") self._add( SetData(_prefix_root(self.client.chroot, path), value, version))
def set_async(self, path, value, version=-1): """Set the value of a node. Takes the same arguments as :meth:`set`. :rtype: :class:`~kazoo.interfaces.IAsyncResult` """ if not isinstance(path, basestring): raise TypeError("path must be a string") if value is not None and not isinstance(value, bytes): raise TypeError("value must be a byte string") if not isinstance(version, int): raise TypeError("version must be an int") async_result = self.handler.async_result() self._call(SetData(_prefix_root(self.chroot, path), value, version), async_result) return async_result