feat(routing,collab,trust): manually expand sticky-session and collab modules
Hyper-P2P Module Tests / unit-all (push) Has been cancelled
Hyper-P2P Module Tests / unit-all (push) Has been cancelled
- sticky-session: unbind, listSessions, bindBatch, remote remove gossip - cursor-presence: peersInDoc, pruneStale - whiteboard-op: listRooms, opCount, pruneRoom - key-rotation: listActiveKeys, revoke, tick activation sweep Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -49,9 +49,25 @@ class HyperP2PKeyRotation extends EventEmitter {
|
||||
return out
|
||||
}
|
||||
|
||||
_maybeActivate (keyId) {
|
||||
listActiveKeys () {
|
||||
return [...this._active.keys()]
|
||||
}
|
||||
|
||||
revoke (keyId) {
|
||||
assertNonEmpty(keyId, 'keyId')
|
||||
const ok = this._active.delete(keyId)
|
||||
this._pending.delete(keyId)
|
||||
if (ok) this.emit('revoked', { keyId })
|
||||
return ok
|
||||
}
|
||||
|
||||
tick (now = Date.now()) {
|
||||
for (const keyId of this._pending.keys()) this._maybeActivate(keyId, now)
|
||||
return this._active.size
|
||||
}
|
||||
|
||||
_maybeActivate (keyId, now = Date.now()) {
|
||||
const list = this._pending.get(keyId) || []
|
||||
const now = Date.now()
|
||||
for (const e of list) {
|
||||
if (e.activateAt <= now) {
|
||||
const active = { keyId, material: e.newMaterial, activatedAt: now }
|
||||
|
||||
Reference in New Issue
Block a user