Expand pear, encoding, consensus, supercomputer, and CRDT modules
Add manual API helpers across categories: pear link resolver cache, applink reload, storage layout defaults, compact codec decodeBatch, schema allValid/getSchema, session bridge removePair, udx sendRecvRatio, cluster affinity and cpu-share clearAll, raft truncateLog/currentTerm, quorum vote tally, silence and whisper seen helpers, qos unsubscribeAll, LWW register clearAll, peer selector topRegions, graph hasPath, fork choice clearViews, and trust gate untrustAll. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -52,6 +52,18 @@ class HyperP2PRaftLite extends EventEmitter {
|
||||
return this._commitIndex
|
||||
}
|
||||
|
||||
truncateLog (keep = 0) {
|
||||
const n = Math.max(0, keep | 0)
|
||||
const removed = this._log.length - n
|
||||
if (removed > 0) this._log = this._log.slice(-n)
|
||||
if (this._commitIndex >= this._log.length) this._commitIndex = this._log.length - 1
|
||||
return removed
|
||||
}
|
||||
|
||||
currentTerm () {
|
||||
return this._currentTerm
|
||||
}
|
||||
|
||||
role () {
|
||||
return this._role
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user