Updates
This commit is contained in:
@@ -3,4 +3,6 @@
|
||||
## v0.1.0
|
||||
|
||||
- Initial release.
|
||||
## v0.2.0
|
||||
|
||||
- Production-grade docs, validation, and expanded tests.
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
# hyper-p2p-contradiction-graph
|
||||
|
||||
Bare/Pear P2P primitive — **contradiction-graph/v1**.
|
||||
Bare/Pear P2P — **opposing claims contradiction lattice**
|
||||
|
||||
**Protocol:** `contradiction-graph/v1`
|
||||
|
||||
## Quick start
|
||||
|
||||
```js
|
||||
const { HyperP2PContradictionGraph } = require('hyper-p2p-contradiction-graph')
|
||||
const mod = new HyperP2PContradictionGraph()
|
||||
// await mod.ready() when using topic
|
||||
await mod.close()
|
||||
```
|
||||
|
||||
See `examples/basic.js` and `docs/api.md`.
|
||||
## Docs
|
||||
|
||||
- [docs/api.md](docs/api.md)
|
||||
- [docs/architecture.md](docs/architecture.md)
|
||||
- [../_shared/PRODUCTION.md](../_shared/PRODUCTION.md)
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
|
||||
@@ -4,5 +4,35 @@
|
||||
|
||||
**Export:** `HyperP2PContradictionGraph`
|
||||
|
||||
Integration: `../../real_tests/integration/` smoke tests.
|
||||
## Constructor
|
||||
|
||||
```js
|
||||
const mod = new HyperP2PContradictionGraph(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 **opposing claims contradiction lattice**.
|
||||
|
||||
## 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 `contradiction-graph/v1` via [`_shared/p2p-bare.js`](../_shared/p2p-bare.js).
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
Integration: [`../../real_tests/integration/contradiction-graph-two-node.js`](../../real_tests/integration/contradiction-graph-two-node.js)
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
# Architecture: hyper-p2p-contradiction-graph
|
||||
|
||||
Hyperswarm + Protomux (`contradiction-graph/v1`) when `topic` is set via `p2p-bare.js`.
|
||||
```mermaid
|
||||
flowchart LR
|
||||
App[Application] --> Mod[HyperP2PContradictionGraph]
|
||||
Mod --> P2P[Protomux contradiction-graph/v1]
|
||||
P2P --> Swarm[Hyperswarm]
|
||||
```
|
||||
|
||||
Local state lives in memory maps/arrays; gossip merges remote updates when `topic` is configured.
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "hyper-p2p-contradiction-graph",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "hyper-p2p-contradiction-graph",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"b4a": "^1.6.7",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hyper-p2p-contradiction-graph",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"description": "Opposing claims contradiction lattice for Bare/Pear P2P.",
|
||||
"main": "index.js",
|
||||
"type": "commonjs",
|
||||
|
||||
@@ -20,3 +20,8 @@ test('contradiction-graph: merge', async (t) => {
|
||||
await a.close()
|
||||
await b.close()
|
||||
})
|
||||
test('hyper-p2p-contradiction-graph: close without leak', async (t) => {
|
||||
const m = new HyperP2PContradictionGraph()
|
||||
await m.close()
|
||||
t.pass()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user