/// <summary> /// Update commitIndex. /// </summary> public void UpdateCommitIndex(ulong commitIndex) { _volatileRWLS.EnterWriteLock(); try { _volatileState.CommitIndex = commitIndex; if (_volatileState.CommitIndex > _volatileState.LastApplied) { //Todo apply log[lastApplied] to state machine(§5.3) _stateMachine.ApplyLog(_persistentState.Logs.Last()); _volatileState.LastApplied += 1; } } finally { _volatileRWLS.ExitWriteLock(); } }