NodeStart

class NodeStart

One start of one node in a MultiNodeRaftSim: everything a nodeFactory needs to build the RaftNode for it. The sim makes one at construction for each node, and another on every MultiNodeRaftSim.restart.

The point of the type is random. A restart is a new process, so it needs a new seed, and the sim, not the factory, picks it. A factory that seeds RaftConfig.random from random cannot bring a restarted us.tractat.kuilt.raft.ClientIdentity.Auto node back under its old client id, because it never chooses a seed at all (#3425, #3659):

MultiNodeRaftSim(nodeIds = ids, scope = this, nodeScope = backgroundScope) { start ->
start.scope.raftNode(cluster, start.transport, start.storage, baseConfig.copy(random = start.random))
}

Only the sim makes one, so its constructor is internal.

Properties

Link copied to clipboard
val id: NodeId

The node being started.

Link copied to clipboard

A fresh Random seeded for this start of this node: the same seed the sim's default factory gives it, a pure function of the sim's baseSeed, the node's index in MultiNodeRaftSim.nodeIds and start. A node built from it draws exactly what a default-factory node would. It is a new instance on every start; anything else a factory draws from it moves the draws the node sees after.

Link copied to clipboard
val scope: CoroutineScope

This start's own scope, a child of the sim's node scope. MultiNodeRaftSim.crash cancels it.

Link copied to clipboard
val start: Int

Which start of this node this is: 0 at construction, k on its k-th restart.

Link copied to clipboard

The node's durable storage, the same MultiNodeRaftSim.storages entry on every start, so a restart boots from what the last incarnation wrote.

Link copied to clipboard

The node's transport on MultiNodeRaftSim.network.

Functions

Link copied to clipboard
open override fun toString(): String