pub struct EdgeCacheRegistry { /* private fields */ }Expand description
Tracks which nodes are eligible for edge caching and propagates that state via gossip labels.
Construction is cheap; the registry is Clone (it’s an
Arc-wrapped pair of state + gossip handle) so it can be plumbed into
Axum handlers behind with_state.
Implementations§
Source§impl EdgeCacheRegistry
impl EdgeCacheRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a registry with no gossip pool attached.
Eligibility decisions are still tracked locally and returned by
Self::list_eligible, but no labels are pushed to peers. Used
by tests and by standalone-mode daemons that don’t participate in
the worker-tier gossip pool.
Sourcepub fn with_gossip(gossip: Arc<GossipPool>, self_info: PeerInfo) -> Self
pub fn with_gossip(gossip: Arc<GossipPool>, self_info: PeerInfo) -> Self
Create a registry that pushes eligibility labels into the supplied gossip pool.
self_info is the PeerInfo template the registry will mutate
(label keys are added on enable and removed on disable) and
then re-broadcast via GossipPool::announce_self.
Sourcepub async fn enable(
&self,
node_id: u64,
capacity: NodeCapacity,
) -> Result<(), EdgeCacheError>
pub async fn enable( &self, node_id: u64, capacity: NodeCapacity, ) -> Result<(), EdgeCacheError>
Mark node_id as eligible for edge caching with capacity.
Inserts a new EdgeCacheNode into the registry (overwriting any
prior entry for the same node_id) and, when a gossip pool is
attached, pushes the standard label set into the local node’s
gossip self-info and re-announces it.
§Errors
Returns EdgeCacheError::Gossip if the gossip pool rejects the
re-announcement (serialization error inside chitchat).
Sourcepub async fn disable(&self, node_id: u64) -> Result<(), EdgeCacheError>
pub async fn disable(&self, node_id: u64) -> Result<(), EdgeCacheError>
Remove node_id from the eligibility registry.
When a gossip pool is attached, clears the edge-cache label set from the local node’s gossip self-info and re-announces.
§Errors
EdgeCacheError::NodeNotFoundifnode_idwas not registered.EdgeCacheError::Gossipif the gossip re-announcement fails.
Sourcepub async fn list_eligible(&self) -> Vec<EdgeCacheNode>
pub async fn list_eligible(&self) -> Vec<EdgeCacheNode>
Snapshot of every currently-eligible node.
Sourcepub async fn is_enabled(&self, node_id: u64) -> bool
pub async fn is_enabled(&self, node_id: u64) -> bool
Whether node_id is currently registered as edge-cache-eligible.
Sourcepub async fn stats(&self, _node_id: u64) -> EdgeCacheStats
pub async fn stats(&self, _node_id: u64) -> EdgeCacheStats
Return placeholder hit/miss counters for node_id.
Documented stub: always returns (0, 0) regardless of
node_id. The real counters land in the follow-on cache subsystem
(see module docs). This stays callable so upstream integration
tests can rely on the endpoint existing today. The async shape is
preserved so a future implementation can read shared cache state
without a breaking API churn.
Trait Implementations§
Source§impl Clone for EdgeCacheRegistry
impl Clone for EdgeCacheRegistry
Source§fn clone(&self) -> EdgeCacheRegistry
fn clone(&self) -> EdgeCacheRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EdgeCacheRegistry
impl Debug for EdgeCacheRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for EdgeCacheRegistry
impl !UnwindSafe for EdgeCacheRegistry
impl Freeze for EdgeCacheRegistry
impl Send for EdgeCacheRegistry
impl Sync for EdgeCacheRegistry
impl Unpin for EdgeCacheRegistry
impl UnsafeUnpin for EdgeCacheRegistry
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