pub struct TerminalStore<K: ResourceKey, V: TerminalState> { /* private fields */ }Expand description
Monotonic-write-once retained-terminal-state store — the authoritative, host-side, plaintext-at-owner value for each resource.
This is the “file holds the truth” half of Plan9-style completion: a late
watcher (one that subscribes AFTER termination) is served from here
immediately, without replaying the event stream. Distinct from
[crate::stream_info::StreamOpt::Retention] (a best-effort content-blind
transport replay buffer) and from the relay (which never holds plaintext).
Implementations§
Source§impl<K: ResourceKey, V: TerminalState> TerminalStore<K, V>
impl<K: ResourceKey, V: TerminalState> TerminalStore<K, V>
pub fn new() -> Self
Sourcepub fn latch(&self, key: K, terminal: Terminal<V>) -> bool
pub fn latch(&self, key: K, terminal: Terminal<V>) -> bool
Latch a terminal value for key. Monotonic write-once: returns true
if this call latched (the key was not already terminal), false if the
key was already terminal (the existing value is NEVER overwritten).
Sourcepub fn get(&self, key: &K) -> Option<Terminal<V>>
pub fn get(&self, key: &K) -> Option<Terminal<V>>
Return the retained terminal for key, if any. Serves a late watcher
(subject to TerminalAuthz at the call site — see
read_then_subscribe).
Sourcepub fn is_latched(&self, key: &K) -> bool
pub fn is_latched(&self, key: &K) -> bool
Whether key is already terminal.
Sourcepub fn reap_unlatched<'k, I, F>(&self, keys: I, fallback: F) -> Vec<K>
pub fn reap_unlatched<'k, I, F>(&self, keys: I, fallback: F) -> Vec<K>
Latch a fallback terminal for every key that is not already terminal.
Called by the resource owner’s death-detection (reaper / liveness
timeout) so a fan-out read_then_subscribe waiter on a resource whose
owner died never blocks forever — the EV6-liveness obligation. Returns
the keys that were reaped (newly latched with fallback).
Already-latched keys are left untouched — a real terminal always beats a
synthetic Failed/EOF. The caller (not this store) owns owner→key
bookkeeping and death-detection; this just applies the fallback to the
supplied keys.
Trait Implementations§
Source§impl<K: ResourceKey, V: TerminalState> Clone for TerminalStore<K, V>
impl<K: ResourceKey, V: TerminalState> Clone for TerminalStore<K, V>
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Cheap clone — the store is Arc-shared internally (same authoritative
state visible to all clones), so a watcher and the owner can hold their
own handles to the same store.
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<K: Default + ResourceKey, V: Default + TerminalState> Default for TerminalStore<K, V>
impl<K: Default + ResourceKey, V: Default + TerminalState> Default for TerminalStore<K, V>
Source§fn default() -> TerminalStore<K, V>
fn default() -> TerminalStore<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for TerminalStore<K, V>
impl<K, V> !RefUnwindSafe for TerminalStore<K, V>
impl<K, V> Send for TerminalStore<K, V>
impl<K, V> Sync for TerminalStore<K, V>
impl<K, V> Unpin for TerminalStore<K, V>
impl<K, V> UnsafeUnpin for TerminalStore<K, V>
impl<K, V> !UnwindSafe for TerminalStore<K, V>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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