zerodds-durability-store

Services — Durability. Storage abstraction of the Durability-Service for TRANSIENT and PERSISTENT durability (OMG DDS 1.4 §2.2.3.4/§2.2.3.5); the architecture follows ADR 0009.

zerodds-durability-store is the storage layer of the Durability-Service. It depends on no DDS or RTPS crate, only on zerodds-qos. The daemon (zerodds-durability-service) and the storage adapters build on it:

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

The crate docs state three invariants:

  1. The QoS is the contract. Contract, derived from DurabilityServiceQosPolicy, is the only bound on retention. The cold store enforces it: the oldest sample is dropped under KEEP_LAST, StoreError::OutOfResources is returned when a KEEP_ALL limit is reached.
  2. The memory budget does not bound retention. TieredStore uses it only to decide how much of the contracted history stays in RAM. Every sample is written through to the cold store; when the per-topic byte budget is exceeded, the samples with the lowest sequence numbers are evicted from RAM only.
  3. The cold store holds the full contracted history. DurabilityStore::query returns pages (Selector, Page, Cursor) ordered by (instance_key, sequence).

Public items: the trait DurabilityStore (set_contract, set_topic_meta, topic_meta, store, query, unregister, cleanup, stats, replay_for_topic); Contract (from_qos, keep_all); DurabilitySample (topic, 16-byte instance KeyHash, sequence number, payload, XCDR representation, byte order, creation time, GUID and sequence number of the source writer); TopicMeta (type name, keyedness, contract); StoreStats; InMemoryStore (cold store for TRANSIENT without disk, also the reference for the trait semantics); TieredStore; StoreError (OutOfResources, Backend, Poisoned).

Spec anchors

  • OMG DDS 1.4 §2.2.3.4 (DURABILITY), §2.2.3.5 (DURABILITY_SERVICE).
  • DDSI-RTPS §9.6.4.8 (instance KeyHash, 16 bytes), §10.5 (representation from the encapsulation header), §8.3.5.4 (sequence number of the source writer), §8.4.2.1 (type_name), §9.3.1.2 (entityKind, keyedness).

Consumers

Status

  • std (uses std::sync::Mutex and std::time), #![forbid(unsafe_code)]. Safety classification in the crate docs: STANDARD.
  • Library only, no binary, no cargo features.
  • Test functions in the source: 3 in src/contract.rs, 13 in tests/store_semantics.rs.

zerodds-durability-store

Dienste — Durability. Speicherabstraktion des Durability-Service für Durability TRANSIENT und PERSISTENT (OMG DDS 1.4 §2.2.3.4/§2.2.3.5); die Architektur folgt ADR 0009.

zerodds-durability-store ist die Speicherschicht des Durability-Service. Die Crate hängt von keiner DDS- oder RTPS-Crate ab, nur von zerodds-qos. Der Daemon (zerodds-durability-service) und die Speicheradapter bauen darauf auf:

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

Die Crate-Dokumentation nennt drei Invarianten:

  1. Die QoS ist der Vertrag. Contract, abgeleitet aus DurabilityServiceQosPolicy, ist die einzige Grenze der Aufbewahrung. Der Speicher der kalten Ebene setzt sie durch: Unter KEEP_LAST fällt das älteste Sample weg, bei Erreichen einer Grenze unter KEEP_ALL kommt StoreError::OutOfResources zurück.
  2. Das Speicherbudget begrenzt die Aufbewahrung nicht. TieredStore entscheidet damit nur, wie viel der vertraglich gehaltenen Historie im RAM bleibt. Jedes Sample wird bis in die kalte Ebene durchgeschrieben; wird das Byte-Budget eines Topics überschritten, fallen die Samples mit den niedrigsten Sequenznummern nur aus dem RAM.
  3. Die kalte Ebene hält die vollständige vertragliche Historie. DurabilityStore::query liefert Seiten (Selector, Page, Cursor), sortiert nach (instance_key, sequence).

Öffentliche Elemente: das Trait DurabilityStore (set_contract, set_topic_meta, topic_meta, store, query, unregister, cleanup, stats, replay_for_topic); Contract (from_qos, keep_all); DurabilitySample (Topic, 16 Byte KeyHash der Instanz, Sequenznummer, Nutzdaten, XCDR-Repräsentation, Byte-Reihenfolge, Erzeugungszeit, GUID und Sequenznummer des Quell-Writers); TopicMeta (Typname, Key-Eigenschaft, Vertrag); StoreStats; InMemoryStore (kalte Ebene für TRANSIENT ohne Platte, zugleich Referenz für die Semantik des Traits); TieredStore; StoreError (OutOfResources, Backend, Poisoned).

Spec-Anker

  • OMG DDS 1.4 §2.2.3.4 (DURABILITY), §2.2.3.5 (DURABILITY_SERVICE).
  • DDSI-RTPS §9.6.4.8 (KeyHash der Instanz, 16 Byte), §10.5 (Repräsentation aus dem Encapsulation-Header), §8.3.5.4 (Sequenznummer des Quell-Writers), §8.4.2.1 (type_name), §9.3.1.2 (entityKind, Key-Eigenschaft).

Konsumenten

Status

  • std (verwendet std::sync::Mutex und std::time), #![forbid(unsafe_code)]. Einstufung in der Crate-Dokumentation (safety classification): STANDARD.
  • Nur Bibliothek, kein Binary, keine Cargo-Features.
  • Testfunktionen im Quelltext: 3 in src/contract.rs, 13 in tests/store_semantics.rs.