pub struct PrStatusCache { /* private fields */ }Expand description
The poller-written, snapshot-read badge cache.
A plain std::Mutex map: writes come from the poll loop, reads from the tree
snapshot build. The lock is never held across an .await — every method takes
it, finishes, and drops it.
Implementations§
Source§impl PrStatusCache
impl PrStatusCache
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty cache. Until the first poll lands, every lookup misses and the tree simply renders no badge.
Sourcepub fn get(&self, owner: &str, name: &str, branch: &str) -> Option<PrBadge>
pub fn get(&self, owner: &str, name: &str, branch: &str) -> Option<PrBadge>
The badge for one (repo, branch), if resolved.
Sourcepub fn replace(&self, next: HashMap<PrTarget, PrBadge>) -> bool
pub fn replace(&self, next: HashMap<PrTarget, PrBadge>) -> bool
Replaces the cache wholesale, returning whether anything actually changed.
The bool is load-bearing: the caller bumps the registry’s change-notify only
when it is true. Bumping unconditionally would defeat the server’s
diff-and-drop and re-push an identical snapshot to every window on every
poll — the cost this whole design exists to avoid.
Sourcepub fn any_pending(&self) -> bool
pub fn any_pending(&self) -> bool
Whether any cached badge is still pending — the poller’s cadence signal.