ash_model.IntervalPresenceStore¶
- class ash_model.IntervalPresenceStore[source]¶
Sparse interval representation.
Internally we keep:
_intervals– mappingid → List[(start, end)](sorted, disjoint)._starts– mappingid → List[start](parallel to intervals, for bisect)._time_events– difference arraytime → deltafor O(1) interval updates._time_counts– rebuilt lazily from_time_eventswhen needed.Optimizations: - Binary search (bisect) for presence checks: O(log k) per id. - Event-diff updates: O(1) per interval add/remove (vs O(length)).
Methods
__init__()get(t, default)Dict‑style get.
keys()Return iterable of snapshot indices.
setdefault(t, default)Return mutable view for snapshot t (creates if absent).