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§
fn get_watch_client(&self) -> WatchClient
Provided Methods§
Sourcefn json_watch_channel<V>(
&self,
key: impl Into<Vec<u8>>,
watch_options: Option<WatchOptions>,
) -> Receiver<WatchEvent<V>>where
V: DeserializeOwned + Send + 'static,
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.
fn json_put_watch_channel<T>(
&self,
key: impl Into<Vec<u8>>,
watch_options: Option<WatchOptions>,
) -> Receiver<(Revision, T)>where
T: DeserializeOwned + Send + 'static,
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.