Add features across agents, collab, trust, indexes, and hyperbee.
Manual pass: task cancelTask, workflow topologicalOrder/fail/reset, collab kick/replay, trust trustedPeers and multisig TTL sweep, graph shortestPath, inverted topTerms, dedup filterNew, bee notifyBatch/seekVersion — all with tests. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -50,6 +50,15 @@ class HyperP2PBeeRangeWatch extends EventEmitter {
|
||||
return n
|
||||
}
|
||||
|
||||
notifyBatch (entries) {
|
||||
if (!Array.isArray(entries)) throw new Error('entries must be an array')
|
||||
let total = 0
|
||||
for (const e of entries) {
|
||||
if (e && e.key != null) total += this.emitChange(e.key, e.value, e.op || 'put')
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
unwatch (id) {
|
||||
const ok = this._watches.delete(id)
|
||||
if (ok) this._stats.unwatch++
|
||||
|
||||
@@ -46,3 +46,16 @@ test('watch notify aliases listWatches', async (t) => {
|
||||
t.is(m.listWatches().length, 1)
|
||||
await m.close()
|
||||
})
|
||||
|
||||
test('notifyBatch', async (t) => {
|
||||
const m = new HyperP2PBeeRangeWatch()
|
||||
let hit = 0
|
||||
m.watchRange('a', 'z', () => { hit++ })
|
||||
const n = m.notifyBatch([
|
||||
{ key: 'b', value: 1 },
|
||||
{ key: 'c', value: 2 }
|
||||
])
|
||||
t.is(n, 2)
|
||||
t.is(hit, 2)
|
||||
await m.close()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user