Updates
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# Routing (advanced)
|
||||
|
||||
**Path:** `modules/routing-advanced/` · **Modules:** 5 (0 production, 5 scaffold)
|
||||
|
||||
See [MODULE_CATEGORIES.md](../MODULE_CATEGORIES.md#routing-advanced).
|
||||
|
||||
- [hyper-p2p-circuit-breaker](./hyper-p2p-circuit-breaker/) — scaffold
|
||||
- [hyper-p2p-geo-hint-router](./hyper-p2p-geo-hint-router/) — scaffold
|
||||
- [hyper-p2p-load-spread](./hyper-p2p-load-spread/) — scaffold
|
||||
- [hyper-p2p-retry-policy](./hyper-p2p-retry-policy/) — scaffold
|
||||
- [hyper-p2p-sticky-session](./hyper-p2p-sticky-session/) — scaffold
|
||||
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## [0.0.0-scaffold] — Wave 8
|
||||
|
||||
- Registry scaffold: file tree, load smoke tests, docs stubs
|
||||
@@ -0,0 +1,28 @@
|
||||
# hyper-p2p-circuit-breaker
|
||||
|
||||
**Status:** scaffold (`0.0.0-scaffold`) · **Protocol:** `circuit-breaker/v1` · **Wave:** 8
|
||||
|
||||
Circuit breaker for peer calls.
|
||||
|
||||
## Holepunch references (inspiration only)
|
||||
|
||||
- (none yet)
|
||||
|
||||
> This module composes on Hyperswarm/Hypercore — it does **not** re-implement upstream packages.
|
||||
|
||||
## Composes with
|
||||
|
||||
- (none yet)
|
||||
|
||||
## Planned API
|
||||
|
||||
- `constructor(opts)` — topic, optional keyPair
|
||||
- `getStats()` — scaffold counters
|
||||
- `ready()` — no-op until implemented
|
||||
- Domain methods — throw `not implemented: scaffold` until Wave 8+ pass
|
||||
|
||||
## Layout
|
||||
|
||||
`modules/routing-advanced/hyper-p2p-circuit-breaker/`
|
||||
|
||||
See [`modules/_shared/MODULE_SYSTEM.md`](../../_shared/MODULE_SYSTEM.md).
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "hyper-p2p-circuit-breaker",
|
||||
"category": "routing-advanced",
|
||||
"tier": "scaffold",
|
||||
"protocol": "circuit-breaker/v1",
|
||||
"class": "HyperP2PCircuitBreaker",
|
||||
"wave": 8,
|
||||
"holepunch_refs": [],
|
||||
"composes_with": [],
|
||||
"status": "scaffold"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# hyper-p2p-circuit-breaker API
|
||||
|
||||
**Status:** scaffold · **Protocol:** `circuit-breaker/v1`
|
||||
|
||||
## Class `HyperP2PCircuitBreaker`
|
||||
|
||||
Scaffold stub — methods throw `not implemented: scaffold` until promoted to production tier.
|
||||
|
||||
### `constructor(opts?)`
|
||||
|
||||
### `getStats()`
|
||||
|
||||
Returns `{ created, errors, protocol, tier: 'scaffold' }`.
|
||||
|
||||
### `ready()`
|
||||
|
||||
Resolves immediately (no-op).
|
||||
|
||||
## Wire (planned)
|
||||
|
||||
| Message | Direction | Notes |
|
||||
|---------|-----------|-------|
|
||||
| TBD | gossip | Defined in implementation pass |
|
||||
@@ -0,0 +1,15 @@
|
||||
# hyper-p2p-circuit-breaker architecture
|
||||
|
||||
**Tier:** scaffold · **Category:** `routing-advanced`
|
||||
|
||||
## Role
|
||||
|
||||
Circuit breaker for peer calls.
|
||||
|
||||
## Composition
|
||||
|
||||
Uses `../../_shared/p2p-bare.js` for Hyperswarm + Protomux when implemented. Does **not** duplicate Holepunch core storage/transport.
|
||||
|
||||
## Holepunch boundary
|
||||
|
||||
Inspiration: n/a
|
||||
@@ -0,0 +1,8 @@
|
||||
require('bare-process/global')
|
||||
const { HyperP2PCircuitBreaker } = require('../index.js')
|
||||
|
||||
async function main () {
|
||||
const m = new HyperP2PCircuitBreaker()
|
||||
console.log('[scaffold]', m.getStats())
|
||||
}
|
||||
main().catch(console.error)
|
||||
@@ -0,0 +1,25 @@
|
||||
require('bare-process/global')
|
||||
const EventEmitter = require('bare-events')
|
||||
|
||||
const PROTOCOL = 'circuit-breaker/v1'
|
||||
|
||||
class HyperP2PCircuitBreaker extends EventEmitter {
|
||||
constructor (opts = {}) {
|
||||
super()
|
||||
this.topic = opts.topic || null
|
||||
this._stats = { created: 0, errors: 0 }
|
||||
}
|
||||
|
||||
getStats () {
|
||||
return { ...this._stats, protocol: PROTOCOL, tier: 'scaffold' }
|
||||
}
|
||||
|
||||
async ready () { return true }
|
||||
|
||||
_notImplemented (method) {
|
||||
this._stats.errors++
|
||||
throw new Error(`not implemented: scaffold (${method})`)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { HyperP2PCircuitBreaker, PROTOCOL }
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "hyper-p2p-circuit-breaker",
|
||||
"version": "0.0.0-scaffold",
|
||||
"description": "Circuit breaker for peer calls.",
|
||||
"main": "index.js",
|
||||
"type": "commonjs",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": { "test": "brittle-bare test/test.js" },
|
||||
"dependencies": {
|
||||
"bare-events": "^2.8.0",
|
||||
"bare-process": "^4.4.0",
|
||||
"bare-timers": "^2.0.0",
|
||||
"b4a": "^1.6.7",
|
||||
"hypercore-crypto": "^3.0.0",
|
||||
"protomux": "^3.0.0",
|
||||
"compact-encoding": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": { "hyperswarm": "^4.0.0", "bare": ">=1.0.0" },
|
||||
"devDependencies": { "brittle": "^3.0.0" },
|
||||
"imports": {
|
||||
"process": { "bare": "bare-process", "default": "process" },
|
||||
"events": { "bare": "bare-events", "default": "events" },
|
||||
"timers": { "bare": "bare-timers", "default": "timers" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
const test = require('brittle')
|
||||
const { HyperP2PCircuitBreaker, PROTOCOL } = require('../index.js')
|
||||
|
||||
test('exports load', (t) => {
|
||||
t.ok(HyperP2PCircuitBreaker)
|
||||
t.is(PROTOCOL, 'circuit-breaker/v1')
|
||||
})
|
||||
|
||||
test('getStats shape', async (t) => {
|
||||
const m = new HyperP2PCircuitBreaker()
|
||||
const s = m.getStats()
|
||||
t.is(s.tier, 'scaffold')
|
||||
t.is(s.protocol, 'circuit-breaker/v1')
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## [0.0.0-scaffold] — Wave 8
|
||||
|
||||
- Registry scaffold: file tree, load smoke tests, docs stubs
|
||||
@@ -0,0 +1,28 @@
|
||||
# hyper-p2p-geo-hint-router
|
||||
|
||||
**Status:** scaffold (`0.0.0-scaffold`) · **Protocol:** `geo-hint-router/v1` · **Wave:** 8
|
||||
|
||||
Geo-hint aware routing.
|
||||
|
||||
## Holepunch references (inspiration only)
|
||||
|
||||
- (none yet)
|
||||
|
||||
> This module composes on Hyperswarm/Hypercore — it does **not** re-implement upstream packages.
|
||||
|
||||
## Composes with
|
||||
|
||||
- (none yet)
|
||||
|
||||
## Planned API
|
||||
|
||||
- `constructor(opts)` — topic, optional keyPair
|
||||
- `getStats()` — scaffold counters
|
||||
- `ready()` — no-op until implemented
|
||||
- Domain methods — throw `not implemented: scaffold` until Wave 8+ pass
|
||||
|
||||
## Layout
|
||||
|
||||
`modules/routing-advanced/hyper-p2p-geo-hint-router/`
|
||||
|
||||
See [`modules/_shared/MODULE_SYSTEM.md`](../../_shared/MODULE_SYSTEM.md).
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "hyper-p2p-geo-hint-router",
|
||||
"category": "routing-advanced",
|
||||
"tier": "scaffold",
|
||||
"protocol": "geo-hint-router/v1",
|
||||
"class": "HyperP2PGeoHintRouter",
|
||||
"wave": 8,
|
||||
"holepunch_refs": [],
|
||||
"composes_with": [],
|
||||
"status": "scaffold"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# hyper-p2p-geo-hint-router API
|
||||
|
||||
**Status:** scaffold · **Protocol:** `geo-hint-router/v1`
|
||||
|
||||
## Class `HyperP2PGeoHintRouter`
|
||||
|
||||
Scaffold stub — methods throw `not implemented: scaffold` until promoted to production tier.
|
||||
|
||||
### `constructor(opts?)`
|
||||
|
||||
### `getStats()`
|
||||
|
||||
Returns `{ created, errors, protocol, tier: 'scaffold' }`.
|
||||
|
||||
### `ready()`
|
||||
|
||||
Resolves immediately (no-op).
|
||||
|
||||
## Wire (planned)
|
||||
|
||||
| Message | Direction | Notes |
|
||||
|---------|-----------|-------|
|
||||
| TBD | gossip | Defined in implementation pass |
|
||||
@@ -0,0 +1,15 @@
|
||||
# hyper-p2p-geo-hint-router architecture
|
||||
|
||||
**Tier:** scaffold · **Category:** `routing-advanced`
|
||||
|
||||
## Role
|
||||
|
||||
Geo-hint aware routing.
|
||||
|
||||
## Composition
|
||||
|
||||
Uses `../../_shared/p2p-bare.js` for Hyperswarm + Protomux when implemented. Does **not** duplicate Holepunch core storage/transport.
|
||||
|
||||
## Holepunch boundary
|
||||
|
||||
Inspiration: n/a
|
||||
@@ -0,0 +1,8 @@
|
||||
require('bare-process/global')
|
||||
const { HyperP2PGeoHintRouter } = require('../index.js')
|
||||
|
||||
async function main () {
|
||||
const m = new HyperP2PGeoHintRouter()
|
||||
console.log('[scaffold]', m.getStats())
|
||||
}
|
||||
main().catch(console.error)
|
||||
@@ -0,0 +1,25 @@
|
||||
require('bare-process/global')
|
||||
const EventEmitter = require('bare-events')
|
||||
|
||||
const PROTOCOL = 'geo-hint-router/v1'
|
||||
|
||||
class HyperP2PGeoHintRouter extends EventEmitter {
|
||||
constructor (opts = {}) {
|
||||
super()
|
||||
this.topic = opts.topic || null
|
||||
this._stats = { created: 0, errors: 0 }
|
||||
}
|
||||
|
||||
getStats () {
|
||||
return { ...this._stats, protocol: PROTOCOL, tier: 'scaffold' }
|
||||
}
|
||||
|
||||
async ready () { return true }
|
||||
|
||||
_notImplemented (method) {
|
||||
this._stats.errors++
|
||||
throw new Error(`not implemented: scaffold (${method})`)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { HyperP2PGeoHintRouter, PROTOCOL }
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "hyper-p2p-geo-hint-router",
|
||||
"version": "0.0.0-scaffold",
|
||||
"description": "Geo-hint aware routing.",
|
||||
"main": "index.js",
|
||||
"type": "commonjs",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": { "test": "brittle-bare test/test.js" },
|
||||
"dependencies": {
|
||||
"bare-events": "^2.8.0",
|
||||
"bare-process": "^4.4.0",
|
||||
"bare-timers": "^2.0.0",
|
||||
"b4a": "^1.6.7",
|
||||
"hypercore-crypto": "^3.0.0",
|
||||
"protomux": "^3.0.0",
|
||||
"compact-encoding": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": { "hyperswarm": "^4.0.0", "bare": ">=1.0.0" },
|
||||
"devDependencies": { "brittle": "^3.0.0" },
|
||||
"imports": {
|
||||
"process": { "bare": "bare-process", "default": "process" },
|
||||
"events": { "bare": "bare-events", "default": "events" },
|
||||
"timers": { "bare": "bare-timers", "default": "timers" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
const test = require('brittle')
|
||||
const { HyperP2PGeoHintRouter, PROTOCOL } = require('../index.js')
|
||||
|
||||
test('exports load', (t) => {
|
||||
t.ok(HyperP2PGeoHintRouter)
|
||||
t.is(PROTOCOL, 'geo-hint-router/v1')
|
||||
})
|
||||
|
||||
test('getStats shape', async (t) => {
|
||||
const m = new HyperP2PGeoHintRouter()
|
||||
const s = m.getStats()
|
||||
t.is(s.tier, 'scaffold')
|
||||
t.is(s.protocol, 'geo-hint-router/v1')
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## [0.0.0-scaffold] — Wave 8
|
||||
|
||||
- Registry scaffold: file tree, load smoke tests, docs stubs
|
||||
@@ -0,0 +1,28 @@
|
||||
# hyper-p2p-load-spread
|
||||
|
||||
**Status:** scaffold (`0.0.0-scaffold`) · **Protocol:** `load-spread/v1` · **Wave:** 8
|
||||
|
||||
Load spread across peers.
|
||||
|
||||
## Holepunch references (inspiration only)
|
||||
|
||||
- (none yet)
|
||||
|
||||
> This module composes on Hyperswarm/Hypercore — it does **not** re-implement upstream packages.
|
||||
|
||||
## Composes with
|
||||
|
||||
- (none yet)
|
||||
|
||||
## Planned API
|
||||
|
||||
- `constructor(opts)` — topic, optional keyPair
|
||||
- `getStats()` — scaffold counters
|
||||
- `ready()` — no-op until implemented
|
||||
- Domain methods — throw `not implemented: scaffold` until Wave 8+ pass
|
||||
|
||||
## Layout
|
||||
|
||||
`modules/routing-advanced/hyper-p2p-load-spread/`
|
||||
|
||||
See [`modules/_shared/MODULE_SYSTEM.md`](../../_shared/MODULE_SYSTEM.md).
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "hyper-p2p-load-spread",
|
||||
"category": "routing-advanced",
|
||||
"tier": "scaffold",
|
||||
"protocol": "load-spread/v1",
|
||||
"class": "HyperP2PLoadSpread",
|
||||
"wave": 8,
|
||||
"holepunch_refs": [],
|
||||
"composes_with": [],
|
||||
"status": "scaffold"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# hyper-p2p-load-spread API
|
||||
|
||||
**Status:** scaffold · **Protocol:** `load-spread/v1`
|
||||
|
||||
## Class `HyperP2PLoadSpread`
|
||||
|
||||
Scaffold stub — methods throw `not implemented: scaffold` until promoted to production tier.
|
||||
|
||||
### `constructor(opts?)`
|
||||
|
||||
### `getStats()`
|
||||
|
||||
Returns `{ created, errors, protocol, tier: 'scaffold' }`.
|
||||
|
||||
### `ready()`
|
||||
|
||||
Resolves immediately (no-op).
|
||||
|
||||
## Wire (planned)
|
||||
|
||||
| Message | Direction | Notes |
|
||||
|---------|-----------|-------|
|
||||
| TBD | gossip | Defined in implementation pass |
|
||||
@@ -0,0 +1,15 @@
|
||||
# hyper-p2p-load-spread architecture
|
||||
|
||||
**Tier:** scaffold · **Category:** `routing-advanced`
|
||||
|
||||
## Role
|
||||
|
||||
Load spread across peers.
|
||||
|
||||
## Composition
|
||||
|
||||
Uses `../../_shared/p2p-bare.js` for Hyperswarm + Protomux when implemented. Does **not** duplicate Holepunch core storage/transport.
|
||||
|
||||
## Holepunch boundary
|
||||
|
||||
Inspiration: n/a
|
||||
@@ -0,0 +1,8 @@
|
||||
require('bare-process/global')
|
||||
const { HyperP2PLoadSpread } = require('../index.js')
|
||||
|
||||
async function main () {
|
||||
const m = new HyperP2PLoadSpread()
|
||||
console.log('[scaffold]', m.getStats())
|
||||
}
|
||||
main().catch(console.error)
|
||||
@@ -0,0 +1,25 @@
|
||||
require('bare-process/global')
|
||||
const EventEmitter = require('bare-events')
|
||||
|
||||
const PROTOCOL = 'load-spread/v1'
|
||||
|
||||
class HyperP2PLoadSpread extends EventEmitter {
|
||||
constructor (opts = {}) {
|
||||
super()
|
||||
this.topic = opts.topic || null
|
||||
this._stats = { created: 0, errors: 0 }
|
||||
}
|
||||
|
||||
getStats () {
|
||||
return { ...this._stats, protocol: PROTOCOL, tier: 'scaffold' }
|
||||
}
|
||||
|
||||
async ready () { return true }
|
||||
|
||||
_notImplemented (method) {
|
||||
this._stats.errors++
|
||||
throw new Error(`not implemented: scaffold (${method})`)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { HyperP2PLoadSpread, PROTOCOL }
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "hyper-p2p-load-spread",
|
||||
"version": "0.0.0-scaffold",
|
||||
"description": "Load spread across peers.",
|
||||
"main": "index.js",
|
||||
"type": "commonjs",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": { "test": "brittle-bare test/test.js" },
|
||||
"dependencies": {
|
||||
"bare-events": "^2.8.0",
|
||||
"bare-process": "^4.4.0",
|
||||
"bare-timers": "^2.0.0",
|
||||
"b4a": "^1.6.7",
|
||||
"hypercore-crypto": "^3.0.0",
|
||||
"protomux": "^3.0.0",
|
||||
"compact-encoding": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": { "hyperswarm": "^4.0.0", "bare": ">=1.0.0" },
|
||||
"devDependencies": { "brittle": "^3.0.0" },
|
||||
"imports": {
|
||||
"process": { "bare": "bare-process", "default": "process" },
|
||||
"events": { "bare": "bare-events", "default": "events" },
|
||||
"timers": { "bare": "bare-timers", "default": "timers" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
const test = require('brittle')
|
||||
const { HyperP2PLoadSpread, PROTOCOL } = require('../index.js')
|
||||
|
||||
test('exports load', (t) => {
|
||||
t.ok(HyperP2PLoadSpread)
|
||||
t.is(PROTOCOL, 'load-spread/v1')
|
||||
})
|
||||
|
||||
test('getStats shape', async (t) => {
|
||||
const m = new HyperP2PLoadSpread()
|
||||
const s = m.getStats()
|
||||
t.is(s.tier, 'scaffold')
|
||||
t.is(s.protocol, 'load-spread/v1')
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## [0.0.0-scaffold] — Wave 8
|
||||
|
||||
- Registry scaffold: file tree, load smoke tests, docs stubs
|
||||
@@ -0,0 +1,28 @@
|
||||
# hyper-p2p-retry-policy
|
||||
|
||||
**Status:** scaffold (`0.0.0-scaffold`) · **Protocol:** `retry-policy/v1` · **Wave:** 8
|
||||
|
||||
Retry policy with backoff.
|
||||
|
||||
## Holepunch references (inspiration only)
|
||||
|
||||
- (none yet)
|
||||
|
||||
> This module composes on Hyperswarm/Hypercore — it does **not** re-implement upstream packages.
|
||||
|
||||
## Composes with
|
||||
|
||||
- (none yet)
|
||||
|
||||
## Planned API
|
||||
|
||||
- `constructor(opts)` — topic, optional keyPair
|
||||
- `getStats()` — scaffold counters
|
||||
- `ready()` — no-op until implemented
|
||||
- Domain methods — throw `not implemented: scaffold` until Wave 8+ pass
|
||||
|
||||
## Layout
|
||||
|
||||
`modules/routing-advanced/hyper-p2p-retry-policy/`
|
||||
|
||||
See [`modules/_shared/MODULE_SYSTEM.md`](../../_shared/MODULE_SYSTEM.md).
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "hyper-p2p-retry-policy",
|
||||
"category": "routing-advanced",
|
||||
"tier": "scaffold",
|
||||
"protocol": "retry-policy/v1",
|
||||
"class": "HyperP2PRetryPolicy",
|
||||
"wave": 8,
|
||||
"holepunch_refs": [],
|
||||
"composes_with": [],
|
||||
"status": "scaffold"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# hyper-p2p-retry-policy API
|
||||
|
||||
**Status:** scaffold · **Protocol:** `retry-policy/v1`
|
||||
|
||||
## Class `HyperP2PRetryPolicy`
|
||||
|
||||
Scaffold stub — methods throw `not implemented: scaffold` until promoted to production tier.
|
||||
|
||||
### `constructor(opts?)`
|
||||
|
||||
### `getStats()`
|
||||
|
||||
Returns `{ created, errors, protocol, tier: 'scaffold' }`.
|
||||
|
||||
### `ready()`
|
||||
|
||||
Resolves immediately (no-op).
|
||||
|
||||
## Wire (planned)
|
||||
|
||||
| Message | Direction | Notes |
|
||||
|---------|-----------|-------|
|
||||
| TBD | gossip | Defined in implementation pass |
|
||||
@@ -0,0 +1,15 @@
|
||||
# hyper-p2p-retry-policy architecture
|
||||
|
||||
**Tier:** scaffold · **Category:** `routing-advanced`
|
||||
|
||||
## Role
|
||||
|
||||
Retry policy with backoff.
|
||||
|
||||
## Composition
|
||||
|
||||
Uses `../../_shared/p2p-bare.js` for Hyperswarm + Protomux when implemented. Does **not** duplicate Holepunch core storage/transport.
|
||||
|
||||
## Holepunch boundary
|
||||
|
||||
Inspiration: n/a
|
||||
@@ -0,0 +1,8 @@
|
||||
require('bare-process/global')
|
||||
const { HyperP2PRetryPolicy } = require('../index.js')
|
||||
|
||||
async function main () {
|
||||
const m = new HyperP2PRetryPolicy()
|
||||
console.log('[scaffold]', m.getStats())
|
||||
}
|
||||
main().catch(console.error)
|
||||
@@ -0,0 +1,25 @@
|
||||
require('bare-process/global')
|
||||
const EventEmitter = require('bare-events')
|
||||
|
||||
const PROTOCOL = 'retry-policy/v1'
|
||||
|
||||
class HyperP2PRetryPolicy extends EventEmitter {
|
||||
constructor (opts = {}) {
|
||||
super()
|
||||
this.topic = opts.topic || null
|
||||
this._stats = { created: 0, errors: 0 }
|
||||
}
|
||||
|
||||
getStats () {
|
||||
return { ...this._stats, protocol: PROTOCOL, tier: 'scaffold' }
|
||||
}
|
||||
|
||||
async ready () { return true }
|
||||
|
||||
_notImplemented (method) {
|
||||
this._stats.errors++
|
||||
throw new Error(`not implemented: scaffold (${method})`)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { HyperP2PRetryPolicy, PROTOCOL }
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "hyper-p2p-retry-policy",
|
||||
"version": "0.0.0-scaffold",
|
||||
"description": "Retry policy with backoff.",
|
||||
"main": "index.js",
|
||||
"type": "commonjs",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": { "test": "brittle-bare test/test.js" },
|
||||
"dependencies": {
|
||||
"bare-events": "^2.8.0",
|
||||
"bare-process": "^4.4.0",
|
||||
"bare-timers": "^2.0.0",
|
||||
"b4a": "^1.6.7",
|
||||
"hypercore-crypto": "^3.0.0",
|
||||
"protomux": "^3.0.0",
|
||||
"compact-encoding": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": { "hyperswarm": "^4.0.0", "bare": ">=1.0.0" },
|
||||
"devDependencies": { "brittle": "^3.0.0" },
|
||||
"imports": {
|
||||
"process": { "bare": "bare-process", "default": "process" },
|
||||
"events": { "bare": "bare-events", "default": "events" },
|
||||
"timers": { "bare": "bare-timers", "default": "timers" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
const test = require('brittle')
|
||||
const { HyperP2PRetryPolicy, PROTOCOL } = require('../index.js')
|
||||
|
||||
test('exports load', (t) => {
|
||||
t.ok(HyperP2PRetryPolicy)
|
||||
t.is(PROTOCOL, 'retry-policy/v1')
|
||||
})
|
||||
|
||||
test('getStats shape', async (t) => {
|
||||
const m = new HyperP2PRetryPolicy()
|
||||
const s = m.getStats()
|
||||
t.is(s.tier, 'scaffold')
|
||||
t.is(s.protocol, 'retry-policy/v1')
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## [0.0.0-scaffold] — Wave 8
|
||||
|
||||
- Registry scaffold: file tree, load smoke tests, docs stubs
|
||||
@@ -0,0 +1,28 @@
|
||||
# hyper-p2p-sticky-session
|
||||
|
||||
**Status:** scaffold (`0.0.0-scaffold`) · **Protocol:** `sticky-session/v1` · **Wave:** 8
|
||||
|
||||
Sticky session routing.
|
||||
|
||||
## Holepunch references (inspiration only)
|
||||
|
||||
- (none yet)
|
||||
|
||||
> This module composes on Hyperswarm/Hypercore — it does **not** re-implement upstream packages.
|
||||
|
||||
## Composes with
|
||||
|
||||
- (none yet)
|
||||
|
||||
## Planned API
|
||||
|
||||
- `constructor(opts)` — topic, optional keyPair
|
||||
- `getStats()` — scaffold counters
|
||||
- `ready()` — no-op until implemented
|
||||
- Domain methods — throw `not implemented: scaffold` until Wave 8+ pass
|
||||
|
||||
## Layout
|
||||
|
||||
`modules/routing-advanced/hyper-p2p-sticky-session/`
|
||||
|
||||
See [`modules/_shared/MODULE_SYSTEM.md`](../../_shared/MODULE_SYSTEM.md).
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "hyper-p2p-sticky-session",
|
||||
"category": "routing-advanced",
|
||||
"tier": "scaffold",
|
||||
"protocol": "sticky-session/v1",
|
||||
"class": "HyperP2PStickySession",
|
||||
"wave": 8,
|
||||
"holepunch_refs": [],
|
||||
"composes_with": [],
|
||||
"status": "scaffold"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# hyper-p2p-sticky-session API
|
||||
|
||||
**Status:** scaffold · **Protocol:** `sticky-session/v1`
|
||||
|
||||
## Class `HyperP2PStickySession`
|
||||
|
||||
Scaffold stub — methods throw `not implemented: scaffold` until promoted to production tier.
|
||||
|
||||
### `constructor(opts?)`
|
||||
|
||||
### `getStats()`
|
||||
|
||||
Returns `{ created, errors, protocol, tier: 'scaffold' }`.
|
||||
|
||||
### `ready()`
|
||||
|
||||
Resolves immediately (no-op).
|
||||
|
||||
## Wire (planned)
|
||||
|
||||
| Message | Direction | Notes |
|
||||
|---------|-----------|-------|
|
||||
| TBD | gossip | Defined in implementation pass |
|
||||
@@ -0,0 +1,15 @@
|
||||
# hyper-p2p-sticky-session architecture
|
||||
|
||||
**Tier:** scaffold · **Category:** `routing-advanced`
|
||||
|
||||
## Role
|
||||
|
||||
Sticky session routing.
|
||||
|
||||
## Composition
|
||||
|
||||
Uses `../../_shared/p2p-bare.js` for Hyperswarm + Protomux when implemented. Does **not** duplicate Holepunch core storage/transport.
|
||||
|
||||
## Holepunch boundary
|
||||
|
||||
Inspiration: n/a
|
||||
@@ -0,0 +1,8 @@
|
||||
require('bare-process/global')
|
||||
const { HyperP2PStickySession } = require('../index.js')
|
||||
|
||||
async function main () {
|
||||
const m = new HyperP2PStickySession()
|
||||
console.log('[scaffold]', m.getStats())
|
||||
}
|
||||
main().catch(console.error)
|
||||
@@ -0,0 +1,25 @@
|
||||
require('bare-process/global')
|
||||
const EventEmitter = require('bare-events')
|
||||
|
||||
const PROTOCOL = 'sticky-session/v1'
|
||||
|
||||
class HyperP2PStickySession extends EventEmitter {
|
||||
constructor (opts = {}) {
|
||||
super()
|
||||
this.topic = opts.topic || null
|
||||
this._stats = { created: 0, errors: 0 }
|
||||
}
|
||||
|
||||
getStats () {
|
||||
return { ...this._stats, protocol: PROTOCOL, tier: 'scaffold' }
|
||||
}
|
||||
|
||||
async ready () { return true }
|
||||
|
||||
_notImplemented (method) {
|
||||
this._stats.errors++
|
||||
throw new Error(`not implemented: scaffold (${method})`)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { HyperP2PStickySession, PROTOCOL }
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "hyper-p2p-sticky-session",
|
||||
"version": "0.0.0-scaffold",
|
||||
"description": "Sticky session routing.",
|
||||
"main": "index.js",
|
||||
"type": "commonjs",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": { "test": "brittle-bare test/test.js" },
|
||||
"dependencies": {
|
||||
"bare-events": "^2.8.0",
|
||||
"bare-process": "^4.4.0",
|
||||
"bare-timers": "^2.0.0",
|
||||
"b4a": "^1.6.7",
|
||||
"hypercore-crypto": "^3.0.0",
|
||||
"protomux": "^3.0.0",
|
||||
"compact-encoding": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": { "hyperswarm": "^4.0.0", "bare": ">=1.0.0" },
|
||||
"devDependencies": { "brittle": "^3.0.0" },
|
||||
"imports": {
|
||||
"process": { "bare": "bare-process", "default": "process" },
|
||||
"events": { "bare": "bare-events", "default": "events" },
|
||||
"timers": { "bare": "bare-timers", "default": "timers" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
const test = require('brittle')
|
||||
const { HyperP2PStickySession, PROTOCOL } = require('../index.js')
|
||||
|
||||
test('exports load', (t) => {
|
||||
t.ok(HyperP2PStickySession)
|
||||
t.is(PROTOCOL, 'sticky-session/v1')
|
||||
})
|
||||
|
||||
test('getStats shape', async (t) => {
|
||||
const m = new HyperP2PStickySession()
|
||||
const s = m.getStats()
|
||||
t.is(s.tier, 'scaffold')
|
||||
t.is(s.protocol, 'sticky-session/v1')
|
||||
})
|
||||
Reference in New Issue
Block a user