Struct zkstate::ZkState [−][src]
Implementations
impl<T: Serialize + DeserializeOwned + Send + Sync + 'static> ZkState<T>
[src]
pub fn new(
zk: Arc<ZooKeeper>,
zk_path: String,
initial_state: T
) -> Result<Self>
[src]
zk: Arc<ZooKeeper>,
zk_path: String,
initial_state: T
) -> Result<Self>
pub fn update_handler<M: Fn(Change<Key, Value>) + Send + 'static>(
&self,
closure: M
) -> Result<(), ZkStructError>
[src]
&self,
closure: M
) -> Result<(), ZkStructError>
Method to be invoked to handle state change notifications
pub fn update<M: FnOnce(&mut T)>(&self, closure: M) -> Result<(), ZkStructError>
[src]
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.
pub fn read(&self) -> Result<RwLockReadGuard<'_, T>, ZkStructError>
[src]
Returns a Result<RwLockReadGuard
pub fn c_read(&self)
[src]
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
pub fn metadata(&self) -> (usize, i32)
[src]
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for ZkState<T>
impl<T> Send for ZkState<T>
impl<T> Sync for ZkState<T>
impl<T> Unpin for ZkState<T>
impl<T> UnwindSafe for ZkState<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,