Expand description
Append-only operation log: the L1 wire format and the log-backend seam.
One-way-door rules (DECISIONS.md) enforced here:
- every persisted entry carries
format_version - hashes are self-describing (codec byte + digest), so the hash function can change under the same envelope (D6)
witnessesexists from day 1 and stays empty (D67), so the append-only → witnessed swap (D16) is additive, not a migration
§Examples
use choir_oplog::{MemLog, OpEntry, OpLog, FORMAT_VERSION};
let mut log = MemLog::new();
let genesis = OpEntry {
format_version: FORMAT_VERSION,
parent: None,
seq: 0,
channel: "agent-1".into(),
payload: b"first op".to_vec(),
witnesses: Vec::new(),
author_sig: None,
};
let head = log.append(genesis).unwrap();
assert_eq!(log.head(), Some(head));
assert_eq!(log.len(), 1);§Where this sits
docs/architecture.md is the map of the whole workspace.
This crate is L1, the op log’s wire format and the seam every log backend implements.
It builds on choir_hash.
Modules§
- repair
- Inspecting and repairing a log file that a daemon is not holding.
- scheme
- Signature scheme identifiers for
Witness::scheme(D39).
Structs§
- Content
Hash - Self-describing content address (multihash-style envelope).
- FileLog
- Second implementation (seam rule: feature-poor is fine, broken is not): JSON-lines file, append-only, rebuilt head on open.
- MemLog
- Primary in-memory implementation (also the dev/test runtime).
- OpEntry
- One operation in the log. Payload semantics live above this layer.
- Witness
- A cosignature: a witness cosignature (never populated here, D67) or,
in
OpEntry::author_sig, the author’s own. Present in the format from the first persisted byte so adding witnessing never rewrites history.
Enums§
Constants§
- FORMAT_
VERSION - Current wire-format version. Bump on any incompatible change; additive changes keep the version (DECISIONS.md).
Traits§
- OpLog
- The log-backend seam (D16). Conformance suite:
tests/it/conformance.rs, run against every implementation.
Functions§
- signing_
hash - Hash over an author’s submission content — see
OpEntry::signing_hash. Standalone so clients can sign before the sequencer has built the entry.