Struct zookeeper_client::MultiWriter
source · pub struct MultiWriter<'a> { /* private fields */ }
Expand description
MultiWriter commits write and condition check operations in one request to achieve transaction like semantics.
Implementations§
source§impl<'a> MultiWriter<'a>
impl<'a> MultiWriter<'a>
sourcepub fn add_check_version(
&mut self,
path: &str,
version: i32
) -> Result<(), Error>
pub fn add_check_version( &mut self, path: &str, version: i32 ) -> Result<(), Error>
Adds operation to check version for node with given path.
Notable behaviors
Effects of changes to data of given path in preceding operations affect this operation.
sourcepub fn add_create(
&mut self,
path: &str,
data: &[u8],
options: &CreateOptions<'_>
) -> Result<(), Error>
pub fn add_create( &mut self, path: &str, data: &[u8], options: &CreateOptions<'_> ) -> Result<(), Error>
Adds operation to create node with given path and data.
See Client::create for more details.
Notable behaviors
MultiWriteResult::Create::stat could be Stat::is_invalid due to bugs in ZooKeeper server. See ZOOKEEPER-4026 and ZOOKEEPER-4667 for reference.
sourcepub fn add_set_data(
&mut self,
path: &str,
data: &[u8],
expected_version: Option<i32>
) -> Result<(), Error>
pub fn add_set_data( &mut self, path: &str, data: &[u8], expected_version: Option<i32> ) -> Result<(), Error>
Adds operation to set data for node with given path.
See Client::set_data for more details.
sourcepub fn add_delete(
&mut self,
path: &str,
expected_version: Option<i32>
) -> Result<(), Error>
pub fn add_delete( &mut self, path: &str, expected_version: Option<i32> ) -> Result<(), Error>
Adds operation to delete node with given path.
See Client::delete for more details.
sourcepub fn commit(
&mut self
) -> impl Future<Output = Result<Vec<MultiWriteResult>, MultiWriteError>> + Send + 'a
pub fn commit( &mut self ) -> impl Future<Output = Result<Vec<MultiWriteResult>, MultiWriteError>> + Send + 'a
Commits multiple operations in one request to write transactionally.
Notable behaviors
Failure of individual operation will fail whole request and commit no effect in server.
Notable errors
- Error::BadVersion if check version failed.