Skip to main content

Crate zerodds_durability_store

Crate zerodds_durability_store 

Source
Expand description

DDS Durability-Service storage abstraction (DDS 1.4 §2.2.3.4/§2.2.3.5).

Crate zerodds-durability-store. Safety classification: STANDARD.

This crate is the storage layer of the standalone Durability-Service (ADR 0009). It is deliberately free of any DDS/RTPS dependency — the daemon (zerodds-durability-service) and adapters (zerodds-durability-store-{sqlite,file,lakehouse}) build on top of it.

§Layering (ADR 0009)

TieredStore        — memory hot-cache (bounded by a byte budget) over any cold store
  └─ DurabilityStore (this trait) — store / query / unregister / cleanup / stats
        └─ cold adapter (sqlite / file / lakehouse / in-memory)

§Invariants (normative, ADR 0009)

  1. The QoS is the contract. Contract (derived from DurabilityServiceQosPolicy + history) is the ONLY thing that bounds retention. The cold store enforces it (drop-oldest / OutOfResources).
  2. The memory budget is not a retention knob. TieredStore’s hot cache only decides how much contracted history is kept hot in RAM; the rest lives in the cold store and is streamed on read — never capped.
  3. The cold store is authoritative for the full contracted history. Reads (DurabilityStore::query) are paginated (Page/Cursor), never “everything into RAM”.

Structs§

Contract
Retention contract for a topic, derived from its DurabilityServiceQosPolicy. The cold store MUST enforce exactly this and nothing tighter (the memory budget is a separate, non-retention knob).
DurabilitySample
A stored durability sample. The (instance_key, sequence) pair is the stable ordering key within a topic.
InMemoryStore
In-memory, contract-bounded durability store. Thread-safe via a single mutex. Used directly as the TRANSIENT cold store, and as the hot tier inside crate::TieredStore.
Page
One page of a paginated crate::DurabilityStore::query result. Samples are ordered by (instance_key, sequence). next is Some when more samples may follow — feed it back via Selector::after_cursor.
Selector
A read selector for crate::DurabilityStore::query. All filters are optional and combine with AND. after + limit drive pagination.
StoreStats
Aggregate counters for a topic (diagnostics, limit accounting, tiering).
TieredStore
A memory hot-cache over a cold DurabilityStore. The hot budget is per-topic, in bytes of payload.

Enums§

StoreError
Errors surfaced by a crate::DurabilityStore.

Traits§

DurabilityStore
A durable, contract-bounded sample store. Implementations are the cold adapters (sqlite / file / lakehouse / in-memory). All methods are &self + Send + Sync: the daemon shares one store across threads.

Type Aliases§

Cursor
Pagination cursor: the (instance_key, sequence) of the last sample of a Page. The next page starts strictly after this key in (instance_key, sequence) lexicographic order.
Result
Result alias for the durability store.