1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// ░▀█▀░█▀▀░█▀█░█▀▄░█▀█░█▀▀░█░░░█▀▀
// ░░█░░▀▀█░█░█░█▀▄░█▀█░█░░░█░░░█▀▀
// ░░▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀▀▀░▀▀▀
//
// tsoracle — Distributed Timestamp Oracle
//
// Copyright (c) 2026 Prisma Risk
// Licensed under the Apache License, Version 2.0
// https://github.com/prisma-risk/tsoracle
//
// #[PerformanceCriticalPath]
//! openraft-backed `ConsensusDriver` for tsoracle.
//!
//! This crate replicates the TSO high-water mark across an openraft cluster
//! and exposes the result via the [`tsoracle_consensus::ConsensusDriver`]
//! trait. The caller supplies a pre-built [`openraft::Raft`] handle (with its
//! own `RaftNetworkFactory` and `RaftLogStorage`); this crate provides the
//! `RaftTypeConfig`, the log-entry type, the [`HighWaterStateMachine`] with
//! a pluggable [`SnapshotStore`] (defaulting to in-memory, with an optional
//! `RocksdbSnapshotStore` behind the `rocksdb-snapshot-store` feature), and
//! the trait bridge.
// Panic policy (see CONTRIBUTING.md). `cfg_attr(not(test), ...)` skips the lint
// for the lib's own unit tests; integration tests are separate compilation units.
//!
//! # Layering
//!
//! - [`log_entry`] defines the single command type replicated through the log.
//! - [`state_machine`] implements `openraft::storage::RaftStateMachine` over
//! an in-memory `u64` counter with bincode snapshots.
//! - [`type_config`] declares the `RaftTypeConfig` via
//! `tsoracle_openraft_toolkit::declare_raft_types_ext!`.
//! - [`host`] declares the `OpenraftHighWaterHost` trait services implement
//! to plug their consensus into the driver.
//! - [`standalone`] supplies the bundled host that owns its own raft cluster
//! and the [`HighWaterStateMachine`].
//! - [`driver`] wraps the `Raft` handle and the state machine into the
//! `ConsensusDriver` impl.
pub use OpenraftDriver;
pub use OpenraftHighWaterHost;
pub use HighWaterCommand;
pub use RocksdbSnapshotStore;
pub use ;
pub use StandaloneHost;
pub use ;
pub use ;