Struct zkstate::ZkState [−][src]
pub struct ZkState<T: Serialize + DeserializeOwned + Send + Sync> { /* fields omitted */ }
Implementations
Create a new instance of ZkState, but does not attempt to create an empty object if none already exists. Will wait for data to show up.
So, if you know that a ZkState instance will eventually appear at the /foo/bar
znode, this
will block waiting for that to show up.
TODO describe this better
pub fn update_handler<M: Fn(Change<Key, Value>) + Send + 'static>(
&self,
closure: M
) -> Result<(), ZkStructError>
pub fn update_handler<M: Fn(Change<Key, Value>) + Send + 'static>(
&self,
closure: M
) -> Result<(), ZkStructError>
Method to be invoked to handle state change notifications
Return a reference to the Crossbeam Receiver to get Change notifications
Update the shared object using a closure.
The closure is passed a reference to the contents of the ZkState. Once the closure returns, the shared state in Zookeeper is committed and the write locks released.
Returns a Result<RwLockReadGuard
Consistent Read.
Preforms a check to make sure the local version is the same as the remote version before returning. If there is a mismatch, will preform a sync and return the latest object
Dirty Read.
Returns the local data, not failing if the data is too old
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for ZkState<T>
impl<T> UnwindSafe for ZkState<T>
Blanket Implementations
Mutably borrows from an owned value. Read more