Expand description
KIP-595 consensus decision kernels, extracted from krabka-kraft-core so
Creusot can verify them (the host crate’s Instant/async surface is
untranslatable).
The functions carry their Creusot preconditions, postconditions, invariants, variants, and supporting lemmas directly beside the executable bodies.
Structs§
- Failover
Facts - What the host established about one partition before the failover decision. The kernel does not see replica sets; every field is the host’s classification of them.
- OutOf
IsrFacts - The out-of-ISR options, consulted only when no ISR member is live.
- Recovery
Candidate - One surviving replica’s log as KIP-966 unclean recovery ranks it, from its
GetReplicaLogInfoanswer.
Enums§
- Failover
Action - Safety action selected after the host classifies live ISR and replicas.
- Failover
Recovery - Offset-aware recovery mode resolved for one partition.
- LiveIsr
- What the live members of the partition’s ISR can do once the leader is gone. Every live ISR member holds every committed record; a witness is a live member that never leads.
Functions§
- election_
has_ quorum - Whether the unique grants from current voters reach a majority.
- election_
jitter_ ms - Deterministic per-
(node, epoch)election-timeout jitter in[0, base_ms). - failover_
action - Select the failover action class by a fixed precedence ladder.
- log_
is_ up_ to_ date trueif the candidate’s log is at least as up-to-date as ours.- majority_
size - Majority size for a voter set:
floor(n / 2) + 1. - majority_
watermark - The watermark a majority has acknowledged, never below
current. - recompute_
high_ watermark - The HWM as the majority-th largest match offset across the leader’s own log
end, when
leader_counts, and every follower’s acknowledged fetch offset. - select_
best_ recovery_ replica - Select the replica with highest
(last leader epoch, log end offset)and lowest broker ID as the deterministic tie-breaker.