pub struct WatcherRegistry { /* private fields */ }Expand description
Registry of state watchers, evaluated after each mutation cycle.
Implementations§
Source§impl WatcherRegistry
impl WatcherRegistry
Sourcepub fn observed_keys(&self) -> &HashSet<String>
pub fn observed_keys(&self) -> &HashSet<String>
The set of state keys observed by at least one watcher.
Used by the processor to scope State::snapshot_values() so only
relevant keys are captured before mutations.
Sourcepub fn describe(&self) -> Vec<WatcherContract>
pub fn describe(&self) -> Vec<WatcherContract>
Return serializable contract metadata for all watchers.
Sourcepub fn evaluate(
&self,
diffs: &[(String, Value, Value)],
state: &State,
writer: &Arc<dyn SessionWriter>,
) -> (Vec<BoxFuture<()>>, Vec<BoxFuture<()>>)
pub fn evaluate( &self, diffs: &[(String, Value, Value)], state: &State, writer: &Arc<dyn SessionWriter>, ) -> (Vec<BoxFuture<()>>, Vec<BoxFuture<()>>)
Evaluate all watchers against the given state diffs.
diffs contains (key, old_value, new_value) tuples produced by
State::diff_values(). For each diff entry, every watcher whose key
matches and whose predicate fires will have its action invoked.
Returns (blocking_futures, concurrent_futures).
Sourcepub fn evaluate_mutations(
&self,
mutations: &[StateMutation],
state: &State,
writer: &Arc<dyn SessionWriter>,
) -> (Vec<BoxFuture<()>>, Vec<BoxFuture<()>>)
pub fn evaluate_mutations( &self, mutations: &[StateMutation], state: &State, writer: &Arc<dyn SessionWriter>, ) -> (Vec<BoxFuture<()>>, Vec<BoxFuture<()>>)
Evaluate watchers from a batch of recorded state mutations.
Multiple mutations for the same key are collapsed into the same net
(old, new) diff shape used by Self::evaluate, preserving watcher
behavior while avoiding a pre-turn state snapshot.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WatcherRegistry
impl !RefUnwindSafe for WatcherRegistry
impl Send for WatcherRegistry
impl Sync for WatcherRegistry
impl Unpin for WatcherRegistry
impl !UnwindSafe for WatcherRegistry
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].