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
//! Jotun — a Raft node runtime built on
//! [`yggr_core`].
//!
//! Users implement [`StateMachine`] (your application's apply/restore logic) and call
//! [`Node::start`]; the runtime owns the engine, the network
//! transport, the on-disk persistence, the tick driver, and the
//! action dispatcher. Incoming snapshots are installed and restored
//! automatically. By default the runtime also reacts to snapshot hints
//! from the engine by calling [`StateMachine::snapshot`] and feeding
//! the resulting bytes back into Raft; the serializer runs on a
//! separate task so a slow [`StateMachine::snapshot`] does not stall
//! ticks, heartbeats, or [`Node::status`]. `snapshot` is fallible
//! ([`SnapshotError`]); returning `Err` just skips this hint and the
//! engine retries on the next one. Set
//! [`Config::snapshot_hint_threshold_entries`] to `0` (and
//! [`Config::max_log_entries`]) if you want to disable host-initiated
//! compaction entirely.
//!
//! Observability is pull-model: [`Node::metrics`] returns a snapshot
//! of counters and gauges covering elections, replication, commits,
//! applies, reads, and snapshots.
//!
//! For users who want different transport, storage, or concurrency,
//! [`Storage`] and [`Transport`] are traits — the defaults are
//! TCP + a hand-rolled segmented log on disk, but anything that
//! satisfies the trait works.
//!
//! Internals (the engine state machine, log entries, message types)
//! live in [`yggr_core`] and are re-exported here for convenience.
pub use ;
pub use ;
pub use ;
pub use ;
// Convenience re-exports from yggr-core. Saves users from having to
// `use yggr_core::...` for the basics; the engine itself stays
// addressable via that crate for power-user integrations.
pub use ;