ClusterConfig

@Serializable
data class ClusterConfig(val voters: Set<NodeId>, val learners: Set<NodeId> = emptySet())

Describes the membership of a Raft cluster.

Voters (voters) participate in leader election and form the quorum for log commitment. A proposal is committed once quorumSize voters have replicated it. Quorum is majority: voters.size / 2 + 1.

Learners (learners) receive log replication from the leader but never vote, never stand for election, and never count toward quorum. They are useful for durable replicas that shouldn't influence availability — e.g. a read replica or an observer node.

Every node — voter or learner — must have a NodeId that is unique within the cluster and stable across restarts.

Factory shortcuts

Use ClusterConfig.ofVoters for a voters-only cluster, or ClusterConfig.withLearner to add a single non-voting learner.

Parameters

voters

The set of nodes that vote and count toward quorum.

learners

Non-voting nodes that receive replication. Defaults to empty.

Constructors

Link copied to clipboard
constructor(voters: Set<NodeId>, learners: Set<NodeId> = emptySet())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Every node in the cluster — voters and learners combined.

Link copied to clipboard
Link copied to clipboard

The minimum number of voters that must replicate an entry before it is committed. Equal to voters.size / 2 + 1 (strict majority).

Link copied to clipboard