Add batch helpers, clear utilities, and count methods for qos topics, brokers, probes, leases, locks, and registry modules. Co-authored-by: Cursor <[email protected]>
hyper-p2p-leader-lease
Lightweight leader election with lease expiry over gossip (term + leader + until timestamp).
Category: Consensus & coordination · Protocol: leader-lease/v1
When to use
Pick a single coordinator for jobs, cron ownership, or write serialization when full Raft is unnecessary.
When not to use
Byzantine fault tolerance, replicated logs, or strict linearizability (use hyper-p2p-raft-lite or hyper-p2p-causal-consensus).
Quick start
const { HyperP2PLeaderLease } = require('hyper-p2p-leader-lease')
const ll = new HyperP2PLeaderLease({ topic: process.argv[2], leaseTtlMs: 30000 })
await ll.ready()
ll.campaign(1)
console.log('leader:', ll.leader())
Docs
docs/api.md · docs/architecture.md
Test
npm install && npm test · bare examples/basic.js [topic]