UNPKG

hamok

Version:

Lightweight Distributed Object Storage on RAFT consensus algorithm

38 lines (37 loc) 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SyncedProperties = void 0; class SyncedProperties { /* Persistent state on all servers: */ /** * latest term server has seen (initialized to 0 * on first boot, increases monotonically) */ currentTerm = 0; /* Volatile state on all servers: */ /** * candidateId that received vote in current * term (or null if none) */ votedFor; /** * index of highest log entry applied to state * machine (initialized to 0, increases * monotonically) */ lastApplied = 0; /* Volatile state on leaders (Reinitialized after election): */ /** * for each server, index of the next log entry * to send to that server (initialized to leader * last log index + 1) */ nextIndex = new Map(); /** * for each server, index of highest log entry * known to be replicated on server * (initialized to 0, increases monotonically) */ matchIndex = new Map(); } exports.SyncedProperties = SyncedProperties;