Package-level declarations

Types

Link copied to clipboard
class FakeRaftNode(val selfId: NodeId = NodeId("self"), initialRole: RaftRole = RaftRole.Follower, initialLeader: NodeId? = null, initialCommitIndex: Long = 0, val clientId: ClientId = ClientId.auto(selfId, Random(selfId.value.hashCode()))) : RaftNode

A test double for RaftNode with driver helpers for driving role transitions, injecting committed entries, emitting trace events, and inspecting outgoing proposals.

Link copied to clipboard
class MultiNodeRaftNetwork(maxPayloadBytes: Int? = null)

An in-process RaftTransport network backed by Channels — the published equivalent of the :kuilt-raft private test network. Obtain a per-node transport via transport; control network partitions via partition, dropLink, and heal.

Link copied to clipboard
class MultiNodeRaftSim(val nodeIds: List<NodeId>, scope: CoroutineScope, nodeScope: CoroutineScope, baseConfig: RaftConfig = MULTI_NODE_SIM_BASE_CONFIG, baseSeed: Long = MULTI_NODE_SIM_SEED, maxPayloadBytes: Int? = null, nodeFactory: (NodeId, RaftTransport, RaftStorage, CoroutineScope) -> RaftNode = defaultNodeFactory(nodeIds, baseConfig, baseSeed))

Multi-node Raft simulation harness for use in tests. See the file-level KDoc for the full determinism contract and setup ceremony.

Properties

Link copied to clipboard

Fast timing config for MultiNodeRaftSim tests — elections fire in single-digit virtual ms, so a 3-node leader election completes in ≤ 20 ms of virtual time.

Link copied to clipboard
const val MULTI_NODE_SIM_SEED: Long = 485

Stable seed for per-node Random derivation in MultiNodeRaftSim. Different from :kuilt-raft's internal test seed (383) so harness tests explore different election orderings independently.

Functions

Link copied to clipboard
fun raftSimTest(n: Int = 3, baseConfig: RaftConfig = MULTI_NODE_SIM_BASE_CONFIG, baseSeed: Long = MULTI_NODE_SIM_SEED, timeout: Duration = 5.seconds, body: suspend TestScope.(MultiNodeRaftSim) -> Unit): TestResult

Build a MultiNodeRaftSim of n voters and run body under runTest(StandardTestDispatcher(), timeout = 5.seconds) — the canonical harness for multi-node Raft tests. See MultiNodeRaftSim for the full determinism contract.