pub struct WatchManager { /* private fields */ }Expand description
Manager for watch subscriptions.
Handles creating, tracking, and cancelling watches.
Uses a Mutex internally but operations are fast (no I/O).
Implementations§
Source§impl WatchManager
impl WatchManager
Sourcepub fn with_buffer_size(buffer_size: usize) -> Self
pub fn with_buffer_size(buffer_size: usize) -> Self
Create a new watch manager with a custom channel buffer size.
Sourcepub fn create_watch(&self, node_hash: NodeHash) -> Watch
pub fn create_watch(&self, node_hash: NodeHash) -> Watch
Create a new watch for a node.
Returns a Watch that will receive snapshot updates for the specified node.
Sourcepub fn cancel_watch(&self, watch_id: WatchId)
pub fn cancel_watch(&self, watch_id: WatchId)
Cancel a watch subscription.
The watch will no longer receive updates.
Sourcepub fn notify(&self, node_hash: NodeHash, snapshot: Arc<Snapshot>)
pub fn notify(&self, node_hash: NodeHash, snapshot: Arc<Snapshot>)
Notify all watches for a node about a snapshot update.
Removes any closed watches automatically.
Sourcepub fn watch_count(&self, node_hash: NodeHash) -> usize
pub fn watch_count(&self, node_hash: NodeHash) -> usize
Get the number of active watches for a node.
Sourcepub fn total_watch_count(&self) -> usize
pub fn total_watch_count(&self) -> usize
Get the total number of active watches across all nodes.
Trait Implementations§
Source§impl Debug for WatchManager
impl Debug for WatchManager
Auto Trait Implementations§
impl !Freeze for WatchManager
impl !RefUnwindSafe for WatchManager
impl Send for WatchManager
impl Sync for WatchManager
impl Unpin for WatchManager
impl UnsafeUnpin for WatchManager
impl UnwindSafe for WatchManager
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
Mutably borrows from an owned value. Read more
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request