Trait WatchClientExt

Source
pub trait WatchClientExt {
    // Required method
    fn get_watch_client(&self) -> WatchClient;

    // Provided methods
    fn json_watch_channel<V>(
        &self,
        key: impl Into<Vec<u8>>,
        watch_options: Option<WatchOptions>,
    ) -> Receiver<WatchEvent<V>>
       where V: DeserializeOwned + Send + 'static { ... }
    fn json_put_watch_channel<T>(
        &self,
        key: impl Into<Vec<u8>>,
        watch_options: Option<WatchOptions>,
    ) -> Receiver<(Revision, T)>
       where T: DeserializeOwned + Send + 'static { ... }
    fn watch_lock_key_change(
        &self,
        key: impl Into<Vec<u8>>,
        key_mod_revision: Revision,
    ) -> Sender<Revision> { ... }
}
Expand description

Extension trait for WatchClient.

This trait provides utility methods for working with WatchClient.

This extension trait provides rust channel of watch stream and more reliability in case of transient errors.

On transient errors, the watch stream will be retried and resume where you left off.

Required Methods§

Provided Methods§

Source

fn json_watch_channel<V>( &self, key: impl Into<Vec<u8>>, watch_options: Option<WatchOptions>, ) -> Receiver<WatchEvent<V>>
where V: DeserializeOwned + Send + 'static,

Creates a channel that watches for changes to a key in etcd.

The channel will send a WatchEvent for each change to the key. The channel will be retried on transient errors.

The channel will be closed if the watch is cancelled or if the stream is closed.

The watch expect value to be JSON encoded.

Source

fn json_put_watch_channel<T>( &self, key: impl Into<Vec<u8>>, watch_options: Option<WatchOptions>, ) -> Receiver<(Revision, T)>
where T: DeserializeOwned + Send + 'static,

Source

fn watch_lock_key_change( &self, key: impl Into<Vec<u8>>, key_mod_revision: Revision, ) -> Sender<Revision>

Creates a broadcast channel that watches for a lock key that gets deleted.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl WatchClientExt for WatchClient

Implementors§