VoterMesh

class VoterMesh

An M-voter Raft mesh — a complete-graph (K_M) cluster of voter RaftNodes.

VoterMesh is the common base for ServerCluster (JVM/Android relay facade). In tests it is instantiated directly via voterMeshFromNodes without any real network sockets, driven under virtual time by us.tractat.kuilt.raft.test.MultiNodeRaftSim.

Voter nodes

voterNodes holds the live node map. Node lifetimes are tied to scope: cancelling the scope stops all voter coroutines.

Committed stream

committed is a convenience accessor over the first voter — suitable for tests and single-consumer deployments. In multi-consumer scenarios, collect directly from voterNodes.

See also

for the test construction path.

us.tractat.kuilt.cluster.ServerCluster

for the JVM/Android relay facade.

Properties

Link copied to clipboard
val committed: Flow<Committed>

The committed log stream from the first voter — convenience for single-consumer scenarios.

Link copied to clipboard

Live voter nodes — keys are NodeIds.

Functions

Link copied to clipboard
suspend fun awaitLeader(): RaftNode

Suspend until a voter in the mesh holds RaftRole.Leader; return it.

Link copied to clipboard
fun close()

Cancel the owning scope — stops all voter coroutines.