pub struct DedupCache {
seen: HashMap<String, u64>,
insertion_order: VecDeque<String>,
}Expand description
Phase F.7 host-bridge dedup cache. Bounded FIFO map keyed by
"{event_kind}|{label}|{hwnd}" → max version dispatched.
FIFO insertion order is tracked explicitly via insertion_order
because std HashMap::keys().next() iteration order is undefined
per-rebuild — the previous implementation could evict the
just-inserted key (reagent P1 PR #722 round 1).
Reset on launcher restart sentinel (codex P1 PR #722 round 1):
when the launcher’s event_version resets to 1, any cached key
holding a higher version blocks the v=1 event. Mirror the
renderer-side guard’s heuristic — clear the cache when we see a
v=1 event AND any cached entry has a version > 0.
Fields§
§seen: HashMap<String, u64>§insertion_order: VecDeque<String>Implementations§
Source§impl DedupCache
impl DedupCache
pub fn new() -> Self
Sourcepub fn check_and_record(
&mut self,
key: String,
version: u64,
cap: usize,
) -> bool
pub fn check_and_record( &mut self, key: String, version: u64, cap: usize, ) -> bool
Returns true if the event should be dispatched (strictly newer
for its key). Updates the cache as a side-effect when admitted.
Bounded at cap; on overflow, evicts the oldest insertion in
FIFO order.
Sourcepub fn has_any_versioned_entry(&self) -> bool
pub fn has_any_versioned_entry(&self) -> bool
True if any cached entry has a version above 0 — used as the guard for the v=1 restart sentinel.
pub fn len(&self) -> usize
Trait Implementations§
Source§impl Default for DedupCache
impl Default for DedupCache
Source§fn default() -> DedupCache
fn default() -> DedupCache
Auto Trait Implementations§
impl Freeze for DedupCache
impl RefUnwindSafe for DedupCache
impl Send for DedupCache
impl Sync for DedupCache
impl Unpin for DedupCache
impl UnwindSafe for DedupCache
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
§impl<T, U> ConvertReturnValue<U> for Twhere
T: Into<U>,
impl<T, U> ConvertReturnValue<U> for Twhere
T: Into<U>,
fn wrap_result(self) -> U
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.