Giant pass: storage API docs, trust/consensus/routing code, category guides
Complete manual documentation cleanup for the storage stack and expand category-level guides across the library. Documentation (23 storage modules): - Rewrite Methods sections in all storage-hypercore, storage-hyperbee, storage-autobase, and storage-hyperdrive api.md files from index.js - Remove every "module-specific (see implementation)" placeholder in storage - Fix bitfield-scheduler, bee-batch-write, bee-range-watch, drive-gc-sweep APIs Category READMEs (modules/): - trust-security, consensus-coordination, routing-advanced — tables + hub links - MODULE_CATEGORIES.md typo fix (scaffold tier description) Code: - hyper-p2p-trust-graph: hasEdge(), nodeCount(), getStats with protocol - hyper-p2p-circuit-breaker: listCircuitIds(), reset() - hyper-p2p-distributed-lock: getStats merges metrics + active lock counts Parent workspace (not in this repo) also received doc hubs for all 29 categories in docs/README.md and MODULE_DOC_PASS.md giant-pass tracker. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -22,55 +22,46 @@ const mod = new HyperP2PCoreForkPicker(opts)
|
||||
|
||||
## Methods
|
||||
|
||||
### `attach(…)`
|
||||
### `attach(core) → this`
|
||||
|
||||
- **Returns:** module-specific (see implementation)
|
||||
Validates core via `assertCore`.
|
||||
|
||||
- **Throws:** — (none in method body)
|
||||
### `registerFork(head, length, meta = {}) → hint`
|
||||
|
||||
### `registerFork(…)`
|
||||
Registers `forkId = "${head}:${length}"` with `weight` (default `length`), optional `peer`. Gossip `fork-register`; emits `fork`.
|
||||
|
||||
- **Returns:** module-specific (see implementation)
|
||||
- **Returns:** `{ forkId, head, length, weight, peer, at }`
|
||||
- **Throws:** `head required`, `length must be non-negative`
|
||||
|
||||
- **Throws:**
|
||||
- `Error: head required`
|
||||
- `Error: length must be non-negative`
|
||||
### `pickBest() → hint | null`
|
||||
|
||||
### `pickBest(…)`
|
||||
Chooses highest `weight`, then longest `length` on tie. Sets `_chosen` and emits `picked`.
|
||||
|
||||
- **Returns:** module-specific (see implementation)
|
||||
### `listForks() → hint[]`
|
||||
|
||||
- **Throws:** — (none in method body)
|
||||
- **Returns:** all hints sorted by `weight` descending
|
||||
|
||||
### `listForks(…)`
|
||||
### `getChosen() → hint | null`
|
||||
|
||||
- **Returns:** module-specific (see implementation)
|
||||
- **Returns:** hint for `_chosen` fork id, or `null`
|
||||
|
||||
- **Throws:** — (none in method body)
|
||||
### `mergeRemoteFork(hint) → boolean`
|
||||
|
||||
### `mergeRemoteFork(…)`
|
||||
Last-write-wins on `at` timestamp. Used by inbound gossip.
|
||||
|
||||
- **Returns:** module-specific (see implementation)
|
||||
- **Returns:** `true` if registry updated
|
||||
|
||||
- **Throws:** — (none in method body)
|
||||
### `getStats() → object`
|
||||
|
||||
### `getStats(…)`
|
||||
`{ registered, picks, merged, forkCount, chosen, coreLength, protocol }`.
|
||||
|
||||
- **Returns:** module-specific (see implementation)
|
||||
### `async ready() → this`
|
||||
|
||||
- **Throws:** — (none in method body)
|
||||
Joins gossip when `topic` is set; inbound `fork-register` calls `mergeRemoteFork`.
|
||||
|
||||
### `ready(…)`
|
||||
### `async close() → void`
|
||||
|
||||
- **Returns:** module-specific (see implementation)
|
||||
|
||||
- **Throws:** — (none in method body)
|
||||
|
||||
### `close(…)`
|
||||
|
||||
- **Returns:** module-specific (see implementation)
|
||||
|
||||
- **Throws:** — (none in method body)
|
||||
Destroys swarm; emits `closed`.
|
||||
|
||||
## Events
|
||||
|
||||
|
||||
Reference in New Issue
Block a user