@optimystic/db-p2p 0.14.1 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +616 -609
- package/dist/src/cluster/block-transfer-service.d.ts.map +1 -1
- package/dist/src/cluster/block-transfer-service.js +4 -3
- package/dist/src/cluster/block-transfer-service.js.map +1 -1
- package/dist/src/cluster/block-transfer.d.ts +52 -3
- package/dist/src/cluster/block-transfer.d.ts.map +1 -1
- package/dist/src/cluster/block-transfer.js +129 -6
- package/dist/src/cluster/block-transfer.js.map +1 -1
- package/dist/src/cluster/client.d.ts.map +1 -1
- package/dist/src/cluster/client.js +3 -1
- package/dist/src/cluster/client.js.map +1 -1
- package/dist/src/cluster/cluster-repo.d.ts +182 -11
- package/dist/src/cluster/cluster-repo.d.ts.map +1 -1
- package/dist/src/cluster/cluster-repo.js +429 -69
- package/dist/src/cluster/cluster-repo.js.map +1 -1
- package/dist/src/cluster/peer-key-binding.d.ts +25 -0
- package/dist/src/cluster/peer-key-binding.d.ts.map +1 -0
- package/dist/src/cluster/peer-key-binding.js +39 -0
- package/dist/src/cluster/peer-key-binding.js.map +1 -0
- package/dist/src/cluster/quorum-restore.d.ts +72 -0
- package/dist/src/cluster/quorum-restore.d.ts.map +1 -0
- package/dist/src/cluster/quorum-restore.js +0 -0
- package/dist/src/cluster/quorum-restore.js.map +1 -0
- package/dist/src/cluster/rebalance-monitor.d.ts +23 -1
- package/dist/src/cluster/rebalance-monitor.d.ts.map +1 -1
- package/dist/src/cluster/rebalance-monitor.js +17 -2
- package/dist/src/cluster/rebalance-monitor.js.map +1 -1
- package/dist/src/cluster/service.d.ts.map +1 -1
- package/dist/src/cluster/service.js +7 -1
- package/dist/src/cluster/service.js.map +1 -1
- package/dist/src/cluster/spread-on-churn.d.ts +7 -0
- package/dist/src/cluster/spread-on-churn.d.ts.map +1 -1
- package/dist/src/cluster/spread-on-churn.js +4 -1
- package/dist/src/cluster/spread-on-churn.js.map +1 -1
- package/dist/src/cluster/supermajority-coupling.d.ts +22 -0
- package/dist/src/cluster/supermajority-coupling.d.ts.map +1 -0
- package/dist/src/cluster/supermajority-coupling.js +27 -0
- package/dist/src/cluster/supermajority-coupling.js.map +1 -0
- package/dist/src/cohort-topic/cohort-gossip-driver.d.ts +46 -4
- package/dist/src/cohort-topic/cohort-gossip-driver.d.ts.map +1 -1
- package/dist/src/cohort-topic/cohort-gossip-driver.js +62 -7
- package/dist/src/cohort-topic/cohort-gossip-driver.js.map +1 -1
- package/dist/src/cohort-topic/cohort-gossip-transport.d.ts +7 -0
- package/dist/src/cohort-topic/cohort-gossip-transport.d.ts.map +1 -1
- package/dist/src/cohort-topic/cohort-gossip-transport.js +9 -0
- package/dist/src/cohort-topic/cohort-gossip-transport.js.map +1 -1
- package/dist/src/cohort-topic/host.d.ts +197 -27
- package/dist/src/cohort-topic/host.d.ts.map +1 -1
- package/dist/src/cohort-topic/host.js +643 -87
- package/dist/src/cohort-topic/host.js.map +1 -1
- package/dist/src/dispute/arbitrator-selection.d.ts +68 -7
- package/dist/src/dispute/arbitrator-selection.d.ts.map +1 -1
- package/dist/src/dispute/arbitrator-selection.js +105 -16
- package/dist/src/dispute/arbitrator-selection.js.map +1 -1
- package/dist/src/dispute/cascade.d.ts +7 -0
- package/dist/src/dispute/cascade.d.ts.map +1 -1
- package/dist/src/dispute/cascade.js +1 -1
- package/dist/src/dispute/cascade.js.map +1 -1
- package/dist/src/dispute/client.d.ts.map +1 -1
- package/dist/src/dispute/client.js +3 -2
- package/dist/src/dispute/client.js.map +1 -1
- package/dist/src/dispute/dispute-service.d.ts +32 -3
- package/dist/src/dispute/dispute-service.d.ts.map +1 -1
- package/dist/src/dispute/dispute-service.js +82 -9
- package/dist/src/dispute/dispute-service.js.map +1 -1
- package/dist/src/dispute/index.d.ts +1 -1
- package/dist/src/dispute/index.d.ts.map +1 -1
- package/dist/src/dispute/index.js +1 -1
- package/dist/src/dispute/index.js.map +1 -1
- package/dist/src/dispute/invalidation.d.ts +25 -0
- package/dist/src/dispute/invalidation.d.ts.map +1 -1
- package/dist/src/dispute/invalidation.js +14 -2
- package/dist/src/dispute/invalidation.js.map +1 -1
- package/dist/src/dispute/service.d.ts.map +1 -1
- package/dist/src/dispute/service.js +7 -1
- package/dist/src/dispute/service.js.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/it-utility.d.ts +1 -1
- package/dist/src/it-utility.d.ts.map +1 -1
- package/dist/src/it-utility.js +4 -13
- package/dist/src/it-utility.js.map +1 -1
- package/dist/src/libp2p-key-network.d.ts +98 -1
- package/dist/src/libp2p-key-network.d.ts.map +1 -1
- package/dist/src/libp2p-key-network.js +272 -17
- package/dist/src/libp2p-key-network.js.map +1 -1
- package/dist/src/libp2p-node-base.d.ts +12 -0
- package/dist/src/libp2p-node-base.d.ts.map +1 -1
- package/dist/src/libp2p-node-base.js +415 -87
- package/dist/src/libp2p-node-base.js.map +1 -1
- package/dist/src/matchmaking/query-transport.d.ts +2 -0
- package/dist/src/matchmaking/query-transport.d.ts.map +1 -1
- package/dist/src/matchmaking/query-transport.js +6 -0
- package/dist/src/matchmaking/query-transport.js.map +1 -1
- package/dist/src/matchmaking/traffic-validation.js +1 -0
- package/dist/src/matchmaking/traffic-validation.js.map +1 -1
- package/dist/src/network/network-manager-service.d.ts +2 -2
- package/dist/src/network/network-manager-service.d.ts.map +1 -1
- package/dist/src/network/network-manager-service.js +8 -4
- package/dist/src/network/network-manager-service.js.map +1 -1
- package/dist/src/owned-block-seed.d.ts +27 -0
- package/dist/src/owned-block-seed.d.ts.map +1 -0
- package/dist/src/owned-block-seed.js +37 -0
- package/dist/src/owned-block-seed.js.map +1 -0
- package/dist/src/protocol-client.d.ts +1 -0
- package/dist/src/protocol-client.d.ts.map +1 -1
- package/dist/src/protocol-client.js +9 -2
- package/dist/src/protocol-client.js.map +1 -1
- package/dist/src/protocol-limits.d.ts +32 -0
- package/dist/src/protocol-limits.d.ts.map +1 -0
- package/dist/src/protocol-limits.js +32 -0
- package/dist/src/protocol-limits.js.map +1 -0
- package/dist/src/repo/client.d.ts.map +1 -1
- package/dist/src/repo/client.js +3 -0
- package/dist/src/repo/client.js.map +1 -1
- package/dist/src/repo/cluster-coordinator.d.ts +41 -4
- package/dist/src/repo/cluster-coordinator.d.ts.map +1 -1
- package/dist/src/repo/cluster-coordinator.js +128 -80
- package/dist/src/repo/cluster-coordinator.js.map +1 -1
- package/dist/src/repo/coordinator-repo.d.ts +38 -1
- package/dist/src/repo/coordinator-repo.d.ts.map +1 -1
- package/dist/src/repo/coordinator-repo.js +92 -13
- package/dist/src/repo/coordinator-repo.js.map +1 -1
- package/dist/src/repo/service.d.ts.map +1 -1
- package/dist/src/repo/service.js +7 -1
- package/dist/src/repo/service.js.map +1 -1
- package/dist/src/reputation/peer-reputation.js +1 -1
- package/dist/src/reputation/peer-reputation.js.map +1 -1
- package/dist/src/reputation/types.d.ts +3 -1
- package/dist/src/reputation/types.d.ts.map +1 -1
- package/dist/src/reputation/types.js +3 -0
- package/dist/src/reputation/types.js.map +1 -1
- package/dist/src/rn.d.ts +5 -1
- package/dist/src/rn.d.ts.map +1 -1
- package/dist/src/rn.js +7 -1
- package/dist/src/rn.js.map +1 -1
- package/dist/src/storage/arachnode-fret-adapter.d.ts +30 -1
- package/dist/src/storage/arachnode-fret-adapter.d.ts.map +1 -1
- package/dist/src/storage/arachnode-fret-adapter.js +15 -2
- package/dist/src/storage/arachnode-fret-adapter.js.map +1 -1
- package/dist/src/storage/arachnode-partition.d.ts +49 -0
- package/dist/src/storage/arachnode-partition.d.ts.map +1 -0
- package/dist/src/storage/arachnode-partition.js +61 -0
- package/dist/src/storage/arachnode-partition.js.map +1 -0
- package/dist/src/storage/block-storage.d.ts +40 -1
- package/dist/src/storage/block-storage.d.ts.map +1 -1
- package/dist/src/storage/block-storage.js +150 -57
- package/dist/src/storage/block-storage.js.map +1 -1
- package/dist/src/storage/i-block-storage.d.ts +8 -0
- package/dist/src/storage/i-block-storage.d.ts.map +1 -1
- package/dist/src/storage/i-raw-storage.d.ts +13 -0
- package/dist/src/storage/i-raw-storage.d.ts.map +1 -1
- package/dist/src/storage/kv-raw-storage.d.ts +45 -0
- package/dist/src/storage/kv-raw-storage.d.ts.map +1 -0
- package/dist/src/storage/kv-raw-storage.js +113 -0
- package/dist/src/storage/kv-raw-storage.js.map +1 -0
- package/dist/src/storage/memory-storage.d.ts +20 -58
- package/dist/src/storage/memory-storage.d.ts.map +1 -1
- package/dist/src/storage/memory-storage.js +22 -148
- package/dist/src/storage/memory-storage.js.map +1 -1
- package/dist/src/storage/memory-store-driver.d.ts +39 -0
- package/dist/src/storage/memory-store-driver.d.ts.map +1 -0
- package/dist/src/storage/memory-store-driver.js +129 -0
- package/dist/src/storage/memory-store-driver.js.map +1 -0
- package/dist/src/storage/raw-store-codec.d.ts +10 -0
- package/dist/src/storage/raw-store-codec.d.ts.map +1 -0
- package/dist/src/storage/raw-store-codec.js +36 -0
- package/dist/src/storage/raw-store-codec.js.map +1 -0
- package/dist/src/storage/raw-store-driver.d.ts +69 -0
- package/dist/src/storage/raw-store-driver.d.ts.map +1 -0
- package/dist/src/storage/raw-store-driver.js +2 -0
- package/dist/src/storage/raw-store-driver.js.map +1 -0
- package/dist/src/storage/restoration-coordinator-v2.d.ts.map +1 -1
- package/dist/src/storage/restoration-coordinator-v2.js +1 -1
- package/dist/src/storage/restoration-coordinator-v2.js.map +1 -1
- package/dist/src/storage/restoration-coordinator.d.ts +73 -0
- package/dist/src/storage/restoration-coordinator.d.ts.map +1 -0
- package/dist/src/storage/restoration-coordinator.js +181 -0
- package/dist/src/storage/restoration-coordinator.js.map +1 -0
- package/dist/src/storage/ring-selector.d.ts +92 -5
- package/dist/src/storage/ring-selector.d.ts.map +1 -1
- package/dist/src/storage/ring-selector.js +153 -51
- package/dist/src/storage/ring-selector.js.map +1 -1
- package/dist/src/storage/ring-shift-coordinator.d.ts +128 -0
- package/dist/src/storage/ring-shift-coordinator.d.ts.map +1 -0
- package/dist/src/storage/ring-shift-coordinator.js +196 -0
- package/dist/src/storage/ring-shift-coordinator.js.map +1 -0
- package/dist/src/storage/storage-monitor.d.ts +28 -0
- package/dist/src/storage/storage-monitor.d.ts.map +1 -1
- package/dist/src/storage/storage-monitor.js +42 -2
- package/dist/src/storage/storage-monitor.js.map +1 -1
- package/dist/src/storage/storage-repo.d.ts +19 -0
- package/dist/src/storage/storage-repo.d.ts.map +1 -1
- package/dist/src/storage/storage-repo.js +172 -22
- package/dist/src/storage/storage-repo.js.map +1 -1
- package/dist/src/sync/client.d.ts.map +1 -1
- package/dist/src/sync/client.js +5 -1
- package/dist/src/sync/client.js.map +1 -1
- package/dist/src/sync/service.d.ts.map +1 -1
- package/dist/src/sync/service.js +2 -1
- package/dist/src/sync/service.js.map +1 -1
- package/dist/src/testing/cohort-topic-mesh-harness.d.ts +28 -4
- package/dist/src/testing/cohort-topic-mesh-harness.d.ts.map +1 -1
- package/dist/src/testing/cohort-topic-mesh-harness.js +51 -10
- package/dist/src/testing/cohort-topic-mesh-harness.js.map +1 -1
- package/dist/src/testing/index.d.ts +1 -0
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -0
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/testing/mesh-harness.d.ts.map +1 -1
- package/dist/src/testing/mesh-harness.js +15 -7
- package/dist/src/testing/mesh-harness.js.map +1 -1
- package/dist/src/testing/raw-storage-conformance.d.ts +24 -0
- package/dist/src/testing/raw-storage-conformance.d.ts.map +1 -0
- package/dist/src/testing/raw-storage-conformance.js +313 -0
- package/dist/src/testing/raw-storage-conformance.js.map +1 -0
- package/package.json +4 -4
- package/src/cluster/block-transfer-service.ts +4 -3
- package/src/cluster/block-transfer.ts +424 -265
- package/src/cluster/client.ts +3 -1
- package/src/cluster/cluster-repo.ts +481 -71
- package/src/cluster/peer-key-binding.ts +37 -0
- package/src/cluster/quorum-restore.ts +0 -0
- package/src/cluster/rebalance-monitor.ts +34 -3
- package/src/cluster/service.ts +7 -1
- package/src/cluster/spread-on-churn.ts +11 -1
- package/src/cluster/supermajority-coupling.ts +37 -0
- package/src/cohort-topic/cohort-gossip-driver.ts +96 -9
- package/src/cohort-topic/cohort-gossip-transport.ts +10 -0
- package/src/cohort-topic/host.ts +831 -105
- package/src/dispute/arbitrator-selection.ts +138 -28
- package/src/dispute/cascade.ts +8 -1
- package/src/dispute/client.ts +3 -2
- package/src/dispute/dispute-service.ts +94 -9
- package/src/dispute/index.ts +7 -1
- package/src/dispute/invalidation.ts +40 -2
- package/src/dispute/service.ts +7 -1
- package/src/index.ts +46 -43
- package/src/it-utility.ts +5 -13
- package/src/libp2p-key-network.ts +281 -18
- package/src/libp2p-node-base.ts +485 -79
- package/src/matchmaking/query-transport.ts +9 -0
- package/src/network/network-manager-service.ts +8 -2
- package/src/owned-block-seed.ts +40 -0
- package/src/protocol-client.ts +10 -3
- package/src/protocol-limits.ts +33 -0
- package/src/repo/client.ts +3 -0
- package/src/repo/cluster-coordinator.ts +145 -82
- package/src/repo/coordinator-repo.ts +96 -16
- package/src/repo/service.ts +7 -1
- package/src/reputation/types.ts +3 -0
- package/src/rn.ts +7 -1
- package/src/storage/arachnode-fret-adapter.ts +33 -2
- package/src/storage/arachnode-partition.ts +74 -0
- package/src/storage/block-storage.ts +169 -61
- package/src/storage/i-block-storage.ts +9 -0
- package/src/storage/i-raw-storage.ts +14 -0
- package/src/storage/kv-raw-storage.ts +135 -0
- package/src/storage/memory-storage.ts +25 -173
- package/src/storage/memory-store-driver.ts +157 -0
- package/src/storage/raw-store-codec.ts +42 -0
- package/src/storage/raw-store-driver.ts +80 -0
- package/src/storage/{restoration-coordinator-v2.ts → restoration-coordinator.ts} +43 -37
- package/src/storage/ring-selector.ts +317 -176
- package/src/storage/ring-shift-coordinator.ts +271 -0
- package/src/storage/storage-monitor.ts +70 -3
- package/src/storage/storage-repo.ts +710 -558
- package/src/sync/client.ts +5 -1
- package/src/sync/service.ts +2 -1
- package/src/testing/cohort-topic-mesh-harness.ts +61 -11
- package/src/testing/index.ts +1 -0
- package/src/testing/mesh-harness.ts +14 -6
- package/src/testing/raw-storage-conformance.ts +397 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spread-on-churn.js","sourceRoot":"","sources":["../../../src/cluster/spread-on-churn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,MAAM,GAAG,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAA;AAC3C,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"spread-on-churn.js","sourceRoot":"","sources":["../../../src/cluster/spread-on-churn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,MAAM,GAAG,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAA;AAC3C,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;AAiErC,wEAAwE;AAExE,MAAM,cAAc,GAAwB;IAC3C,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,CAAC;IACjB,qBAAqB,EAAE,IAAI;IAC3B,eAAe,EAAE,GAAG;IACpB,mBAAmB,EAAE,IAAI;IACzB,aAAa,EAAE,CAAC;IAChB,iBAAiB,EAAE,IAAI;IACvB,qBAAqB,EA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IAAI,CAAC,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAA;QAC7B,CAAC;QAED,kEAAkE;QAClE,4DAA4D;QAC5D,MAAM,IAAI,GAAS,IAAI,CAAC,IAAI,CAAC,IAAY,CAAC,cAAc,EAAE,EAAE,CAAA;QAC5D,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAA;QAC1C,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;YAC/E,MAAM,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAA;YAC9C,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;gBACzC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAA;gBAChE,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YAC9B,CAAC;QACF,CAAC;QAED,OAAO,CAAC,CAAA;IACT,CAAC;IAEO,SAAS,CAAC,KAAkB;QACnC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC;gBACJ,OAAO,CAAC,KAAK,CAAC,CAAA;YACf,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAA;YAC9B,CAAC;QACF,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** A component that exposes the super-majority threshold it actually runs on. */
|
|
2
|
+
export interface HasEffectiveSuperMajorityThreshold {
|
|
3
|
+
readonly effectiveSuperMajorityThreshold: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Fail-fast coupling check for a live node's consensus wiring.
|
|
7
|
+
*
|
|
8
|
+
* The cluster **member** (what accepts a super-majority of promises as sufficient for a commit) and the
|
|
9
|
+
* **coordinator** (what declares a transaction committed once it has that super-majority) MUST run the
|
|
10
|
+
* SAME `superMajorityThreshold`. If they disagree, the coordinator can declare a transaction final on a
|
|
11
|
+
* super-majority the member never accepts as final — a silent phase-disagreement that only surfaces
|
|
12
|
+
* mid-consensus, far too late.
|
|
13
|
+
*
|
|
14
|
+
* On a live node both are fed from a single resolved `consensusConfig`, so this check normally passes. It
|
|
15
|
+
* exists to catch *future* drift — divergent fallback defaults, a mis-threaded `clusterPolicy`, a
|
|
16
|
+
* per-deployment config that reaches only one side — by throwing at construction with both values and
|
|
17
|
+
* their provenance, rather than letting the node come up mismatched.
|
|
18
|
+
*
|
|
19
|
+
* @throws Error naming both resolved thresholds and where they come from, if they are not equal.
|
|
20
|
+
*/
|
|
21
|
+
export declare function assertSuperMajorityCoupling(member: HasEffectiveSuperMajorityThreshold, coordinator: HasEffectiveSuperMajorityThreshold): void;
|
|
22
|
+
//# sourceMappingURL=supermajority-coupling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supermajority-coupling.d.ts","sourceRoot":"","sources":["../../../src/cluster/supermajority-coupling.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,WAAW,kCAAkC;IAClD,QAAQ,CAAC,+BAA+B,EAAE,MAAM,CAAC;CACjD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,kCAAkC,EAC1C,WAAW,EAAE,kCAAkC,GAC7C,IAAI,CAUN"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DEFAULT_SUPER_MAJORITY_THRESHOLD } from "@optimystic/db-core";
|
|
2
|
+
/**
|
|
3
|
+
* Fail-fast coupling check for a live node's consensus wiring.
|
|
4
|
+
*
|
|
5
|
+
* The cluster **member** (what accepts a super-majority of promises as sufficient for a commit) and the
|
|
6
|
+
* **coordinator** (what declares a transaction committed once it has that super-majority) MUST run the
|
|
7
|
+
* SAME `superMajorityThreshold`. If they disagree, the coordinator can declare a transaction final on a
|
|
8
|
+
* super-majority the member never accepts as final — a silent phase-disagreement that only surfaces
|
|
9
|
+
* mid-consensus, far too late.
|
|
10
|
+
*
|
|
11
|
+
* On a live node both are fed from a single resolved `consensusConfig`, so this check normally passes. It
|
|
12
|
+
* exists to catch *future* drift — divergent fallback defaults, a mis-threaded `clusterPolicy`, a
|
|
13
|
+
* per-deployment config that reaches only one side — by throwing at construction with both values and
|
|
14
|
+
* their provenance, rather than letting the node come up mismatched.
|
|
15
|
+
*
|
|
16
|
+
* @throws Error naming both resolved thresholds and where they come from, if they are not equal.
|
|
17
|
+
*/
|
|
18
|
+
export function assertSuperMajorityCoupling(member, coordinator) {
|
|
19
|
+
const memberThreshold = member.effectiveSuperMajorityThreshold;
|
|
20
|
+
const coordinatorThreshold = coordinator.effectiveSuperMajorityThreshold;
|
|
21
|
+
if (memberThreshold !== coordinatorThreshold) {
|
|
22
|
+
throw new Error(`Super-majority threshold mismatch at node startup: cluster member resolved ${memberThreshold} but coordinator resolved ${coordinatorThreshold}. ` +
|
|
23
|
+
`Both derive from consensusConfig.superMajorityThreshold (options.clusterPolicy?.superMajorityThreshold ?? DEFAULT_SUPER_MAJORITY_THRESHOLD=${DEFAULT_SUPER_MAJORITY_THRESHOLD}); ` +
|
|
24
|
+
`they must be equal or the coordinator would declare transactions committed on a super-majority the member rejects as final.`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=supermajority-coupling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supermajority-coupling.js","sourceRoot":"","sources":["../../../src/cluster/supermajority-coupling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAOvE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,2BAA2B,CAC1C,MAA0C,EAC1C,WAA+C;IAE/C,MAAM,eAAe,GAAG,MAAM,CAAC,+BAA+B,CAAC;IAC/D,MAAM,oBAAoB,GAAG,WAAW,CAAC,+BAA+B,CAAC;IACzE,IAAI,eAAe,KAAK,oBAAoB,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACd,8EAA8E,eAAe,6BAA6B,oBAAoB,IAAI;YAClJ,8IAA8I,gCAAgC,KAAK;YACnL,6HAA6H,CAC7H,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* envelope, and the per-coord inbound routing all live at the FRET/libp2p boundary; db-core supplies the
|
|
11
11
|
* pure substrate (`selfWillingnessBits`, `toCohortTopicSummary`, `toGossipRecord`, the bus merge).
|
|
12
12
|
*/
|
|
13
|
-
import { type CohortGossipV1, type CohortTopicSummary, type GossipRecordRefV1, type GossipRecordV1, type LoadBarometerState, type NodeProfile, type RegistrationRecord } from "@optimystic/db-core";
|
|
13
|
+
import { type ChildLinkRefV1, type CohortGossipV1, type CohortTopicSummary, type GossipRecordRefV1, type GossipRecordV1, type LoadBarometerState, type NodeProfile, type RegistrationRecord } from "@optimystic/db-core";
|
|
14
14
|
/**
|
|
15
15
|
* Default gossip-round cadence in ms. There is no dedicated `gossip_round` constant in
|
|
16
16
|
* `docs/cohort-topic.md` §Configuration, so this is a derived, injectable default on the order of one
|
|
@@ -20,6 +20,19 @@ import { type CohortGossipV1, type CohortTopicSummary, type GossipRecordRefV1, t
|
|
|
20
20
|
* driver can tick fast and let those modules decide when to act.
|
|
21
21
|
*/
|
|
22
22
|
export declare const DEFAULT_GOSSIP_INTERVAL_MS = 5000;
|
|
23
|
+
/**
|
|
24
|
+
* Default `T_willingness_heartbeat` (ms): how often a genuinely-**idle** but **willing** engine re-broadcasts
|
|
25
|
+
* a willingness-only heartbeat so a cold cohort can bootstrap (siblings hear it, instantiate, and reciprocate
|
|
26
|
+
* their own willingness) without waiting on a first registration that can never be admitted while the view is
|
|
27
|
+
* empty. See `docs/cohort-topic.md` §Cold-start instantiation / §Configuration.
|
|
28
|
+
*
|
|
29
|
+
* On the order of the ping interval (~30 s, `ttl/3` Core) — a few gossip rounds at the 5 s cadence. A
|
|
30
|
+
* record-carrying (non-idle) round already ships willingness every round and resets this clock, so the
|
|
31
|
+
* throttle governs only engines with nothing else to say. The very first idle round after an engine is
|
|
32
|
+
* created emits immediately (no wait), so bootstrap converges in ~2 rounds; the throttle only paces the
|
|
33
|
+
* steady-state re-broadcast of an idle willing cohort.
|
|
34
|
+
*/
|
|
35
|
+
export declare const DEFAULT_WILLINGNESS_HEARTBEAT_MS = 30000;
|
|
23
36
|
/**
|
|
24
37
|
* Per-`CoordEngine` queue of registration-record deltas accumulated between gossip rounds. The renewal
|
|
25
38
|
* cohort side calls {@link PendingDeltas.touch} on every served ping/re-attach and
|
|
@@ -31,12 +44,23 @@ export interface PendingDeltas {
|
|
|
31
44
|
touch(rec: RegistrationRecord): void;
|
|
32
45
|
/** Queue an eviction ref and drop any pending record for the same key (a stale record can't also re-advertise). */
|
|
33
46
|
evicted(rec: RegistrationRecord): void;
|
|
47
|
+
/**
|
|
48
|
+
* Queue a child-cohort **link** for replication (keyed by `(topicId, childCohortCoord)`; last write wins on
|
|
49
|
+
* `effectiveAt`). Enqueued by the parent engine only when the local child registry actually changed, so a
|
|
50
|
+
* stale/no-op record is not re-gossiped. A link and a later unlink for the same child in one round collapse
|
|
51
|
+
* to whichever carries the newer `effectiveAt`.
|
|
52
|
+
*/
|
|
53
|
+
childLink(topicId: Uint8Array, childCohortCoord: Uint8Array, effectiveAt: number): void;
|
|
54
|
+
/** Queue a child-cohort **unlink** (a released/demoted child) for replication; same key + last-writer-wins as {@link childLink}. */
|
|
55
|
+
childUnlink(topicId: Uint8Array, childCohortCoord: Uint8Array, effectiveAt: number): void;
|
|
34
56
|
/** True iff nothing is queued. */
|
|
35
57
|
isEmpty(): boolean;
|
|
36
58
|
/** Drain the queue into wire-shaped deltas, clearing it. */
|
|
37
59
|
drain(): {
|
|
38
60
|
records: GossipRecordV1[];
|
|
39
61
|
evicted: GossipRecordRefV1[];
|
|
62
|
+
childLinks: ChildLinkRefV1[];
|
|
63
|
+
childUnlinks: ChildLinkRefV1[];
|
|
40
64
|
};
|
|
41
65
|
}
|
|
42
66
|
/** Build an empty {@link PendingDeltas} queue. */
|
|
@@ -49,6 +73,16 @@ export interface GossipFrameInputs {
|
|
|
49
73
|
readonly coord: string;
|
|
50
74
|
/** This cohort's epoch, base64url. */
|
|
51
75
|
readonly cohortEpoch: string;
|
|
76
|
+
/** This cohort's tree tier `d` — carried on the frame so a cold sibling instantiates at the right tier. */
|
|
77
|
+
readonly treeTier: number;
|
|
78
|
+
/**
|
|
79
|
+
* True to emit a **willingness-only heartbeat** even when this engine is idle (no resident topics, no
|
|
80
|
+
* pending deltas) — provided the node is actually willing for some tier. Lets an idle-but-willing engine
|
|
81
|
+
* still tell siblings it will serve, so a cold cohort can bootstrap (§Cold-start instantiation). The caller
|
|
82
|
+
* (the gossip round) sets this from the per-engine heartbeat clock; a non-idle round ignores it (it already
|
|
83
|
+
* ships willingness).
|
|
84
|
+
*/
|
|
85
|
+
readonly heartbeat: boolean;
|
|
52
86
|
/** This node's tier profile (the `∧` half of the willingness vector). */
|
|
53
87
|
readonly profile: NodeProfile;
|
|
54
88
|
/** This member's load barometer (load buckets + the load-shed half of willingness). */
|
|
@@ -61,13 +95,21 @@ export interface GossipFrameInputs {
|
|
|
61
95
|
readonly records: GossipRecordV1[];
|
|
62
96
|
/** Drained eviction refs for this round. */
|
|
63
97
|
readonly evicted: GossipRecordRefV1[];
|
|
98
|
+
/** Drained child-cohort link refs for this round (cross-member child-set convergence). */
|
|
99
|
+
readonly childLinks: ChildLinkRefV1[];
|
|
100
|
+
/** Drained child-cohort unlink refs for this round (a released/demoted child). */
|
|
101
|
+
readonly childUnlinks: ChildLinkRefV1[];
|
|
64
102
|
/** Round timestamp, unix ms. */
|
|
65
103
|
readonly timestamp: number;
|
|
66
104
|
}
|
|
67
105
|
/**
|
|
68
|
-
* Assemble one round's {@link CohortGossipV1}, or `undefined` when this engine
|
|
69
|
-
*
|
|
70
|
-
* empty engines cost no gossip)
|
|
106
|
+
* Assemble one round's {@link CohortGossipV1}, or `undefined` when this engine has nothing to say. An engine
|
|
107
|
+
* is **idle** when it holds no resident topics and no pending deltas. An idle engine normally builds no frame
|
|
108
|
+
* (idle empty engines cost no gossip) — **except** on a willingness heartbeat ({@link GossipFrameInputs.heartbeat}),
|
|
109
|
+
* where an idle engine that is willing for at least one tier (`selfWillingnessBits !== 0`) still emits a
|
|
110
|
+
* willingness/load-only frame (empty `topicSummaries`, no `records`/`evicted`) so siblings can hear it and a
|
|
111
|
+
* cold cohort can bootstrap (§Cold-start instantiation). An idle-and-unwilling engine stays silent even on a
|
|
112
|
+
* heartbeat (nothing to bootstrap). `willingnessBits` is `profile ∧ load` ({@link selfWillingnessBits}); the
|
|
71
113
|
* `signature` slot is left empty for the host's peer-key signer to fill before broadcast.
|
|
72
114
|
*/
|
|
73
115
|
export declare function buildCohortGossip(i: GossipFrameInputs): CohortGossipV1 | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cohort-gossip-driver.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/cohort-gossip-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAKN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,OAAQ,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B,0G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AG,SAAS,CAiClF"}
|
|
@@ -20,11 +20,36 @@ import { bytesToB64url, toGossipRecord, willingnessBitsHex, selfWillingnessBits,
|
|
|
20
20
|
* driver can tick fast and let those modules decide when to act.
|
|
21
21
|
*/
|
|
22
22
|
export const DEFAULT_GOSSIP_INTERVAL_MS = 5_000;
|
|
23
|
+
/**
|
|
24
|
+
* Default `T_willingness_heartbeat` (ms): how often a genuinely-**idle** but **willing** engine re-broadcasts
|
|
25
|
+
* a willingness-only heartbeat so a cold cohort can bootstrap (siblings hear it, instantiate, and reciprocate
|
|
26
|
+
* their own willingness) without waiting on a first registration that can never be admitted while the view is
|
|
27
|
+
* empty. See `docs/cohort-topic.md` §Cold-start instantiation / §Configuration.
|
|
28
|
+
*
|
|
29
|
+
* On the order of the ping interval (~30 s, `ttl/3` Core) — a few gossip rounds at the 5 s cadence. A
|
|
30
|
+
* record-carrying (non-idle) round already ships willingness every round and resets this clock, so the
|
|
31
|
+
* throttle governs only engines with nothing else to say. The very first idle round after an engine is
|
|
32
|
+
* created emits immediately (no wait), so bootstrap converges in ~2 rounds; the throttle only paces the
|
|
33
|
+
* steady-state re-broadcast of an idle willing cohort.
|
|
34
|
+
*/
|
|
35
|
+
export const DEFAULT_WILLINGNESS_HEARTBEAT_MS = 30_000;
|
|
23
36
|
/** Build an empty {@link PendingDeltas} queue. */
|
|
24
37
|
export function createPendingDeltas() {
|
|
25
38
|
const records = new Map();
|
|
26
39
|
const evicted = new Map();
|
|
40
|
+
const childDeltas = new Map();
|
|
27
41
|
const keyOf = (topicId, participantId) => `${bytesToB64url(topicId)}|${bytesToB64url(participantId)}`;
|
|
42
|
+
// A child delta and its later opposite (link→unlink) share one key so the round drains only the newest.
|
|
43
|
+
const childKeyOf = (topicId, childCohortCoord) => `${bytesToB64url(topicId)}|${bytesToB64url(childCohortCoord)}`;
|
|
44
|
+
const queueChild = (topicId, childCohortCoord, effectiveAt, linked) => {
|
|
45
|
+
const key = childKeyOf(topicId, childCohortCoord);
|
|
46
|
+
const held = childDeltas.get(key);
|
|
47
|
+
// Last-writer-wins on effectiveAt: never let an older link/unlink shadow a newer one queued the same round.
|
|
48
|
+
if (held !== undefined && effectiveAt < held.ref.effectiveAt) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
childDeltas.set(key, { ref: { topicId: bytesToB64url(topicId), childCohortCoord: bytesToB64url(childCohortCoord), effectiveAt }, linked });
|
|
52
|
+
};
|
|
28
53
|
return {
|
|
29
54
|
touch(rec) {
|
|
30
55
|
const key = keyOf(rec.topicId, rec.participantId);
|
|
@@ -37,31 +62,54 @@ export function createPendingDeltas() {
|
|
|
37
62
|
},
|
|
38
63
|
evicted(rec) {
|
|
39
64
|
const key = keyOf(rec.topicId, rec.participantId);
|
|
40
|
-
evicted
|
|
65
|
+
// Stamp the evicted record's lastPing so the receiver can gate the delete on freshness (a stale
|
|
66
|
+
// eviction must not delete a record the participant has since re-registered — see bus.mergeRecords).
|
|
67
|
+
evicted.set(key, { topicId: bytesToB64url(rec.topicId), participantId: bytesToB64url(rec.participantId), lastPing: rec.lastPing });
|
|
41
68
|
records.delete(key);
|
|
42
69
|
},
|
|
70
|
+
childLink(topicId, childCohortCoord, effectiveAt) {
|
|
71
|
+
queueChild(topicId, childCohortCoord, effectiveAt, true);
|
|
72
|
+
},
|
|
73
|
+
childUnlink(topicId, childCohortCoord, effectiveAt) {
|
|
74
|
+
queueChild(topicId, childCohortCoord, effectiveAt, false);
|
|
75
|
+
},
|
|
43
76
|
isEmpty() {
|
|
44
|
-
return records.size === 0 && evicted.size === 0;
|
|
77
|
+
return records.size === 0 && evicted.size === 0 && childDeltas.size === 0;
|
|
45
78
|
},
|
|
46
79
|
drain() {
|
|
80
|
+
const childLinks = [];
|
|
81
|
+
const childUnlinks = [];
|
|
82
|
+
for (const delta of childDeltas.values()) {
|
|
83
|
+
(delta.linked ? childLinks : childUnlinks).push(delta.ref);
|
|
84
|
+
}
|
|
47
85
|
const out = {
|
|
48
86
|
records: [...records.values()].map(toGossipRecord),
|
|
49
87
|
evicted: [...evicted.values()],
|
|
88
|
+
childLinks,
|
|
89
|
+
childUnlinks,
|
|
50
90
|
};
|
|
51
91
|
records.clear();
|
|
52
92
|
evicted.clear();
|
|
93
|
+
childDeltas.clear();
|
|
53
94
|
return out;
|
|
54
95
|
},
|
|
55
96
|
};
|
|
56
97
|
}
|
|
57
98
|
/**
|
|
58
|
-
* Assemble one round's {@link CohortGossipV1}, or `undefined` when this engine
|
|
59
|
-
*
|
|
60
|
-
* empty engines cost no gossip)
|
|
99
|
+
* Assemble one round's {@link CohortGossipV1}, or `undefined` when this engine has nothing to say. An engine
|
|
100
|
+
* is **idle** when it holds no resident topics and no pending deltas. An idle engine normally builds no frame
|
|
101
|
+
* (idle empty engines cost no gossip) — **except** on a willingness heartbeat ({@link GossipFrameInputs.heartbeat}),
|
|
102
|
+
* where an idle engine that is willing for at least one tier (`selfWillingnessBits !== 0`) still emits a
|
|
103
|
+
* willingness/load-only frame (empty `topicSummaries`, no `records`/`evicted`) so siblings can hear it and a
|
|
104
|
+
* cold cohort can bootstrap (§Cold-start instantiation). An idle-and-unwilling engine stays silent even on a
|
|
105
|
+
* heartbeat (nothing to bootstrap). `willingnessBits` is `profile ∧ load` ({@link selfWillingnessBits}); the
|
|
61
106
|
* `signature` slot is left empty for the host's peer-key signer to fill before broadcast.
|
|
62
107
|
*/
|
|
63
108
|
export function buildCohortGossip(i) {
|
|
64
|
-
|
|
109
|
+
const willingness = selfWillingnessBits(i.profile, i.barometer);
|
|
110
|
+
const idle = i.topicSummaries.length === 0 && i.records.length === 0 && i.evicted.length === 0
|
|
111
|
+
&& i.childLinks.length === 0 && i.childUnlinks.length === 0;
|
|
112
|
+
if (idle && !(i.heartbeat && willingness !== 0)) {
|
|
65
113
|
return undefined;
|
|
66
114
|
}
|
|
67
115
|
const g = {
|
|
@@ -69,7 +117,8 @@ export function buildCohortGossip(i) {
|
|
|
69
117
|
fromMember: i.fromMember,
|
|
70
118
|
coord: i.coord,
|
|
71
119
|
cohortEpoch: i.cohortEpoch,
|
|
72
|
-
|
|
120
|
+
treeTier: i.treeTier,
|
|
121
|
+
willingnessBits: willingnessBitsHex(willingness),
|
|
73
122
|
loadBuckets: i.barometer.loadBuckets(),
|
|
74
123
|
windowSeconds: i.windowSeconds,
|
|
75
124
|
topicSummaries: i.topicSummaries,
|
|
@@ -82,6 +131,12 @@ export function buildCohortGossip(i) {
|
|
|
82
131
|
if (i.evicted.length > 0) {
|
|
83
132
|
g.evicted = i.evicted;
|
|
84
133
|
}
|
|
134
|
+
if (i.childLinks.length > 0) {
|
|
135
|
+
g.childLinks = i.childLinks;
|
|
136
|
+
}
|
|
137
|
+
if (i.childUnlinks.length > 0) {
|
|
138
|
+
g.childUnlinks = i.childUnlinks;
|
|
139
|
+
}
|
|
85
140
|
return g;
|
|
86
141
|
}
|
|
87
142
|
//# sourceMappingURL=cohort-gossip-driver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cohort-gossip-driver.js","sourceRoot":"","sources":["../../../src/cohort-topic/cohort-gossip-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACN,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"cohort-gossip-driver.js","sourceRoot":"","sources":["../../../src/cohort-topic/cohort-gossip-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACN,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GASnB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAkCvD,kDAAkD;AAClD,MAAM,UAAU,mBAAmB;IAClC,MAAM,OAAO,GAAG,IAAI,GAAG,EAA8B,CAAC;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,kBAAkB,CAAC,WAAW,CAAC;QAChD,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE;QACtC,aAAa,EAAE,CAAC,CAAC,aAAa;QAC9B,cAAc,EAAE,CAAC,CAAC,cAAc;QAChC,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,SAAS,EAAE,EAAE;KACb,CAAC;IACF,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;IAC7B,CAAC;IACD,IAAI,CAAC,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;IACjC,CAAC;IACD,OAAO,CAAC,CAAC;AACV,CAAC"}
|
|
@@ -36,6 +36,13 @@ export declare class FretCohortGossipTransport implements ICohortGossipTransport
|
|
|
36
36
|
*/
|
|
37
37
|
broadcastOver(protocol: string, coord: RingCoord, msg: Uint8Array): void;
|
|
38
38
|
onMessage(handler: (from: PeerRef, msg: Uint8Array) => void): () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Number of live inbound subscriptions (one per subscribed gossip bus). Test/diagnostic introspection:
|
|
41
|
+
* each {@link CoordEngine}'s bus subscribes via {@link onMessage} and drops its subscription on `close()`,
|
|
42
|
+
* so this tracks the number of live coord engines (+ the node-level participant bus) — used to observe that
|
|
43
|
+
* the coord-engine registry's LRU eviction actually tears evicted engines down (no leaked subscriptions).
|
|
44
|
+
*/
|
|
45
|
+
get subscriberCount(): number;
|
|
39
46
|
/** Feed an inbound gossip frame (called by the host's `/cohort-gossip` protocol handler). */
|
|
40
47
|
deliver(fromPeerId: string, msg: Uint8Array): void;
|
|
41
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cohort-gossip-transport.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/cohort-gossip-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMrC,kGAAkG;AAClG,MAAM,WAAW,kBAAkB;IAClC,2EAA2E;IAC3E,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,gCAAgC;IAChD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,qBAAa,yBAA0B,YAAW,sBAAsB;IAM3D,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAU,OAAO,CAAC,QAAQ,CAAC,QAAQ;IALpE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuD;IAChF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAEP,IAAI,EAAE,MAAM,EAAmB,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,gCAAgC;IAMnI,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI;IAIlD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AE,MAAM,EAAmB,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,gCAAgC;IAMnI,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI;IAIlD;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI;IAWxE,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI;IAKxE;;;;;OAKG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,6FAA6F;IAC7F,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI;CAMlD"}
|
|
@@ -46,6 +46,15 @@ export class FretCohortGossipTransport {
|
|
|
46
46
|
this.handlers.add(handler);
|
|
47
47
|
return () => this.handlers.delete(handler);
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Number of live inbound subscriptions (one per subscribed gossip bus). Test/diagnostic introspection:
|
|
51
|
+
* each {@link CoordEngine}'s bus subscribes via {@link onMessage} and drops its subscription on `close()`,
|
|
52
|
+
* so this tracks the number of live coord engines (+ the node-level participant bus) — used to observe that
|
|
53
|
+
* the coord-engine registry's LRU eviction actually tears evicted engines down (no leaked subscriptions).
|
|
54
|
+
*/
|
|
55
|
+
get subscriberCount() {
|
|
56
|
+
return this.handlers.size;
|
|
57
|
+
}
|
|
49
58
|
/** Feed an inbound gossip frame (called by the host's `/cohort-gossip` protocol handler). */
|
|
50
59
|
deliver(fromPeerId, msg) {
|
|
51
60
|
const from = { id: peerIdToBytes(fromPeerId) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cohort-gossip-transport.js","sourceRoot":"","sources":["../../../src/cohort-topic/cohort-gossip-transport.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAg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