feat(observability,encoding,network,pubsub): expand support category modules
Hyper-P2P Module Tests / unit-all (push) Has been cancelled
Hyper-P2P Module Tests / unit-all (push) Has been cancelled
- stats-exporter: snapshot history, compare, filter - health-probe: unhealthyPeers, averageRtt, pruneStale - schema-validator: assertValid, validateBatch, maxLength rules - compact-codec-bridge: encodeBatch, listCodecs - discovery-health: topPeers, pruneStale, averageRtt - peer-bootstrap-store: removeBootstrap, findByHint - retained-messages: retainBatch, totalRetained, channelCount - ci: restore flat-repo production test workflow Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -41,6 +41,23 @@ class HyperP2PPeerBootstrapStore extends EventEmitter {
|
||||
return [...this._bootstraps.values()]
|
||||
}
|
||||
|
||||
removeBootstrap (peerId) {
|
||||
const ok = this._bootstraps.delete(peerId)
|
||||
if (ok) {
|
||||
this._gossip({ type: 'bootstrap-remove', peerId, at: Date.now() })
|
||||
this.emit('remove', { peerId })
|
||||
}
|
||||
return ok
|
||||
}
|
||||
|
||||
findByHint (key, value) {
|
||||
return this.allBootstraps().filter((e) => e.hints && e.hints[key] === value)
|
||||
}
|
||||
|
||||
bootstrapCount () {
|
||||
return this._bootstraps.size
|
||||
}
|
||||
|
||||
_gossip (data) {
|
||||
if (!this._peerMsgs) return
|
||||
gossipSend(this, data)
|
||||
@@ -48,6 +65,10 @@ class HyperP2PPeerBootstrapStore extends EventEmitter {
|
||||
}
|
||||
|
||||
_onGossip (data, peerInfo) {
|
||||
if (data.type === 'bootstrap-remove' && data.peerId) {
|
||||
this._bootstraps.delete(data.peerId)
|
||||
return
|
||||
}
|
||||
if (!data || data.type !== 'bootstrap-add' || !data.peerId) return
|
||||
this._stats.gossipIn++
|
||||
const from = data.from || (peerInfo && peerInfo.publicKey
|
||||
|
||||
Reference in New Issue
Block a user