brig/log~ LogState

new LogState(logStateopt)

State machine synchronized by module:brig/consensus~Consensus.

Parameters:
NameTypeAttributesDescription
logStatemodule:brig/log~LogStateOptions<optional>

State to initialize with.

Members

lastTerm

The last term number.

Methods

serialize() → {buffer}

Serializes the state to a buffer.

Returns:
Type: 
buffer

setCurrentRole(role) → {module:brig/log~LogState}

Sets the current role to the given symbol.

Parameters:
NameTypeDescription
rolemodule:brig/roles~Follower | module:brig/roles~Candidate | module:brig/roles~Follower

Symbol for the role to set.

toNextTerm() → {module:brig/consensus~NodeStateMachine}

Increments the current term by 1.

Returns:
Type: 
module:brig/consensus~NodeStateMachine

voteFor(id) → {module:brig/log~LogState}

Sets the current vote for the given ID.

Parameters:
NameTypeDescription
idbuffer

Node ID to vote for.

(static) deserialize(serializedNodeState)

Creates a Log state instance from the serialized buffer.

Parameters:
NameTypeDescription
serializedNodeStatebuffer

Output from module:brig/log~LogState#serialize