pub struct EdgeRegistry { /* private fields */ }Expand description
Home-side edge registry. Cheap to clone via Arc.
Implementations§
Source§impl EdgeRegistry
impl EdgeRegistry
pub fn new(max_edges: usize, liveness_window: Duration) -> Self
Sourcepub fn register(
&self,
edge_id: &str,
region: &str,
base_url: &str,
now_iso: &str,
) -> Result<Receiver<InvalidationEvent>, RegistryError>
pub fn register( &self, edge_id: &str, region: &str, base_url: &str, now_iso: &str, ) -> Result<Receiver<InvalidationEvent>, RegistryError>
Register a new edge. Returns the receiver the SSE handler holds open. Caller is responsible for keeping the receiver alive — when it drops, the next broadcast prunes the edge.
The channel is bounded: a slow edge that doesn’t drain fast enough back-pressures into the broadcast call (which is async). Default capacity 64 events lets bursts ride through without dropping.
Sourcepub fn unregister(&self, edge_id: &str) -> bool
pub fn unregister(&self, edge_id: &str) -> bool
Remove an edge — used when the home decides to evict (manual unregister, or cleanup during shutdown).
Sourcepub async fn broadcast(&self, ev: InvalidationEvent) -> (u32, u32)
pub async fn broadcast(&self, ev: InvalidationEvent) -> (u32, u32)
Broadcast an invalidation to every subscribed edge. Edges whose channel has closed (receiver dropped) are pruned. Returns (sent, pruned).
Sourcepub fn list(&self) -> Vec<EdgeNode>
pub fn list(&self) -> Vec<EdgeNode>
Read-only snapshot of currently-registered edges. Used by
the admin UI / /api/edge endpoint.
pub fn count(&self) -> usize
Sourcepub fn prune_stale(&self) -> u32
pub fn prune_stale(&self) -> u32
Garbage-collect edges that haven’t been seen within
liveness_window. Returns the count pruned.
Trait Implementations§
Source§impl Clone for EdgeRegistry
impl Clone for EdgeRegistry
Source§fn clone(&self) -> EdgeRegistry
fn clone(&self) -> EdgeRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EdgeRegistry
impl !RefUnwindSafe for EdgeRegistry
impl Send for EdgeRegistry
impl Sync for EdgeRegistry
impl Unpin for EdgeRegistry
impl UnsafeUnpin for EdgeRegistry
impl !UnwindSafe for EdgeRegistry
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,
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