pub struct CachedSnapshot {
pub services: Vec<ServiceInfo>,
pub refreshed_at: Instant,
}Expand description
A point-in-time snapshot of all service statuses.
Why: Separating the cached data from the lock makes it cheap to clone the
snapshot out of the lock and work with it without holding the lock.
What: Contains the service info list (same order as the connector list) and
the instant when the poll completed.
Test: Constructed by PollerCache::poll_once; inspected by tests below.
Fields§
§services: Vec<ServiceInfo>Service info for each connector, in connector-list order.
refreshed_at: InstantWall-clock instant when this snapshot was produced. Reserved for future staleness-reporting (P2+); not yet surfaced in the API.
Implementations§
Source§impl CachedSnapshot
impl CachedSnapshot
Sourcepub fn url_map(&self) -> HashMap<String, String>
pub fn url_map(&self) -> HashMap<String, String>
Build a URL map from daemon id → base URL for running daemons.
Why: The proxy router needs to resolve a daemon name to its live base URL
quickly, without re-scanning the snapshot on every request.
What: Iterates services and collects only those with a url.
Test: test_snapshot_url_map below.
Trait Implementations§
Source§impl Clone for CachedSnapshot
impl Clone for CachedSnapshot
Source§fn clone(&self) -> CachedSnapshot
fn clone(&self) -> CachedSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CachedSnapshot
impl RefUnwindSafe for CachedSnapshot
impl Send for CachedSnapshot
impl Sync for CachedSnapshot
impl Unpin for CachedSnapshot
impl UnsafeUnpin for CachedSnapshot
impl UnwindSafe for CachedSnapshot
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> 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