Updates
This commit is contained in:
@@ -12,44 +12,45 @@ const mod = new HyperP2PQuorumPool(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) |
|
||||
| `topic` | `string` \| `Buffer` | `null` | Hyperswarm topic |
|
||||
| `keyPair` | `KeyPair` | random | Ed25519 key pair |
|
||||
| `enableBackgroundTimers` | `boolean` | `false` | Background timers (off in tests) |
|
||||
| `quorum` | varies | module default | See constructor |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Returns | Notes |
|
||||
|--------|---------|-------|
|
||||
| `addMember(...)` | See source | — |
|
||||
| `close(...)` | See source | — |
|
||||
| `getProposal(...)` | See source | — |
|
||||
| `propose(...)` | See source | — |
|
||||
| `resolve(...)` | See source | — |
|
||||
| `setMembers(...)` | See source | — |
|
||||
| `vote(...)` | See source | — |
|
||||
| Method | Returns | Throws |
|
||||
|--------|---------|--------|
|
||||
| `getStats()` | `object` | — |
|
||||
| `close()` | `Promise<void>` | — |
|
||||
| `addMember(...)` | `Promise` or value | May throw `Error` on invalid input |
|
||||
| `getProposal(...)` | `Promise` or value | May throw `Error` on invalid input |
|
||||
| `propose(...)` | `Promise` or value | May throw `Error` on invalid input |
|
||||
| `resolve(...)` | `Promise` or value | May throw `Error` on invalid input |
|
||||
| `setMembers(...)` | `Promise` or value | May throw `Error` on invalid input |
|
||||
| `vote(...)` | `Promise` or value | May throw `Error` on invalid input |
|
||||
|
||||
## Events
|
||||
|
||||
| Event | Description |
|
||||
|-------|-------------|
|
||||
| `closed` | Module-specific |
|
||||
| `propose` | Module-specific |
|
||||
| `resolve` | Module-specific |
|
||||
| `vote` | Module-specific |
|
||||
| `closed` | Emitted on state change |
|
||||
| `propose` | Emitted on state change |
|
||||
| `resolve` | Emitted on state change |
|
||||
| `vote` | Emitted on state change |
|
||||
|
||||
## Metrics
|
||||
|
||||
Call `getStats()` when implemented for counters (Wave 6 network modules always expose stats).
|
||||
`getStats()` returns operation counters (`ops`, `errors`, etc.) or `mode: 'local'` for library-only modules.
|
||||
|
||||
## P2P
|
||||
|
||||
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux `quorum-pool/v1` via [`_shared/p2p-bare.js`](../_shared/p2p-bare.js).
|
||||
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux `quorum-pool/v1`.
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm test
|
||||
npm install && npm test
|
||||
```
|
||||
|
||||
Integration: [`../../real_tests/integration/quorum-pool-two-node.js`](../../real_tests/integration/quorum-pool-two-node.js)
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
# Architecture: hyper-p2p-quorum-pool
|
||||
|
||||
Quorum propose vote resolve for Bare/Pear P2P overlays.
|
||||
**Category:** Consensus & coordination
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
flowchart LR
|
||||
App[Application] --> Mod[HyperP2PQuorumPool]
|
||||
Mod --> Mux[Protomux quorum-pool/v1]
|
||||
Mux --> Swarm[Hyperswarm topic]
|
||||
Mux --> Swarm[Hyperswarm]
|
||||
```
|
||||
|
||||
## Wire messages (gossip)
|
||||
## Wire messages
|
||||
|
||||
JSON envelopes via `gossipSend` when connected. Message `type` fields are module-specific; see `index.js` `onmessage` handler.
|
||||
| type | payload | direction |
|
||||
|------|---------|-----------|
|
||||
| *(local only)* | — | — |
|
||||
|
||||
## Composition (Wave 6)
|
||||
## Composition
|
||||
|
||||
See [`../_shared/WAVE6_NETWORK_STACK.md`](../_shared/WAVE6_NETWORK_STACK.md) for pairing with network-stack modules.
|
||||
Composes with: `hyper-p2p-distributed-lock`, `hyper-p2p-causal-consensus`.
|
||||
|
||||
See [`../_shared/WAVE6_NETWORK_STACK.md`](../_shared/WAVE6_NETWORK_STACK.md) when using network-stack modules.
|
||||
|
||||
## State
|
||||
|
||||
In-memory maps/arrays; merged from remote gossip when `topic` is configured.
|
||||
In-memory structures; gossip merges remote updates when `topic` is configured.
|
||||
|
||||
Reference in New Issue
Block a user