Raft Consensus Algorithm
    Preparing search index...

    Raft node runtime coordinating storage, replication, membership, and command application.

    This class owns node lifecycle and integrates all core components. Public methods provide operational APIs while internal methods enforce leader checks, commit waiting, and apply-loop consistency.

    Implements

    Index

    Constructors

    Methods

    • Proposes adding a node to cluster membership.

      Parameters

      • nodeId: string

        Node identifier to add.

      • address: string

        Transport address for the new node.

      • asLearner: boolean = false

        When true, adds the node as learner instead of voter.

      Returns Promise<boolean>

      True when configuration change is committed.

    • Proposes promoting a learner to voter.

      Parameters

      • nodeId: string

        Learner node identifier.

      Returns Promise<boolean>

      True when configuration change is committed.

    • Adds a transport peer without changing cluster configuration.

      Parameters

      • nodeId: string

        Peer node identifier.

      • address: string

        Peer transport address.

      Returns Promise<void>

    • Removes a transport peer without changing cluster configuration.

      Parameters

      • nodeId: string

        Peer node identifier.

      Returns Promise<void>

    • Proposes removing a node from cluster membership.

      Parameters

      • nodeId: string

        Node identifier to remove.

      Returns Promise<boolean>

      True when configuration change is committed.

    • Starts node services and restores persisted state.

      Returns Promise<void>

      Startup opens storage, initializes persistent/log/snapshot/config managers, restores snapshot state when present, wires transport handlers, starts the state machine, and launches the apply loop.

      RaftError When node is already started.

      RaftError When any startup phase fails.