EphemeralMapTracker
A stateful wrapper around EphemeralMap that stamps local receive times and drives TTL eviction.
Responsibilities
Maintains a mutable EphemeralMap state by merging inbound EphemeralMap updates via received.
Stamps a local receive time (via clock) whenever a replica's entry advances to a higher clock — i.e. only real updates reset the TTL, not stale re-deliveries.
Surfaces live: the set of entries not yet expired and not departed.
Clock contract
clock is a () -> Long that returns the current local monotonic time in milliseconds. The production default is kotlin.time.TimeSource.Monotonic. Tests inject a controlled counter so eviction can be driven deterministically without wall-clock dependencies.
Parameters
expiry window in milliseconds. An entry is considered expired when now - receiveTime >= ttlMs. The boundary is exclusive: exactly at ttlMs ms the entry is expired.
injectable monotonic time source (milliseconds).
Type Parameters
the presence value type.
Functions
Merge an inbound update into the local state.
The current merged CRDT state (all entries, including departed/stale).