Skip to main content

Module kraft

Module kraft 

Source
Expand description

Hand-rolled KRaft consensus engine (KIP-595 and KIP-996).

The engine is a pure, deterministic, sans-IO on_event state machine (core) over the QuorumState and Role model. The async controller::KraftController drives that state machine over the log::KraftLog and the real KIP-595 transport wire. This is Krabka’s live metadata consensus engine.

Re-exports§

pub use controller::Activation;
pub use controller::KraftConfig;
pub use controller::KraftController;
pub use log::KraftLog;
pub use transport::Command;
pub use transport::Inbound;
pub use transport::MetadataFetchSlice;
pub use transport::NullPeerSender;
pub use transport::PeerSender;
pub use transport::QuorumStateSnapshot;
pub use transport::TimerTick;

Modules§

action
Outputs from the consensus state machine. They are pure side-effect descriptions that the engine executes.
controller
The async KraftController consensus engine.
core
The KRaft quorum state machine: on_event(event, log, now) -> Vec<Action>.
event
Inputs to the consensus state machine.
log
KraftLog: the replicated metadata log behind the LogView seam.
role
The replica’s volatile role within the current epoch and its per-role state.
snapshot_fetch
Pure reassembly state machine for a follower that fetches a KIP-630 snapshot over FetchSnapshot (api key 59).
transport
Transport seam for the KraftController.
types
Core data types for the KRaft consensus state machine (KIP-595/996). Pure, sans-IO: no clock, no wire, no log bytes.

Structs§

LogOffsetMetadata
A log position: an offset together with the leader epoch that produced it.
NodeId
A broker, node, replica, or controller identifier.
QuorumState
The durable quorum state: the logical content of the quorum-state file.
QuorumStateMachine
The hand-rolled KIP-595 + KIP-996 quorum state machine.
QuorumTimeouts
The two timer extents of a QuorumStateMachine, as Kafka’s QuorumConfig holds them.
ReplicaKey
Identifies a voter by node id and directory id, as Kafka’s ReplicaKey does.
SimInstant
A simulated or logical instant in milliseconds.

Enums§

Action
Event
Role

Traits§

LogView
Read-only view of the local replicated log that the state machine uses.

Type Aliases§

Epoch
Consensus epoch, always non-negative; the wire leader epoch is krabka_ids::LeaderEpoch.