pub struct EtcdDirectiveStore { /* private fields */ }Expand description
A DirectiveStore whose snapshot is kept fresh by an etcd watch.
Construct with EtcdDirectiveStore::connect inside a Tokio runtime; it loads
the initial set and spawns the background watch. Clone is cheap (shared
snapshot) so the same store can be handed to the pipeline and an admin surface.
Implementations§
Source§impl EtcdDirectiveStore
impl EtcdDirectiveStore
Sourcepub async fn connect(
endpoints: &[String],
key: impl Into<String>,
clock: Arc<dyn Clock>,
) -> Result<Self, EtcdError>
pub async fn connect( endpoints: &[String], key: impl Into<String>, clock: Arc<dyn Clock>, ) -> Result<Self, EtcdError>
Connects to endpoints, reads the directive set at key, and spawns the
background watch that keeps it fresh.
The value at key is the same JSON body the admin publish endpoint accepts
({"directives":[...]}). A missing key is a valid empty set (everything
off). A malformed value at startup is treated as empty, fail-safe, the
same as an unparseable later publish.
§Errors
EtcdError::Connect if etcd cannot be reached or the initial read fails.
Trait Implementations§
Source§impl Clone for EtcdDirectiveStore
impl Clone for EtcdDirectiveStore
Source§fn clone(&self) -> EtcdDirectiveStore
fn clone(&self) -> EtcdDirectiveStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EtcdDirectiveStore
impl Debug for EtcdDirectiveStore
Source§impl DirectiveStore for EtcdDirectiveStore
impl DirectiveStore for EtcdDirectiveStore
Source§fn load(&self) -> Arc<DirectiveSet>
fn load(&self) -> Arc<DirectiveSet>
The currently active directive set. Called on the request hot path, so it
must be cheap (an
Arc clone of a cached snapshot), never blocking I/O.Auto Trait Implementations§
impl Freeze for EtcdDirectiveStore
impl RefUnwindSafe for EtcdDirectiveStore
impl Send for EtcdDirectiveStore
impl Sync for EtcdDirectiveStore
impl Unpin for EtcdDirectiveStore
impl UnsafeUnpin for EtcdDirectiveStore
impl UnwindSafe for EtcdDirectiveStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request