Updates
This commit is contained in:
@@ -4,5 +4,35 @@
|
||||
|
||||
**Export:** `HyperP2PMyceliumPool`
|
||||
|
||||
Integration: `../../real_tests/integration/` smoke tests.
|
||||
## Constructor
|
||||
|
||||
```js
|
||||
const mod = new HyperP2PMyceliumPool(opts)
|
||||
```
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
|--------|------|---------|-------------|
|
||||
| `topic` | `string` \| `Buffer` | `null` | Hyperswarm topic; enables P2P when set |
|
||||
| `keyPair` | `KeyPair` | random | Ed25519 key pair (`hypercore-crypto`) |
|
||||
| `enableBackgroundTimers` | `boolean` | `false` | Periodic timers (keep false in unit tests) |
|
||||
|
||||
## Methods
|
||||
|
||||
See [`index.js`](../index.js) for the full method list. Core operations implement **symbiotic bandwidth credit pool**.
|
||||
|
||||
## Events
|
||||
|
||||
The instance extends `EventEmitter`. Common events: `closed`, plus module-specific events documented in source.
|
||||
|
||||
## P2P
|
||||
|
||||
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux channel `mycelium-pool/v1` via [`_shared/p2p-bare.js`](../_shared/p2p-bare.js).
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
Integration: [`../../real_tests/integration/mycelium-pool-two-node.js`](../../real_tests/integration/mycelium-pool-two-node.js)
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
# Architecture: hyper-p2p-mycelium-pool
|
||||
|
||||
Hyperswarm + Protomux (`mycelium-pool/v1`) when `topic` is set via `p2p-bare.js`.
|
||||
```mermaid
|
||||
flowchart LR
|
||||
App[Application] --> Mod[HyperP2PMyceliumPool]
|
||||
Mod --> P2P[Protomux mycelium-pool/v1]
|
||||
P2P --> Swarm[Hyperswarm]
|
||||
```
|
||||
|
||||
Local state lives in memory maps/arrays; gossip merges remote updates when `topic` is configured.
|
||||
|
||||
Reference in New Issue
Block a user