Expand description
§tsoracle-consensus
The ConsensusDriver trait — the single pluggable extension point for HA and durable persistence in tsoracle.
Implement this trait against your preferred mechanism (openraft, raft-rs, etcd, a single-node file, …) and you can host the tsoracle server on it. The library itself does not run consensus; it consumes whatever you wire into the trait.
§What’s in the box
ConsensusDriver— the three-method trait the server calls into:leadership_events,load_high_water,persist_high_water. About fifty lines of trait surface.LeaderState— the role-class enum the driver’sleadership_eventsstream carries (Leader / Follower / Candidate / NoLeader).ConsensusError— the error type all three trait methods return.
§Documentation
docs/consensus-integration.md— the trait reference: contract for each method, per-driver implementation recipes, a worked example (openraft), the “Choosing a driver” comparison, and the single-leader requirement explained.
§Existing impls in this workspace
If you want a ready-made driver rather than implementing one yourself:
tsoracle-driver-file— single-node, fsync-durable.tsoracle-driver-openraft— HA via openraft.tsoracle-driver-paxos— HA via OmniPaxos.
§Feature flags
serde— derivesSerialize/Deserializeon the public types so they cross wire and storage boundaries cleanly. Propagates totsoracle-core.bt— enables backtrace capture in error variants (propagates totsoracle-core).
Modules§
- docs
- Long-form documentation for tsoracle-consensus.
Structs§
- Advance
OutOf Range - The error carried by a rejected out-of-range high-water advance. See
reject_out_of_range_advance. - Advance
Payload - The payload of an “advance the high-water to at least
at_least” command, shared by every consensus backend’s replicated log entry.
Enums§
- Consensus
Error - Errors returned by
ConsensusDriveroperations. - Leader
State - Leadership state surfaced to the server’s leader-watch task.
Traits§
- Consensus
Driver - The single injection point for HA and durable persistence.
Functions§
- reject_
out_ of_ range_ advance - Reject a high-water advance whose
physical_msvalue exceedstsoracle_core::PHYSICAL_MS_MAX, before it is durably persisted.