Expand category docs and module APIs across the library.
Manual pass adds helpers (listChannels, taskCounts, openProposals), richer getStats with protocol fields, category README hubs, and tightened api.md for core, messaging, network, routing, supercomputer, and consensus modules. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
## Overview
|
||||
|
||||
CPU, RAM, and temperature load throttle signals.
|
||||
`HyperP2PThermalGuard` — P2P module. See [`README.md`](../README.md) and [`architecture.md`](architecture.md).
|
||||
|
||||
## Constructor
|
||||
|
||||
@@ -14,20 +14,50 @@ const mod = new HyperP2PThermalGuard(opts)
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
|--------|------|---------|-------------|
|
||||
| `topic` | Buffer \| string \| null | `null` | Hyperswarm topic |
|
||||
| `topic` | Buffer \| string \| null | `null` | Hyperswarm topic; omit for local-only |
|
||||
| `keyPair` | KeyPair | random | Discovery identity |
|
||||
|
||||
## Methods
|
||||
|
||||
See [`index.js`](../index.js) for the full method list. All modules implement `getStats()`, `async ready()`, and `async close()`.
|
||||
### `reportLoad(...)`
|
||||
|
||||
## getStats()
|
||||
Public API on `HyperP2PThermalGuard`. See [`index.js`](../index.js) for parameters and return types.
|
||||
|
||||
Returns `{ ...stats, protocol: 'thermal-guard/v1' }` plus module-specific counters.
|
||||
### `shouldThrottle(...)`
|
||||
|
||||
Public API on `HyperP2PThermalGuard`. See [`index.js`](../index.js) for parameters and return types.
|
||||
|
||||
### `getHeadroom(...)`
|
||||
|
||||
Public API on `HyperP2PThermalGuard`. See [`index.js`](../index.js) for parameters and return types.
|
||||
|
||||
### `listSamples(...)`
|
||||
|
||||
Public API on `HyperP2PThermalGuard`. See [`index.js`](../index.js) for parameters and return types.
|
||||
|
||||
### `throttledPeerIds(...)`
|
||||
|
||||
Public API on `HyperP2PThermalGuard`. See [`index.js`](../index.js) for parameters and return types.
|
||||
|
||||
### `healthyPeerIds(...)`
|
||||
|
||||
Public API on `HyperP2PThermalGuard`. See [`index.js`](../index.js) for parameters and return types.
|
||||
|
||||
### `getStats() → object`
|
||||
|
||||
Metrics plus `protocol: 'thermal-guard/v1'`.
|
||||
|
||||
### `async ready()`
|
||||
|
||||
Joins Hyperswarm when `topic` is set; opens Protomux channel.
|
||||
|
||||
### `async close()`
|
||||
|
||||
Tears down swarm and clears local state; emits `closed` where applicable.
|
||||
|
||||
## P2P
|
||||
|
||||
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux `thermal-guard/v1`.
|
||||
Gossip / sync over Protomux `thermal-guard/v1` when `topic` is configured.
|
||||
|
||||
## Testing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user