Complete module API expansion: snapshot() on all remaining modules.
Adds snapshot(), clearAll aliases, and batch helpers across storage (hyperbee, hypercore, hyperdrive, autobase), indexes, pear-platform, trust, routing intent-router, and temporal-index. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -640,6 +640,10 @@ class HyperP2PSemanticVectorIndex extends EventEmitter {
|
|||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async snapshot () {
|
||||||
|
return { ...this.getMetrics(), vectorIds: this.vectorIds().length }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = HyperP2PSemanticVectorIndex
|
module.exports = HyperP2PSemanticVectorIndex
|
||||||
|
|||||||
@@ -166,6 +166,10 @@ class HyperP2PSimilarityLsh extends EventEmitter {
|
|||||||
return items.map((it) => this.embed(it.id, it.vector))
|
return items.map((it) => this.embed(it.id, it.vector))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { vectors: this._vectors.size, buckets: this._buckets.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return {
|
return {
|
||||||
...this._stats,
|
...this._stats,
|
||||||
|
|||||||
@@ -271,6 +271,10 @@ class SpatialIndex extends EventEmitter {
|
|||||||
return [...this.localPoints.keys()]
|
return [...this.localPoints.keys()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async snapshot () {
|
||||||
|
return { points: this.localPoints.size, ids: this.pointIds() }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return {
|
return {
|
||||||
...this._stats,
|
...this._stats,
|
||||||
|
|||||||
@@ -109,6 +109,11 @@ class HyperP2PPercentileSketch extends EventEmitter {
|
|||||||
return this.reset()
|
return this.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
const s = this.summarize()
|
||||||
|
return s || { samples: 0 }
|
||||||
|
}
|
||||||
|
|
||||||
summarize () {
|
summarize () {
|
||||||
this._sort()
|
this._sort()
|
||||||
if (!this._sorted.length) return null
|
if (!this._sorted.length) return null
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ class HyperBareAddonResolve extends EventEmitter {
|
|||||||
return names.map((n) => this.resolve(n))
|
return names.map((n) => this.resolve(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { addons: this._addons.size, platform: this.platform }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return platformStats(this._stats, PROTOCOL, {
|
return platformStats(this._stats, PROTOCOL, {
|
||||||
addons: this._addons.size,
|
addons: this._addons.size,
|
||||||
|
|||||||
@@ -106,6 +106,10 @@ class HyperBareArgvBridge extends EventEmitter {
|
|||||||
return this.resetArgv([])
|
return this.resetArgv([])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { flags: this._flags.size, rest: this._rest.length, targets: this.launchTargets().length }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return platformStats(this._stats, PROTOCOL, {
|
return platformStats(this._stats, PROTOCOL, {
|
||||||
flags: this._flags.size,
|
flags: this._flags.size,
|
||||||
|
|||||||
@@ -139,6 +139,10 @@ class HyperBareEntryRunner extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { runs: this._runs.size, active: this.listRuns('running').length }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return platformStats(this._stats, PROTOCOL, {
|
return platformStats(this._stats, PROTOCOL, {
|
||||||
active: this.listRuns('running').length,
|
active: this.listRuns('running').length,
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ class HyperBareImportMap extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { entries: Object.keys(this._imports).length }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return platformStats(this._stats, PROTOCOL, { entries: Object.keys(this._imports).length })
|
return platformStats(this._stats, PROTOCOL, { entries: Object.keys(this._imports).length })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ class HyperBareProcessSpawn extends EventEmitter {
|
|||||||
return plans.map((plan) => this.spawnPlan(plan))
|
return plans.map((plan) => this.spawnPlan(plan))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { children: this._children.size, active: this.activeCount() }
|
||||||
|
}
|
||||||
|
|
||||||
waitFor (id, timeoutMs = 0) {
|
waitFor (id, timeoutMs = 0) {
|
||||||
const c = this.getChild(id)
|
const c = this.getChild(id)
|
||||||
if (!c) return Promise.resolve(null)
|
if (!c) return Promise.resolve(null)
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ class HyperBareTargetMatrix extends EventEmitter {
|
|||||||
return this.resetToDefaults()
|
return this.resetToDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { host: this.host, targets: this.targetCount() }
|
||||||
|
}
|
||||||
|
|
||||||
targetCount () {
|
targetCount () {
|
||||||
return this._targets.length
|
return this._targets.length
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ class HyperPearChannelRegistry extends EventEmitter {
|
|||||||
return this.unregisterAll()
|
return this.unregisterAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { channels: this._channels.size, aliases: this._aliases.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return platformStats(this._stats, PROTOCOL, {
|
return platformStats(this._stats, PROTOCOL, {
|
||||||
channels: this._channels.size,
|
channels: this._channels.size,
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ class HyperPearDeepLink extends EventEmitter {
|
|||||||
return this.clearHistory()
|
return this.clearHistory()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { history: this._history.length }
|
||||||
|
}
|
||||||
|
|
||||||
peek (link) {
|
peek (link) {
|
||||||
const c = classifyTarget(link)
|
const c = classifyTarget(link)
|
||||||
let entrypoint = this.defaultEntry
|
let entrypoint = this.defaultEntry
|
||||||
|
|||||||
@@ -108,6 +108,10 @@ class HyperPearDetachedRegistry extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { instances: this._instances.size, alive: this.listAlive().length }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return platformStats(this._stats, PROTOCOL, {
|
return platformStats(this._stats, PROTOCOL, {
|
||||||
instances: this._instances.size,
|
instances: this._instances.size,
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ class HyperPearElectronBridge extends EventEmitter {
|
|||||||
return this.unregisterAll()
|
return this.unregisterAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { handlers: this.handlerCount(), renderer: this.renderer }
|
||||||
|
}
|
||||||
|
|
||||||
handlerCount () {
|
handlerCount () {
|
||||||
return this._channels.size
|
return this._channels.size
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ class HyperPearLinkResolver extends EventEmitter {
|
|||||||
return this.clearCache()
|
return this.clearCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { cached: this._cache.size }
|
||||||
|
}
|
||||||
|
|
||||||
normalize (parts) {
|
normalize (parts) {
|
||||||
const href = this.serialize(parts)
|
const href = this.serialize(parts)
|
||||||
return this.parse(href)
|
return this.parse(href)
|
||||||
|
|||||||
@@ -143,6 +143,10 @@ class HyperPearPreflightSync extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { jobs: this._jobs.size, pending: this.listPending().length }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return platformStats(this._stats, PROTOCOL, {
|
return platformStats(this._stats, PROTOCOL, {
|
||||||
jobs: this._jobs.size,
|
jobs: this._jobs.size,
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ class HyperPearRuntimeSession extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { total: this._sessions.size, active: this.activeSessions().length }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return {
|
return {
|
||||||
...this._stats,
|
...this._stats,
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ class HyperPearTrustGate extends EventEmitter {
|
|||||||
return { trusted: this.listTrusted(), askByDefault: this.askByDefault, strict: this.strict }
|
return { trusted: this.listTrusted(), askByDefault: this.askByDefault, strict: this.strict }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return this.exportSnapshot()
|
||||||
|
}
|
||||||
|
|
||||||
importSnapshot (snap) {
|
importSnapshot (snap) {
|
||||||
if (!snap || !Array.isArray(snap.trusted)) throw new Error('invalid snapshot')
|
if (!snap || !Array.isArray(snap.trusted)) throw new Error('invalid snapshot')
|
||||||
this._trusted = new Set(snap.trusted.map(String))
|
this._trusted = new Set(snap.trusted.map(String))
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ class HyperPearUpdateGossip extends EventEmitter {
|
|||||||
return { subs, history }
|
return { subs, history }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { subscribers: this._subs.size, hasLatest: !!this._latest }
|
||||||
|
}
|
||||||
|
|
||||||
_notify (update) {
|
_notify (update) {
|
||||||
for (const fn of this._subs) {
|
for (const fn of this._subs) {
|
||||||
try { fn(update) } catch (_) { /* ignore */ }
|
try { fn(update) } catch (_) { /* ignore */ }
|
||||||
|
|||||||
@@ -110,6 +110,10 @@ class HyperPearWorkerPipe extends EventEmitter {
|
|||||||
return this.closeAll()
|
return this.closeAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { pipes: this._pipes.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return platformStats(this._stats, PROTOCOL, { pipes: this._pipes.size })
|
return platformStats(this._stats, PROTOCOL, { pipes: this._pipes.size })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -442,6 +442,14 @@ class HyperP2PIntentRouter extends EventEmitter {
|
|||||||
return ids.length
|
return ids.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async clearAll () {
|
||||||
|
return this.unregisterAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return this.intentCounts()
|
||||||
|
}
|
||||||
|
|
||||||
getPeerIntents (peerHex = null) {
|
getPeerIntents (peerHex = null) {
|
||||||
if (peerHex) {
|
if (peerHex) {
|
||||||
const p = this.peerIntents.get(peerHex)
|
const p = this.peerIntents.get(peerHex)
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ class HyperP2PAutobaseForkChoice extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { views: this._views.size, chosen: this._chosen }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return autobaseStats(this._stats, PROTOCOL, {
|
return autobaseStats(this._stats, PROTOCOL, {
|
||||||
views: this._views.size,
|
views: this._views.size,
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ class HyperP2PAutobaseIndexerBus extends EventEmitter {
|
|||||||
this._deliver(d.evt)
|
this._deliver(d.evt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { pending: this._queue.length, subscribers: this._subs.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return autobaseStats(this._stats, PROTOCOL, {
|
return autobaseStats(this._stats, PROTOCOL, {
|
||||||
pending: this._queue.length,
|
pending: this._queue.length,
|
||||||
|
|||||||
@@ -103,6 +103,10 @@ class HyperP2PAutobaseLightWriter extends EventEmitter {
|
|||||||
return this.clearPending()
|
return this.clearPending()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { pending: this._ops.length, maxBatch: this.maxBatch }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return autobaseStats(this._stats, PROTOCOL, {
|
return autobaseStats(this._stats, PROTOCOL, {
|
||||||
pending: this._ops.length,
|
pending: this._ops.length,
|
||||||
|
|||||||
@@ -114,6 +114,10 @@ class HyperP2PBeeBatchWrite extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { pending: this._ops.length }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return beeStats(this._stats, PROTOCOL, { pending: this._ops.length })
|
return beeStats(this._stats, PROTOCOL, { pending: this._ops.length })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ class HyperP2PBeeDiffFollow extends EventEmitter {
|
|||||||
return this._cursor
|
return this._cursor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { cursor: this._cursor, buffered: this._buffer.length, behind: this.behindCount() }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return beeStats(this._stats, PROTOCOL, {
|
return beeStats(this._stats, PROTOCOL, {
|
||||||
cursor: this._cursor,
|
cursor: this._cursor,
|
||||||
|
|||||||
@@ -103,6 +103,10 @@ class HyperP2PBeeRangeWatch extends EventEmitter {
|
|||||||
return this._watches.size
|
return this._watches.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { watches: this._watches.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return beeStats(this._stats, PROTOCOL, { active: this._watches.size })
|
return beeStats(this._stats, PROTOCOL, { active: this._watches.size })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ class HyperP2PBeeSecondaryIndex extends EventEmitter {
|
|||||||
return this.indexPutMany(pairs)
|
return this.indexPutMany(pairs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { keys: this._index.size, primaries: this.totalPrimaries(), indexName: this.indexName }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return beeStats(this._stats, PROTOCOL, {
|
return beeStats(this._stats, PROTOCOL, {
|
||||||
secondaryKeys: this._index.size,
|
secondaryKeys: this._index.size,
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ class HyperP2PBeeTombstoneGc extends EventEmitter {
|
|||||||
return oldest
|
return oldest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { tombstones: this._tombstones.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return beeStats(this._stats, PROTOCOL, { pending: this._tombstones.size })
|
return beeStats(this._stats, PROTOCOL, { pending: this._tombstones.size })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,10 @@ class HyperP2PCoreAuditChain extends EventEmitter {
|
|||||||
return this.verifyChain()
|
return this.verifyChain()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { length: this._chain.length, head: this._headHash }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return coreStats(this._stats, PROTOCOL, {
|
return coreStats(this._stats, PROTOCOL, {
|
||||||
length: this._chain.length,
|
length: this._chain.length,
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ class HyperP2PCoreBitfieldScheduler extends EventEmitter {
|
|||||||
return { queue: q, served: s }
|
return { queue: q, served: s }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { pending: this._queue.length, served: this._served.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return coreStats(this._stats, PROTOCOL, {
|
return coreStats(this._stats, PROTOCOL, {
|
||||||
pending: this._queue.length,
|
pending: this._queue.length,
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ class HyperP2PCoreForkPicker extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { forks: this._forks.size, chosen: this._chosen }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return coreStats(this._stats, PROTOCOL, {
|
return coreStats(this._stats, PROTOCOL, {
|
||||||
forkCount: this._forks.size,
|
forkCount: this._forks.size,
|
||||||
|
|||||||
@@ -114,6 +114,10 @@ class HyperP2PCorePriorityFetch extends EventEmitter {
|
|||||||
return this._inflight.size
|
return this._inflight.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { pending: this._heap.length, inflight: this._inflight.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return coreStats(this._stats, PROTOCOL, {
|
return coreStats(this._stats, PROTOCOL, {
|
||||||
pending: this._heap.length,
|
pending: this._heap.length,
|
||||||
|
|||||||
@@ -106,6 +106,10 @@ class HyperP2PCoreReplicator extends EventEmitter {
|
|||||||
this.emit('remote-policy', data)
|
this.emit('remote-policy', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { policies: this.policyCount() }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return coreStats(this._stats, PROTOCOL, {
|
return coreStats(this._stats, PROTOCOL, {
|
||||||
policyCount: this._policies.size,
|
policyCount: this._policies.size,
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ class HyperP2PCoreSeedPolicy extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { policies: this._policies.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return coreStats(this._stats, PROTOCOL, {
|
return coreStats(this._stats, PROTOCOL, {
|
||||||
policyCount: this._policies.size,
|
policyCount: this._policies.size,
|
||||||
|
|||||||
@@ -97,6 +97,10 @@ class HyperP2PDriveGcSweep extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { stale: this._stale.size, swept: this._swept.length }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return driveStats(this._stats, PROTOCOL, {
|
return driveStats(this._stats, PROTOCOL, {
|
||||||
stale: this._stale.size,
|
stale: this._stale.size,
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ class HyperP2PDriveMirrorSync extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { pending: this._queue.length, tracked: this._progress.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return driveStats(this._stats, PROTOCOL, {
|
return driveStats(this._stats, PROTOCOL, {
|
||||||
pending: this._queue.length,
|
pending: this._queue.length,
|
||||||
|
|||||||
@@ -103,6 +103,14 @@ class HyperP2PDriveVersionSnapshot extends EventEmitter {
|
|||||||
if (!prev || d.snap.at >= prev.at) this._snapshots.set(d.snap.id, d.snap)
|
if (!prev || d.snap.at >= prev.at) this._snapshots.set(d.snap.id, d.snap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stateSnapshot () {
|
||||||
|
return { ids: this.snapshotIds(), count: this.snapshotCount() }
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return this.stateSnapshot()
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return driveStats(this._stats, PROTOCOL, { snapshots: this._snapshots.size })
|
return driveStats(this._stats, PROTOCOL, { snapshots: this._snapshots.size })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ class HyperP2PDriveWatchNotify extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { watches: this._watches.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return driveStats(this._stats, PROTOCOL, { active: this._watches.size })
|
return driveStats(this._stats, PROTOCOL, { active: this._watches.size })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -405,6 +405,10 @@ class HyperP2PTemporalIndex extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async snapshot () {
|
||||||
|
return { events: this.events.size, buckets: this.timeIndex.size }
|
||||||
|
}
|
||||||
|
|
||||||
getStats () {
|
getStats () {
|
||||||
return {
|
return {
|
||||||
events: this.events.size,
|
events: this.events.size,
|
||||||
|
|||||||
@@ -82,6 +82,19 @@ class HyperP2PEncryptedTopic extends EventEmitter {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearAll () {
|
||||||
|
return this.unregisterAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { topics: this.listTopics(), count: this._topics.size }
|
||||||
|
}
|
||||||
|
|
||||||
|
registerTopicBatch (entries) {
|
||||||
|
if (!Array.isArray(entries)) throw new Error('entries array required')
|
||||||
|
return entries.map((e) => this.registerTopic(e.topicId, e.keyHint))
|
||||||
|
}
|
||||||
|
|
||||||
rotateHint (topicId, newHint) {
|
rotateHint (topicId, newHint) {
|
||||||
assertNonEmpty(topicId, 'topicId')
|
assertNonEmpty(topicId, 'topicId')
|
||||||
assertNonEmpty(newHint, 'newHint')
|
assertNonEmpty(newHint, 'newHint')
|
||||||
|
|||||||
@@ -327,6 +327,10 @@ class HyperP2PReputationSystem extends EventEmitter {
|
|||||||
return peers.length
|
return peers.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { peers: this.scores.size }
|
||||||
|
}
|
||||||
|
|
||||||
getHistory (peerId, limit = 50) {
|
getHistory (peerId, limit = 50) {
|
||||||
this.metrics.queries++
|
this.metrics.queries++
|
||||||
const targetHex = typeof peerId === 'string' ? peerId : b4a.toString(peerId, 'hex')
|
const targetHex = typeof peerId === 'string' ? peerId : b4a.toString(peerId, 'hex')
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ class HyperP2PSessionRotation extends EventEmitter {
|
|||||||
return this.revokeAll()
|
return this.revokeAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot () {
|
||||||
|
return { sessions: this._sessions.size }
|
||||||
|
}
|
||||||
|
|
||||||
rotateSessionBatch (entries) {
|
rotateSessionBatch (entries) {
|
||||||
if (!Array.isArray(entries)) throw new Error('entries array required')
|
if (!Array.isArray(entries)) throw new Error('entries array required')
|
||||||
return entries.map((e) => this.rotateSession(e.sessionId, e.newToken))
|
return entries.map((e) => this.rotateSession(e.sessionId, e.newToken))
|
||||||
|
|||||||
Reference in New Issue
Block a user