MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / observer_can_receive

Method observer_can_receive

nodedb-raft/src/state.rs:229–235  ·  view source on GitHub ↗

Whether an observer's send queue is below the backpressure threshold. Returns `false` if the observer is unknown.

(&self, observer: u64)

Source from the content-addressed store, hash-verified

227 /// Whether an observer's send queue is below the backpressure threshold.
228 /// Returns `false` if the observer is unknown.
229 pub fn observer_can_receive(&self, observer: u64) -> bool {
230 self.observer_states
231 .iter()
232 .find(|(id, _)| *id == observer)
233 .map(|(_, state)| state.pending_count < ObserverState::MAX_PENDING)
234 .unwrap_or(false)
235 }
236}
237
238#[cfg(test)]

Callers 1

Calls 2

findMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected