Skip to main content

Crate krabka_kraft_core

Crate krabka_kraft_core 

Source
Expand description

Deterministic, sans-IO KRaft consensus core (KIP-595 + KIP-996).

This crate is Krabka’s metadata-quorum engine: a synchronous on_event(event, log, now) -> Vec<Action> state machine (core::QuorumStateMachine) over the QuorumState/Role model. It never reads the clock, touches a socket, or writes a byte to disk. The caller injects the time as a SimInstant, the state machine reads the log through the LogView seam, and it returns every effect as an Action for the caller to execute.

krabka-raft wraps this core with the async engine, the real KIP-595 wire, and the on-disk krabka-log. It re-exports these modules under krabka_raft::kraft. The core is a leaf crate with no tokio, no filesystem, and no crypto, so it compiles for wasm32-unknown-unknown. The sim module, behind the sim feature, uses this to drive an interactive consensus simulation in the browser playground.

Re-exports§

pub use action::Action;
pub use action::TimerKind;
pub use core::QuorumStateMachine;
pub use core::QuorumTimeouts;
pub use core::election_jitter_ms;
pub use event::Event;
pub use event::LogEnd;
pub use event::SuccessorRank;
pub use role::ReplicaProgress;
pub use role::Role;
pub use types::Epoch;
pub use types::LogOffsetMetadata;
pub use types::LogView;
pub use types::QuorumState;
pub use types::ReplicaKey;
pub use types::SimInstant;

Modules§

action
Outputs from the consensus state machine. They are pure side-effect descriptions that the engine executes.
core
The KRaft quorum state machine: on_event(event, log, now) -> Vec<Action>.
event
Inputs to the consensus state machine.
role
The replica’s volatile role within the current epoch and its per-role state.
simulation_support
Shared deterministic mechanics for the browser and storage simulation harnesses.
snapshot_fetch
Pure reassembly state machine for a follower that fetches a KIP-630 snapshot over FetchSnapshot (api key 59).
types
Core data types for the KRaft consensus state machine (KIP-595/996). Pure, sans-IO: no clock, no wire, no log bytes.

Structs§

NodeId
A broker, node, replica, or controller identifier.