Expand pear, media, experimental, state, and messaging modules
Add manual API helpers across categories: pear runtime/embed/runner/spawn, preflight cancel, update gossip history, headless UI pipe helpers, media origin weights and latency paths, experimental void/tension/time-capsule, CRDT conflict-set and grow-only-set, job dispatcher peek, trust graph decay, session rotateAll, topic channel batch unsubscribe, fulltext searchOr, FEC batch encode, marketplace cheapest listing, and noise session closeAll. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -62,6 +62,17 @@ class HyperP2PSessionRotation extends EventEmitter {
|
||||
return s ? s.version : 0
|
||||
}
|
||||
|
||||
rotateAll (tokenBySession) {
|
||||
if (!tokenBySession || typeof tokenBySession !== 'object') {
|
||||
throw new Error('tokenBySession object required')
|
||||
}
|
||||
const out = []
|
||||
for (const [sessionId, token] of Object.entries(tokenBySession)) {
|
||||
out.push(this.rotateSession(sessionId, token))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
_gossip (data) {
|
||||
if (!this._peerMsgs) return
|
||||
gossipSend(this, data)
|
||||
|
||||
@@ -153,6 +153,19 @@ class HyperP2PTrustGraph extends EventEmitter {
|
||||
return n
|
||||
}
|
||||
|
||||
setDecay (decay) {
|
||||
if (decay <= 0 || decay > 1) throw new Error('decay must be in (0,1]')
|
||||
this.decay = decay
|
||||
return this.decay
|
||||
}
|
||||
|
||||
directTrust (from, to) {
|
||||
const f = typeof from === 'string' ? from : b4a.toString(from, 'hex')
|
||||
const t = typeof to === 'string' ? to : b4a.toString(to, 'hex')
|
||||
const edge = this._edgeMap(f).get(t)
|
||||
return edge ? edge.weight : 0
|
||||
}
|
||||
|
||||
async ready () {
|
||||
if (this.swarm || !this.topic) return this
|
||||
await initModuleSwarm(this, {
|
||||
|
||||
Reference in New Issue
Block a user