Updates
This commit is contained in:
@@ -3,3 +3,7 @@
|
||||
## [0.0.0-scaffold] — Wave 8
|
||||
|
||||
- Registry scaffold: file tree, load smoke tests, docs stubs
|
||||
## [0.3.2] - 2026-05-21
|
||||
|
||||
### Changed
|
||||
- Exhaustive documentation pass (api, architecture, README) per DOC_STANDARDS.md.
|
||||
|
||||
@@ -1,28 +1,43 @@
|
||||
# hyper-p2p-qos-topic
|
||||
|
||||
**Status:** scaffold (`0.0.0-scaffold`) · **Protocol:** `qos-topic/v1` · **Wave:** 8
|
||||
Production p2p module: Hyperswarm discovery + Protomux when `topic` is set.
|
||||
|
||||
QoS tiers per topic.
|
||||
**Category:** General
|
||||
|
||||
## Holepunch references (inspiration only)
|
||||
**Composes with:**
|
||||
|
||||
- `protomux`
|
||||
**Protocol:** `qos-topic/v1`
|
||||
|
||||
> This module composes on Hyperswarm/Hypercore — it does **not** re-implement upstream packages.
|
||||
## When to use
|
||||
|
||||
## Composes with
|
||||
Multi-peer apps that need general over a shared Hyperswarm topic.
|
||||
|
||||
- `hyper-p2p-flow-shaper`
|
||||
## When not to use
|
||||
|
||||
## Planned API
|
||||
Single-process tools with no P2P topic (use local APIs only or skip `ready()`).
|
||||
|
||||
- `constructor(opts)` — topic, optional keyPair
|
||||
- `getStats()` — scaffold counters
|
||||
- `ready()` — no-op until implemented
|
||||
- Domain methods — throw `not implemented: scaffold` until Wave 8+ pass
|
||||
## Quick start
|
||||
|
||||
## Layout
|
||||
```js
|
||||
const { HyperP2PQosTopic } = require('hyper-p2p-qos-topic')
|
||||
const topic = process.argv[2] // 64-char hex or string
|
||||
const mod = new HyperP2PQosTopic({ topic, enableBackgroundTimers: false })
|
||||
await mod.ready() // joins swarm when topic set
|
||||
// ... application logic ...
|
||||
await mod.close()
|
||||
```
|
||||
|
||||
`modules/messaging-pubsub/hyper-p2p-qos-topic/`
|
||||
## Docs
|
||||
|
||||
See [`modules/_shared/MODULE_SYSTEM.md`](../../_shared/MODULE_SYSTEM.md).
|
||||
- [docs/api.md](docs/api.md) — constructor, methods, events, errors
|
||||
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition
|
||||
- [../../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
|
||||
- [../../_shared/DOC_STANDARDS.md](../../_shared/DOC_STANDARDS.md) — documentation standards
|
||||
|
||||
- Integration: [`../../real_tests/integration/`](../../real_tests/integration/) — `qos-topic-two-node.js`
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
npm install && npm test
|
||||
```
|
||||
|
||||
@@ -1,23 +1,80 @@
|
||||
# hyper-p2p-qos-topic API
|
||||
# API: hyper-p2p-qos-topic
|
||||
|
||||
**Status:** scaffold · **Protocol:** `qos-topic/v1`
|
||||
**Protocol:** `qos-topic/v1`
|
||||
|
||||
## Class `HyperP2PQosTopic`
|
||||
**Export:** `HyperP2PQosTopic`
|
||||
|
||||
Scaffold stub — methods throw `not implemented: scaffold` until promoted to production tier.
|
||||
## Overview
|
||||
|
||||
### `constructor(opts?)`
|
||||
Production p2p module: Hyperswarm discovery + Protomux when `topic` is set.
|
||||
|
||||
### `getStats()`
|
||||
## Constructor
|
||||
|
||||
Returns `{ created, errors, protocol, tier: 'scaffold' }`.
|
||||
```js
|
||||
const mod = new HyperP2PQosTopic(opts)
|
||||
```
|
||||
|
||||
### `ready()`
|
||||
| Option | Type | Default | Description |
|
||||
|--------|------|---------|-------------|
|
||||
| `topic` | varies | null | topic |
|
||||
| `keyPair` | KeyPair | random Ed25519 | keyPair |
|
||||
|
||||
Resolves immediately (no-op).
|
||||
## Methods
|
||||
|
||||
## Wire (planned)
|
||||
### `subscribe(channel, handler, qos = 0)`
|
||||
|
||||
| Message | Direction | Notes |
|
||||
|---------|-----------|-------|
|
||||
| TBD | gossip | Defined in implementation pass |
|
||||
- **Returns:** `value`
|
||||
- **Throws:**
|
||||
- `Error: handler must be a function`
|
||||
|
||||
### `publish(channel, payload, opts = {})`
|
||||
|
||||
- **Returns:** `value`
|
||||
- **Throws:** — (none documented in method body)
|
||||
|
||||
### `pending(qos)`
|
||||
|
||||
- **Returns:** `value`
|
||||
- **Throws:** — (none documented in method body)
|
||||
|
||||
### `getStats(—)`
|
||||
|
||||
- **Returns:** `object`
|
||||
- **Throws:** — (none documented in method body)
|
||||
|
||||
### `ready(—)`
|
||||
|
||||
- **Returns:** `Promise`
|
||||
- **Throws:** — (none documented in method body)
|
||||
|
||||
### `close(—)`
|
||||
|
||||
- **Returns:** `Promise<void>`
|
||||
- **Throws:** — (none documented in method body)
|
||||
|
||||
## Events
|
||||
|
||||
| Event | Payload |
|
||||
|-------|---------|
|
||||
| `message` | msg |
|
||||
|
||||
## getStats()
|
||||
|
||||
Returns `{ ...this._stats }` — typically `ops`, `errors`, and module-specific counters (`created`, `relays`, `open`, `peers`, etc.).
|
||||
Library-only modules may include `mode: 'local'`.
|
||||
|
||||
## Errors
|
||||
|
||||
Stable message substrings: see [`../../_shared/ERROR_CODES.md`](../../_shared/ERROR_CODES.md).
|
||||
|
||||
## P2P
|
||||
|
||||
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux `qos-topic/v1`.
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
npm install && npm test
|
||||
```
|
||||
|
||||
Integration: [`../../../real_tests/integration/qos-topic-two-node.js`](../../../real_tests/integration/qos-topic-two-node.js)
|
||||
@@ -1,15 +1,43 @@
|
||||
# hyper-p2p-qos-topic architecture
|
||||
# Architecture: hyper-p2p-qos-topic
|
||||
|
||||
**Tier:** scaffold · **Category:** `messaging-pubsub`
|
||||
**Category:** General
|
||||
|
||||
## Role
|
||||
```mermaid
|
||||
flowchart LR
|
||||
App[Application] --> Mod[HyperP2PQosTopic]
|
||||
Mod --> Mux[Protomux qos-topic/v1]
|
||||
Mux --> Swarm[Hyperswarm]
|
||||
```
|
||||
|
||||
QoS tiers per topic.
|
||||
## Sequence (P2P)
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant App
|
||||
participant Mod as Module
|
||||
participant SW as Hyperswarm
|
||||
participant Peer
|
||||
App->>Mod: ready(topic)
|
||||
Mod->>SW: join(topic)
|
||||
SW->>Peer: connection
|
||||
Mod->>Peer: gossip / Protomux
|
||||
Peer-->>Mod: onmessage
|
||||
Mod-->>App: emit(event)
|
||||
```
|
||||
|
||||
## Wire messages
|
||||
|
||||
| type | fields | direction | behavior |
|
||||
|------|--------|-----------|----------|
|
||||
| `qos-publish` | at, from, type | gossip | Handled in onmessage / gossipSend |
|
||||
|
||||
## State model
|
||||
|
||||
- In-memory `Map` / `Set` structures for hot path
|
||||
- Optional Hyperbee/Hypercore persistence when `storageDir` or `memoryOnly` is configured
|
||||
- `close()` tears down swarm, timers, and clears ephemeral state
|
||||
|
||||
## Composition
|
||||
|
||||
Uses `../../_shared/p2p-bare.js` for Hyperswarm + Protomux when implemented. Does **not** duplicate Holepunch core storage/transport.
|
||||
Composes with: see MODULE_CATEGORIES.md.
|
||||
|
||||
## Holepunch boundary
|
||||
|
||||
Inspiration: n/a
|
||||
|
||||
Reference in New Issue
Block a user