Skip to main content

Module db

Module db 

Source
Expand description

SQLite-backed append-only log storage.

Schema:

  • entries — primary log table. One row per append. Primary key is sequence (auto-incremented). The Merkle tree is materialized in tree_nodes for O(log N) incremental recomputation.
  • tree_nodes — cached Merkle tree nodes, indexed by (level, index). The root is at the highest level for the current size.
  • cert_entries — join table mapping cert fingerprints to log entries. Carries parsed metadata (issuer, subject, validity window) so the API can serve cert-specific queries without re-parsing.
  • ots_proofs — Bitcoin OTS proofs keyed by tree head sequence.
  • witness_sigs — witness countersignatures keyed by tree head sequence + witness ID.

Structs§

Database
Wrapper around the SQLite connection. Cheaply cloneable because Connection is wrapped in a Mutex inside an Arc.
Entry
RebuildRow
One stored entry, parsed into the shape the Merkle rebuild needs. The sequence is the 0-based leaf index (rowid minus one).

Type Aliases§

OtsProofRow
OTS proof row: encoded proof bytes, optional Bitcoin block height, anchor timestamp (ISO 8601).