Next-depth pass: network-stack, CRDTs, gossip, scheduling, experimental

Expand introspection helpers and getStats(protocol) across six categories
after the storage/trust giant pass.

network-stack (10): listPeerIds, hasPeer, bestPeer, listCircuitIds,
queueDepth, listPendingIds, and related helpers; protocol in getStats.

state-crdts: crdt-map has/size/entries; conflict-set size/isEmpty;
reactive-state size/keys; richer getStats on map and conflict-set.

messaging-gossip: gossip-mesh seenCount/clearSeen; dedup size/clear;
event-bus getStats merges metrics/topics/peers.

scheduling-queues: topic-lease listShards/isHeld; peer-scheduler listJobs;
activity-queue pending/claimed stats.

measurement-rate-control: bucket-rate listPeerIds/peerCount.

experimental (16): protocol-rich getStats; mycelium listPeerIds/totalCredits;
pheromone listPathIds.

Docs: API Methods for link-probe, crdt-map, gossip-mesh; expanded category
READMEs for state-crdts, messaging-gossip, scheduling, measurement.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-21 00:32:11 -04:00
co-authored by Cursor
parent 7cb1612e71
commit 70119888cd
37 changed files with 463 additions and 168 deletions
+17 -1
View File
@@ -27,6 +27,16 @@ class HyperP2PMyceliumPool extends EventEmitter {
return this._balances.get(this._pid(peerId)) || 0
}
listPeerIds () { return [...this._balances.keys()] }
totalCredits () {
let t = 0
for (const b of this._balances.values()) t += b
return t
}
loanCount () { return this._loans.length }
donate (peerId, credits) {
if (credits == null || credits < 0) throw new Error('credits must be non-negative')
const id = this._pid(peerId)
@@ -91,7 +101,13 @@ class HyperP2PMyceliumPool extends EventEmitter {
getStats () {
return { ...this._stats }
return {
...this._stats,
peers: this._balances.size,
loans: this._loans.length,
totalCredits: this.totalCredits(),
protocol: PROTOCOL
}
}
async close () {