zerodds-durability-store-postgres

Services — Durability. PostgreSQL storage adapter for the Durability-Service, a shared tier for PERSISTENT durability reachable over the network; implements DurabilityStore from zerodds-durability-store (ADR 0009).

zerodds-durability-store-postgres is the adapter for many producers writing into one shared database. PostgresStore::connect(conn_str, default_contract) takes a libpq connection string in keyword or URI form. The semantics are those of the sqlite adapter: one row per sample, (topic, instance, sequence) identifies a sample, a re-send replaces the row, and retention is bounded only by the Contract of the topic. Tables: samples, unregistered, topic_meta. The client is the synchronous postgres crate 0.19.

The connection uses NoTls. The crate docs say to place daemon and database on a trusted network segment or to put a TLS-terminating proxy in front of the database.

Consumers

  • zerodds-durability-service-bin, through its features postgres and postgres-timescaledb (both off by default).

Features

  • timescaledb (off by default): creates samples as a TimescaleDB hypertable partitioned on created_nanos, in chunks of one day. Requires the timescaledb extension in the target database. The primary key then includes created_nanos; the identity of a sample on (topic, instance, sequence) is kept by a delete before each insert.

Status

  • std, #![forbid(unsafe_code)]. Safety classification in the crate docs: STANDARD.
  • Library only, no binary.
  • 9 test functions in tests/pg_store.rs. They need a PostgreSQL database named in ZERODDS_PG_TEST_URL; without it each test prints a skip message and returns early.

zerodds-durability-store-postgres

Dienste — Durability. PostgreSQL-Speicheradapter für den Durability-Service, eine gemeinsame, über das Netz erreichbare Ebene für Durability PERSISTENT; implementiert DurabilityStore aus zerodds-durability-store (ADR 0009).

zerodds-durability-store-postgres ist der Adapter für viele Erzeuger, die in eine gemeinsame Datenbank schreiben. PostgresStore::connect(conn_str, default_contract) nimmt einen libpq-Verbindungsstring in Schlüsselwort- oder URI-Form. Die Semantik entspricht dem sqlite-Adapter: eine Zeile pro Sample, (topic, instance, sequence) identifiziert ein Sample, ein erneutes Senden ersetzt die Zeile, und die Aufbewahrung ist nur durch den Contract des Topics begrenzt. Tabellen: samples, unregistered, topic_meta. Als Client dient die synchrone Crate postgres 0.19.

Die Verbindung verwendet NoTls. Laut Crate-Dokumentation gehören Daemon und Datenbank in ein vertrauenswürdiges Netzsegment, oder vor die Datenbank kommt ein Proxy, der TLS terminiert.

Konsumenten

  • zerodds-durability-service-bin, über dessen Features postgres und postgres-timescaledb (beide standardmäßig aus).

Features

  • timescaledb (standardmäßig aus): legt samples als TimescaleDB-Hypertable an, partitioniert nach created_nanos in Abschnitten von einem Tag. Setzt die Erweiterung timescaledb in der Zieldatenbank voraus. Der Primärschlüssel enthält dann created_nanos; die Identität eines Samples über (topic, instance, sequence) bleibt durch ein Löschen vor jedem Einfügen erhalten.

Status

  • std, #![forbid(unsafe_code)]. Einstufung in der Crate-Dokumentation (safety classification): STANDARD.
  • Nur Bibliothek, kein Binary.
  • 9 Testfunktionen in tests/pg_store.rs. Sie brauchen eine PostgreSQL-Datenbank, die in ZERODDS_PG_TEST_URL angegeben ist; ohne diese Variable gibt jeder Test eine Meldung zum Überspringen aus und kehrt vorzeitig zurück.