[−][src]Struct zookeeper_async::recipes::cache::PathChildrenCache
A Path Cache is used to watch a znode.
A utility that attempts to keep all data from all children of a ZK path locally cached. This will watch the ZK path; whenever a child is added, updated or removed, the Path Cache will change its state to contain the current set of children, the children's data and the children's state. You can register a listener that will get notified when changes occur.
Note
It is not possible to stay transactionally in sync. Users of this class must be prepared for false-positives and false-negatives. Additionally, always use the version number when updating data to avoid overwriting another process's change.
Implementations
impl PathChildrenCache
[src]
pub async fn new<'_>(
zk: Arc<ZooKeeper>,
path: &'_ str
) -> ZkResult<PathChildrenCache>
[src]
zk: Arc<ZooKeeper>,
path: &'_ str
) -> ZkResult<PathChildrenCache>
Create a new cache instance watching path
. If path
does not exist, it will be created
(see ZooKeeperExt::ensure_path
).
Note
After creating the instance, you must call start
.
pub async fn get_current_data<'_>(&'_ self) -> Data
[src]
Return the current data. There are no guarantees of accuracy. This is merely the most recent view of the data.
pub async fn clear<'_>(&'_ self)
[src]
pub fn start(&mut self) -> ZkResult<()>
[src]
Start the cache. The cache is not started automatically. You must call this method.
pub fn add_listener<Listener: Fn(PathChildrenCacheEvent) + Send + 'static>(
&self,
subscriber: Listener
) -> Subscription
[src]
&self,
subscriber: Listener
) -> Subscription
pub fn remove_listener(&self, sub: Subscription)
[src]
Auto Trait Implementations
impl !RefUnwindSafe for PathChildrenCache
impl Send for PathChildrenCache
impl Sync for PathChildrenCache
impl Unpin for PathChildrenCache
impl !UnwindSafe for PathChildrenCache
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,
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, 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,