zerodds-durability-store-postgres
Services — Durability. PostgreSQL storage adapter for the Durability-Service, a shared tier for
PERSISTENTdurability reachable over the network; implementsDurabilityStorefromzerodds-durability-store(ADR 0009).
- Source: crates/durability-store-postgres
- API docs: docs.rs/zerodds-durability-store-postgres
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 featurespostgresandpostgres-timescaledb(both off by default).
Features
timescaledb(off by default): createssamplesas a TimescaleDB hypertable partitioned oncreated_nanos, in chunks of one day. Requires thetimescaledbextension in the target database. The primary key then includescreated_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 inZERODDS_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; implementiertDurabilityStoreauszerodds-durability-store(ADR 0009).
- Quelle: crates/durability-store-postgres
- API-Docs: docs.rs/zerodds-durability-store-postgres
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 Featurespostgresundpostgres-timescaledb(beide standardmäßig aus).
Features
timescaledb(standardmäßig aus): legtsamplesals TimescaleDB-Hypertable an, partitioniert nachcreated_nanosin Abschnitten von einem Tag. Setzt die Erweiterungtimescaledbin der Zieldatenbank voraus. Der Primärschlüssel enthält danncreated_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 inZERODDS_PG_TEST_URLangegeben ist; ohne diese Variable gibt jeder Test eine Meldung zum Überspringen aus und kehrt vorzeitig zurück.