kuilt-cluster

kuilt-cluster is the server-cluster facade for kuilt-raft. It packages the two-tier overlay topology — a complete-graph voter core (K_m) plus a sparse learner periphery — as two high-level types: ServerCluster (server side) and ClusterClient (client side).

What it provides

ClusterClient (commonMain)

Wraps a Raft learner RaftNode and exposes:

  • propose(command) — proposes with an auto-minted monotonic requestId. Forwards to the current leader; suspends until committed. Returns the committed LogEntry.

  • propose(command, requestId) — cross-crash exactly-once overload. Persist the requestId before calling; replay it after a crash or failover. The server's ClientSessionTable.shouldApply deduplicates retries.

  • committed: Flow<Committed> — the committed log stream. Single-collection contract (mirror of RaftNode.committed): collect once per ClusterClient; fan out with shareIn if multiple consumers are needed.

  • role: StateFlow<RaftRole> — always RaftRole.Learner in the relay model.

  • close() — cancels the underlying RaftNode.

Obtain an instance via clusterClientWithNode(raftNode) (tests / caller-managed transport) or via CoroutineScope.clusterClient() (production relay-room path).

Samples

us.tractat.kuilt.cluster.samples.ClusterClientSample.connectAndPropose ###

Packages

Link copied to clipboard
common