This commit is contained in:
Raven Scott
2026-05-20 22:56:32 -04:00
parent b8c335adee
commit dd384eb944
321 changed files with 7484 additions and 3793 deletions
@@ -1,23 +1,21 @@
# hyper-p2p-crdt-version-vector API
# API: hyper-p2p-crdt-version-vector
**Status:** scaffold · **Protocol:** `crdt-version-vector/v1`
**Protocol:** `crdt-version-vector/v1` · **Export:** `HyperP2PCrdtVersionVector`, `compareVectors`
## Class `HyperP2PCrdtVersionVector`
## Methods
Scaffold stub — methods throw `not implemented: scaffold` until promoted to production tier.
### `increment(peer)`
### `constructor(opts?)`
Increments this peer's counter and gossips.
### `getStats()`
### `merge(other)`
Returns `{ created, errors, protocol, tier: 'scaffold' }`.
Pointwise max merge: `other` is `{ peerId: count }`.
### `ready()`
### `compare(a, b)`
Resolves immediately (no-op).
Returns `'equal' | 'before' | 'after' | 'concurrent'`.
## Wire (planned)
### `toJSON()` / `getStats()` / `ready()` / `close()`
| Message | Direction | Notes |
|---------|-----------|-------|
| TBD | gossip | Defined in implementation pass |
Standard lifecycle; gossip message `crdt-version-vector-sync` with `{ peer, value }`.
@@ -1,15 +1,13 @@
# hyper-p2p-crdt-version-vector architecture
# Architecture: hyper-p2p-crdt-version-vector
**Tier:** scaffold · **Category:** `state-crdts`
## Model
## Role
Map of peer → monotonic integer. `increment(peer)` only advances the local peer entry on this replica; remote peers advance via gossip merge (max).
Version vector CRDT.
## Compare
## Composition
`compareVectors` implements standard dominates relation: `after` if all components ≥ and at least one >; `before` if dominated; `concurrent` if incomparable; `equal` if identical.
Uses `../../_shared/p2p-bare.js` for Hyperswarm + Protomux when implemented. Does **not** duplicate Holepunch core storage/transport.
## Gossip
## Holepunch boundary
Inspiration: n/a
`initModuleSwarm` when `topic` set; inbound sync applies max per peer without re-broadcast.