Add size() cardinality helper across modules (eighth pass).
Standardize a size() method after isEmpty() on every module with clearAll(), delegating to domain counts or snapshot fields so callers can query occupancy without parsing snapshots. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -104,6 +104,10 @@ class HyperP2POverlayTopology extends EventEmitter {
|
||||
return this.snapshot().degree === 0
|
||||
}
|
||||
|
||||
size () {
|
||||
return this.snapshot().degree
|
||||
}
|
||||
|
||||
getStats () {
|
||||
return { ...this._stats, degree: this._neighbors.size, protocol: PROTOCOL }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user