nooschain / consensus/adapters/raft/raft-persistence / DatabaseRaftPersistence
Class: DatabaseRaftPersistence
Defined in: consensus/adapters/raft/raft-persistence.ts:63
Kysely-backed implementation of the RaftPersistence contract.
Implements
Constructors
Constructor
new DatabaseRaftPersistence(
db,nodeId,clusterId):DatabaseRaftPersistence
Defined in: consensus/adapters/raft/raft-persistence.ts:64
Parameters
db
Kysely<Database>
nodeId
string
clusterId
string
Returns
DatabaseRaftPersistence
Methods
appendRaftLogEntry()
appendRaftLogEntry(
record):Promise<void>
Defined in: consensus/adapters/raft/raft-persistence.ts:157
Appends or replaces an uncommitted log entry at the given index.
Parameters
record
Returns
Promise<void>
Implementation of
RaftPersistence.appendRaftLogEntry
compactRaftLogThrough()
compactRaftLogThrough(
index):Promise<void>
Defined in: consensus/adapters/raft/raft-persistence.ts:262
Parameters
index
number
Returns
Promise<void>
Implementation of
RaftPersistence.compactRaftLogThrough
deleteConflictingEntriesFrom()
deleteConflictingEntriesFrom(
index):Promise<void>
Defined in: consensus/adapters/raft/raft-persistence.ts:270
Parameters
index
number
Returns
Promise<void>
Implementation of
RaftPersistence.deleteConflictingEntriesFrom
getRaftLogEntriesFrom()
getRaftLogEntriesFrom(
index):Promise<RaftLogRecord[]>
Defined in: consensus/adapters/raft/raft-persistence.ts:200
Reads log entries from an index onward in ascending order.
Parameters
index
number
Returns
Promise<RaftLogRecord[]>
Implementation of
RaftPersistence.getRaftLogEntriesFrom
getRaftLogEntry()
getRaftLogEntry(
index):Promise<RaftLogRecord|null>
Defined in: consensus/adapters/raft/raft-persistence.ts:181
Reads one log entry by index for replication or diagnostics.
Parameters
index
number
Returns
Promise<RaftLogRecord | null>
Implementation of
RaftPersistence.getRaftLogEntry
installSnapshotCheckpoint()
installSnapshotCheckpoint(
index,term):Promise<void>
Defined in: consensus/adapters/raft/raft-persistence.ts:245
Parameters
index
number
term
number
Returns
Promise<void>
Implementation of
RaftPersistence.installSnapshotCheckpoint
loadRaftLog()
loadRaftLog():
Promise<RaftLogRecord[]>
Defined in: consensus/adapters/raft/raft-persistence.ts:218
Loads the whole persisted log on startup.
Returns
Promise<RaftLogRecord[]>
Implementation of
loadRaftNodeState()
loadRaftNodeState():
Promise<PersistedRaftNodeState>
Defined in: consensus/adapters/raft/raft-persistence.ts:71
Loads or initializes this node's persisted term/vote/application cursors.
Returns
Promise<PersistedRaftNodeState>
Implementation of
RaftPersistence.loadRaftNodeState
markRaftApplied()
markRaftApplied(
index):Promise<void>
Defined in: consensus/adapters/raft/raft-persistence.ts:235
Marks entries through the index applied after local NOOSChain execution.
Parameters
index
number
Returns
Promise<void>
Implementation of
RaftPersistence.markRaftApplied
markRaftCommitted()
markRaftCommitted(
index):Promise<void>
Defined in: consensus/adapters/raft/raft-persistence.ts:223
Marks all log entries through the index committed and persists commitIndex.
Parameters
index
number
Returns
Promise<void>
Implementation of
RaftPersistence.markRaftCommitted
saveRaftNodeState()
saveRaftNodeState(
state):Promise<void>
Defined in: consensus/adapters/raft/raft-persistence.ts:123
Persists term/vote/cursor updates without changing unspecified fields.
Parameters
state
Partial<Omit<PersistedRaftNodeState, "nodeId" | "clusterId">>
Returns
Promise<void>