Skip to content

TemporalCollections - First Public Release

Choose a tag to compare

@engineering87 engineering87 released this 14 Aug 14:34
· 39 commits to main since this release
d59e3e8

A set of thread-safe .NET collections with built-in UTC timestamps and a unified ITimeQueryable<T> API for range queries, cleanup, and temporal analytics. Timestamps are strictly monotonic, ensuring deterministic ordering even under high concurrency.

🚀 Highlights
Unified time API via ITimeQueryable<T>:

  • GetInRange, RemoveOlderThan, CountInRange, GetTimeSpan, RemoveRange, GetBefore, GetAfter, GetEarliest, GetLatest, Clear.
  • Deterministic ordering: results are returned in ascending timestamp order (strict before/after semantics).
  • Concurrency-ready: internal locking/lock-free primitives where appropriate.
  • Stable comparer for TemporalItem<T> to avoid drops in ordered sets when timestamps collide.

📦 Included Collections

  • TemporalSortedList<T>: sorted by timestamp; fast window queries (binary searches).
  • TemporalCircularBuffer<T>: fixed-capacity, overwrites oldest; O(1) add, ordered snapshots.
  • TemporalQueue<T>: FIFO with timestamps; time-based pruning and queries.
  • TemporalStack<T>: LIFO with timestamps; time-based pruning and queries.
  • TemporalPriorityQueue<TPriority, TValue>: priority + timestamp (stable by time for ties).
  • TemporalDictionary<TKey, TValue>: multi-value per key with timestamps; per-key and global queries.
  • TemporalSlidingWindowSet<T>: deduplicated set with sliding window expiration.
  • TemporalIntervalTree<T>: interval storage (start/end) with overlap queries (timestamp = start).

🧭 Unified ITimeQueryable (Summary)

  • Inclusive range: GetInRange(from, to), CountInRange(from, to), RemoveRange(from, to) (throws if to < from).
  • Cleanup: RemoveOlderThan(cutoff), Clear().
  • Navigation: GetBefore(time), GetAfter(time), GetEarliest(), GetLatest().
  • Span: GetTimeSpan() = latest.Timestamp - earliest.Timestamp.