@optimystic/db-core 0.13.5 → 0.14.0
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/dist/src/cluster/structs.d.ts +13 -0
- package/dist/src/cluster/structs.d.ts.map +1 -1
- package/dist/src/cohort-topic/addressing.d.ts +53 -0
- package/dist/src/cohort-topic/addressing.d.ts.map +1 -0
- package/dist/src/cohort-topic/addressing.js +95 -0
- package/dist/src/cohort-topic/addressing.js.map +1 -0
- package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.d.ts +105 -0
- package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.d.ts.map +1 -0
- package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.js +197 -0
- package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.js.map +1 -0
- package/dist/src/cohort-topic/antidos/bootstrap-evidence.d.ts +50 -0
- package/dist/src/cohort-topic/antidos/bootstrap-evidence.d.ts.map +1 -0
- package/dist/src/cohort-topic/antidos/bootstrap-evidence.js +62 -0
- package/dist/src/cohort-topic/antidos/bootstrap-evidence.js.map +1 -0
- package/dist/src/cohort-topic/antidos/index.d.ts +6 -0
- package/dist/src/cohort-topic/antidos/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/antidos/index.js +6 -0
- package/dist/src/cohort-topic/antidos/index.js.map +1 -0
- package/dist/src/cohort-topic/antidos/rate-limiter.d.ts +95 -0
- package/dist/src/cohort-topic/antidos/rate-limiter.d.ts.map +1 -0
- package/dist/src/cohort-topic/antidos/rate-limiter.js +146 -0
- package/dist/src/cohort-topic/antidos/rate-limiter.js.map +1 -0
- package/dist/src/cohort-topic/antidos/replay-guard.d.ts +37 -0
- package/dist/src/cohort-topic/antidos/replay-guard.d.ts.map +1 -0
- package/dist/src/cohort-topic/antidos/replay-guard.js +78 -0
- package/dist/src/cohort-topic/antidos/replay-guard.js.map +1 -0
- package/dist/src/cohort-topic/antidos/topic-budget.d.ts +50 -0
- package/dist/src/cohort-topic/antidos/topic-budget.d.ts.map +1 -0
- package/dist/src/cohort-topic/antidos/topic-budget.js +95 -0
- package/dist/src/cohort-topic/antidos/topic-budget.js.map +1 -0
- package/dist/src/cohort-topic/antiflood/index.d.ts +3 -0
- package/dist/src/cohort-topic/antiflood/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/antiflood/index.js +3 -0
- package/dist/src/cohort-topic/antiflood/index.js.map +1 -0
- package/dist/src/cohort-topic/antiflood/invariants.d.ts +70 -0
- package/dist/src/cohort-topic/antiflood/invariants.d.ts.map +1 -0
- package/dist/src/cohort-topic/antiflood/invariants.js +86 -0
- package/dist/src/cohort-topic/antiflood/invariants.js.map +1 -0
- package/dist/src/cohort-topic/antiflood/jitter.d.ts +65 -0
- package/dist/src/cohort-topic/antiflood/jitter.d.ts.map +1 -0
- package/dist/src/cohort-topic/antiflood/jitter.js +75 -0
- package/dist/src/cohort-topic/antiflood/jitter.js.map +1 -0
- package/dist/src/cohort-topic/coldstart.d.ts +117 -0
- package/dist/src/cohort-topic/coldstart.d.ts.map +1 -0
- package/dist/src/cohort-topic/coldstart.js +127 -0
- package/dist/src/cohort-topic/coldstart.js.map +1 -0
- package/dist/src/cohort-topic/dmax.d.ts +44 -0
- package/dist/src/cohort-topic/dmax.d.ts.map +1 -0
- package/dist/src/cohort-topic/dmax.js +70 -0
- package/dist/src/cohort-topic/dmax.js.map +1 -0
- package/dist/src/cohort-topic/gossip/bus.d.ts +85 -0
- package/dist/src/cohort-topic/gossip/bus.d.ts.map +1 -0
- package/dist/src/cohort-topic/gossip/bus.js +146 -0
- package/dist/src/cohort-topic/gossip/bus.js.map +1 -0
- package/dist/src/cohort-topic/gossip/index.d.ts +4 -0
- package/dist/src/cohort-topic/gossip/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/gossip/index.js +4 -0
- package/dist/src/cohort-topic/gossip/index.js.map +1 -0
- package/dist/src/cohort-topic/gossip/records.d.ts +12 -0
- package/dist/src/cohort-topic/gossip/records.d.ts.map +1 -0
- package/dist/src/cohort-topic/gossip/records.js +41 -0
- package/dist/src/cohort-topic/gossip/records.js.map +1 -0
- package/dist/src/cohort-topic/gossip/view.d.ts +39 -0
- package/dist/src/cohort-topic/gossip/view.d.ts.map +1 -0
- package/dist/src/cohort-topic/gossip/view.js +30 -0
- package/dist/src/cohort-topic/gossip/view.js.map +1 -0
- package/dist/src/cohort-topic/index.d.ts +21 -0
- package/dist/src/cohort-topic/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/index.js +21 -0
- package/dist/src/cohort-topic/index.js.map +1 -0
- package/dist/src/cohort-topic/load/barometer.d.ts +78 -0
- package/dist/src/cohort-topic/load/barometer.d.ts.map +1 -0
- package/dist/src/cohort-topic/load/barometer.js +93 -0
- package/dist/src/cohort-topic/load/barometer.js.map +1 -0
- package/dist/src/cohort-topic/load/index.d.ts +2 -0
- package/dist/src/cohort-topic/load/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/load/index.js +2 -0
- package/dist/src/cohort-topic/load/index.js.map +1 -0
- package/dist/src/cohort-topic/member-engine.d.ts +134 -0
- package/dist/src/cohort-topic/member-engine.d.ts.map +1 -0
- package/dist/src/cohort-topic/member-engine.js +264 -0
- package/dist/src/cohort-topic/member-engine.js.map +1 -0
- package/dist/src/cohort-topic/membership/index.d.ts +4 -0
- package/dist/src/cohort-topic/membership/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/membership/index.js +4 -0
- package/dist/src/cohort-topic/membership/index.js.map +1 -0
- package/dist/src/cohort-topic/membership/publisher.d.ts +82 -0
- package/dist/src/cohort-topic/membership/publisher.d.ts.map +1 -0
- package/dist/src/cohort-topic/membership/publisher.js +107 -0
- package/dist/src/cohort-topic/membership/publisher.js.map +1 -0
- package/dist/src/cohort-topic/membership/source.d.ts +31 -0
- package/dist/src/cohort-topic/membership/source.d.ts.map +1 -0
- package/dist/src/cohort-topic/membership/source.js +32 -0
- package/dist/src/cohort-topic/membership/source.js.map +1 -0
- package/dist/src/cohort-topic/membership/verifier.d.ts +96 -0
- package/dist/src/cohort-topic/membership/verifier.d.ts.map +1 -0
- package/dist/src/cohort-topic/membership/verifier.js +250 -0
- package/dist/src/cohort-topic/membership/verifier.js.map +1 -0
- package/dist/src/cohort-topic/ports.d.ts +149 -0
- package/dist/src/cohort-topic/ports.d.ts.map +1 -0
- package/dist/src/cohort-topic/ports.js +25 -0
- package/dist/src/cohort-topic/ports.js.map +1 -0
- package/dist/src/cohort-topic/promotion.d.ts +135 -0
- package/dist/src/cohort-topic/promotion.d.ts.map +1 -0
- package/dist/src/cohort-topic/promotion.js +269 -0
- package/dist/src/cohort-topic/promotion.js.map +1 -0
- package/dist/src/cohort-topic/registration/bytes.d.ts +16 -0
- package/dist/src/cohort-topic/registration/bytes.d.ts.map +1 -0
- package/dist/src/cohort-topic/registration/bytes.js +32 -0
- package/dist/src/cohort-topic/registration/bytes.js.map +1 -0
- package/dist/src/cohort-topic/registration/handoff.d.ts +69 -0
- package/dist/src/cohort-topic/registration/handoff.d.ts.map +1 -0
- package/dist/src/cohort-topic/registration/handoff.js +98 -0
- package/dist/src/cohort-topic/registration/handoff.js.map +1 -0
- package/dist/src/cohort-topic/registration/index.d.ts +7 -0
- package/dist/src/cohort-topic/registration/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/registration/index.js +7 -0
- package/dist/src/cohort-topic/registration/index.js.map +1 -0
- package/dist/src/cohort-topic/registration/renewal.d.ts +115 -0
- package/dist/src/cohort-topic/registration/renewal.d.ts.map +1 -0
- package/dist/src/cohort-topic/registration/renewal.js +306 -0
- package/dist/src/cohort-topic/registration/renewal.js.map +1 -0
- package/dist/src/cohort-topic/registration/sharding.d.ts +31 -0
- package/dist/src/cohort-topic/registration/sharding.d.ts.map +1 -0
- package/dist/src/cohort-topic/registration/sharding.js +48 -0
- package/dist/src/cohort-topic/registration/sharding.js.map +1 -0
- package/dist/src/cohort-topic/registration/store.d.ts +13 -0
- package/dist/src/cohort-topic/registration/store.d.ts.map +1 -0
- package/dist/src/cohort-topic/registration/store.js +72 -0
- package/dist/src/cohort-topic/registration/store.js.map +1 -0
- package/dist/src/cohort-topic/registration/types.d.ts +71 -0
- package/dist/src/cohort-topic/registration/types.d.ts.map +1 -0
- package/dist/src/cohort-topic/registration/types.js +27 -0
- package/dist/src/cohort-topic/registration/types.js.map +1 -0
- package/dist/src/cohort-topic/ring-hash.d.ts +27 -0
- package/dist/src/cohort-topic/ring-hash.d.ts.map +1 -0
- package/dist/src/cohort-topic/ring-hash.js +45 -0
- package/dist/src/cohort-topic/ring-hash.js.map +1 -0
- package/dist/src/cohort-topic/service.d.ts +157 -0
- package/dist/src/cohort-topic/service.d.ts.map +1 -0
- package/dist/src/cohort-topic/service.js +237 -0
- package/dist/src/cohort-topic/service.js.map +1 -0
- package/dist/src/cohort-topic/sig/index.d.ts +3 -0
- package/dist/src/cohort-topic/sig/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/sig/index.js +3 -0
- package/dist/src/cohort-topic/sig/index.js.map +1 -0
- package/dist/src/cohort-topic/sig/payloads.d.ts +25 -0
- package/dist/src/cohort-topic/sig/payloads.d.ts.map +1 -0
- package/dist/src/cohort-topic/sig/payloads.js +25 -0
- package/dist/src/cohort-topic/sig/payloads.js.map +1 -0
- package/dist/src/cohort-topic/sig/threshold.d.ts +33 -0
- package/dist/src/cohort-topic/sig/threshold.d.ts.map +1 -0
- package/dist/src/cohort-topic/sig/threshold.js +51 -0
- package/dist/src/cohort-topic/sig/threshold.js.map +1 -0
- package/dist/src/cohort-topic/tiers.d.ts +58 -0
- package/dist/src/cohort-topic/tiers.d.ts.map +1 -0
- package/dist/src/cohort-topic/tiers.js +49 -0
- package/dist/src/cohort-topic/tiers.js.map +1 -0
- package/dist/src/cohort-topic/traffic.d.ts +90 -0
- package/dist/src/cohort-topic/traffic.d.ts.map +1 -0
- package/dist/src/cohort-topic/traffic.js +146 -0
- package/dist/src/cohort-topic/traffic.js.map +1 -0
- package/dist/src/cohort-topic/walk.d.ts +123 -0
- package/dist/src/cohort-topic/walk.d.ts.map +1 -0
- package/dist/src/cohort-topic/walk.js +150 -0
- package/dist/src/cohort-topic/walk.js.map +1 -0
- package/dist/src/cohort-topic/willingness.d.ts +123 -0
- package/dist/src/cohort-topic/willingness.d.ts.map +1 -0
- package/dist/src/cohort-topic/willingness.js +143 -0
- package/dist/src/cohort-topic/willingness.js.map +1 -0
- package/dist/src/cohort-topic/wire/codec.d.ts +42 -0
- package/dist/src/cohort-topic/wire/codec.d.ts.map +1 -0
- package/dist/src/cohort-topic/wire/codec.js +163 -0
- package/dist/src/cohort-topic/wire/codec.js.map +1 -0
- package/dist/src/cohort-topic/wire/index.d.ts +6 -0
- package/dist/src/cohort-topic/wire/index.d.ts.map +1 -0
- package/dist/src/cohort-topic/wire/index.js +6 -0
- package/dist/src/cohort-topic/wire/index.js.map +1 -0
- package/dist/src/cohort-topic/wire/payloads.d.ts +38 -0
- package/dist/src/cohort-topic/wire/payloads.d.ts.map +1 -0
- package/dist/src/cohort-topic/wire/payloads.js +102 -0
- package/dist/src/cohort-topic/wire/payloads.js.map +1 -0
- package/dist/src/cohort-topic/wire/types.d.ts +304 -0
- package/dist/src/cohort-topic/wire/types.d.ts.map +1 -0
- package/dist/src/cohort-topic/wire/types.js +16 -0
- package/dist/src/cohort-topic/wire/types.js.map +1 -0
- package/dist/src/cohort-topic/wire/validate.d.ts +25 -0
- package/dist/src/cohort-topic/wire/validate.d.ts.map +1 -0
- package/dist/src/cohort-topic/wire/validate.js +427 -0
- package/dist/src/cohort-topic/wire/validate.js.map +1 -0
- package/dist/src/collection/collection.d.ts +58 -1
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +76 -0
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/collections/tree/tree.d.ts +58 -2
- package/dist/src/collections/tree/tree.d.ts.map +1 -1
- package/dist/src/collections/tree/tree.js +59 -2
- package/dist/src/collections/tree/tree.js.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/log/log.d.ts +42 -4
- package/dist/src/log/log.d.ts.map +1 -1
- package/dist/src/log/log.js +71 -3
- package/dist/src/log/log.js.map +1 -1
- package/dist/src/log/struct.d.ts +122 -2
- package/dist/src/log/struct.d.ts.map +1 -1
- package/dist/src/log/struct.js.map +1 -1
- package/dist/src/matchmaking/capability-filter.d.ts +24 -0
- package/dist/src/matchmaking/capability-filter.d.ts.map +1 -0
- package/dist/src/matchmaking/capability-filter.js +37 -0
- package/dist/src/matchmaking/capability-filter.js.map +1 -0
- package/dist/src/matchmaking/config.d.ts +77 -0
- package/dist/src/matchmaking/config.d.ts.map +1 -0
- package/dist/src/matchmaking/config.js +69 -0
- package/dist/src/matchmaking/config.js.map +1 -0
- package/dist/src/matchmaking/index.d.ts +21 -0
- package/dist/src/matchmaking/index.d.ts.map +1 -0
- package/dist/src/matchmaking/index.js +21 -0
- package/dist/src/matchmaking/index.js.map +1 -0
- package/dist/src/matchmaking/multi-cohort-seeker.d.ts +133 -0
- package/dist/src/matchmaking/multi-cohort-seeker.d.ts.map +1 -0
- package/dist/src/matchmaking/multi-cohort-seeker.js +142 -0
- package/dist/src/matchmaking/multi-cohort-seeker.js.map +1 -0
- package/dist/src/matchmaking/provider.d.ts +70 -0
- package/dist/src/matchmaking/provider.d.ts.map +1 -0
- package/dist/src/matchmaking/provider.js +93 -0
- package/dist/src/matchmaking/provider.js.map +1 -0
- package/dist/src/matchmaking/query-eval.d.ts +53 -0
- package/dist/src/matchmaking/query-eval.d.ts.map +1 -0
- package/dist/src/matchmaking/query-eval.js +69 -0
- package/dist/src/matchmaking/query-eval.js.map +1 -0
- package/dist/src/matchmaking/seeker-walk.d.ts +95 -0
- package/dist/src/matchmaking/seeker-walk.d.ts.map +1 -0
- package/dist/src/matchmaking/seeker-walk.js +75 -0
- package/dist/src/matchmaking/seeker-walk.js.map +1 -0
- package/dist/src/matchmaking/seeker.d.ts +51 -0
- package/dist/src/matchmaking/seeker.d.ts.map +1 -0
- package/dist/src/matchmaking/seeker.js +62 -0
- package/dist/src/matchmaking/seeker.js.map +1 -0
- package/dist/src/matchmaking/topic-anchor.d.ts +54 -0
- package/dist/src/matchmaking/topic-anchor.d.ts.map +1 -0
- package/dist/src/matchmaking/topic-anchor.js +67 -0
- package/dist/src/matchmaking/topic-anchor.js.map +1 -0
- package/dist/src/matchmaking/voting-quorum.d.ts +233 -0
- package/dist/src/matchmaking/voting-quorum.d.ts.map +1 -0
- package/dist/src/matchmaking/voting-quorum.js +238 -0
- package/dist/src/matchmaking/voting-quorum.js.map +1 -0
- package/dist/src/matchmaking/wire.d.ts +259 -0
- package/dist/src/matchmaking/wire.d.ts.map +1 -0
- package/dist/src/matchmaking/wire.js +484 -0
- package/dist/src/matchmaking/wire.js.map +1 -0
- package/dist/src/network/i-repo.d.ts +9 -0
- package/dist/src/network/i-repo.d.ts.map +1 -1
- package/dist/src/network/repo-protocol.d.ts +3 -1
- package/dist/src/network/repo-protocol.d.ts.map +1 -1
- package/dist/src/network/struct.d.ts +23 -1
- package/dist/src/network/struct.d.ts.map +1 -1
- package/dist/src/reactivity/backfill.d.ts +118 -0
- package/dist/src/reactivity/backfill.d.ts.map +1 -0
- package/dist/src/reactivity/backfill.js +137 -0
- package/dist/src/reactivity/backfill.js.map +1 -0
- package/dist/src/reactivity/backpressure.d.ts +99 -0
- package/dist/src/reactivity/backpressure.d.ts.map +1 -0
- package/dist/src/reactivity/backpressure.js +153 -0
- package/dist/src/reactivity/backpressure.js.map +1 -0
- package/dist/src/reactivity/checkpoint.d.ts +165 -0
- package/dist/src/reactivity/checkpoint.d.ts.map +1 -0
- package/dist/src/reactivity/checkpoint.js +232 -0
- package/dist/src/reactivity/checkpoint.js.map +1 -0
- package/dist/src/reactivity/config.d.ts +131 -0
- package/dist/src/reactivity/config.d.ts.map +1 -0
- package/dist/src/reactivity/config.js +135 -0
- package/dist/src/reactivity/config.js.map +1 -0
- package/dist/src/reactivity/dedupe.d.ts +51 -0
- package/dist/src/reactivity/dedupe.d.ts.map +1 -0
- package/dist/src/reactivity/dedupe.js +90 -0
- package/dist/src/reactivity/dedupe.js.map +1 -0
- package/dist/src/reactivity/forwarder.d.ts +50 -0
- package/dist/src/reactivity/forwarder.d.ts.map +1 -0
- package/dist/src/reactivity/forwarder.js +52 -0
- package/dist/src/reactivity/forwarder.js.map +1 -0
- package/dist/src/reactivity/index.d.ts +34 -0
- package/dist/src/reactivity/index.d.ts.map +1 -0
- package/dist/src/reactivity/index.js +34 -0
- package/dist/src/reactivity/index.js.map +1 -0
- package/dist/src/reactivity/notification.d.ts +72 -0
- package/dist/src/reactivity/notification.d.ts.map +1 -0
- package/dist/src/reactivity/notification.js +92 -0
- package/dist/src/reactivity/notification.js.map +1 -0
- package/dist/src/reactivity/policy.d.ts +59 -0
- package/dist/src/reactivity/policy.d.ts.map +1 -0
- package/dist/src/reactivity/policy.js +64 -0
- package/dist/src/reactivity/policy.js.map +1 -0
- package/dist/src/reactivity/push-state.d.ts +140 -0
- package/dist/src/reactivity/push-state.d.ts.map +1 -0
- package/dist/src/reactivity/push-state.js +270 -0
- package/dist/src/reactivity/push-state.js.map +1 -0
- package/dist/src/reactivity/recover.d.ts +75 -0
- package/dist/src/reactivity/recover.d.ts.map +1 -0
- package/dist/src/reactivity/recover.js +105 -0
- package/dist/src/reactivity/recover.js.map +1 -0
- package/dist/src/reactivity/replay-buffer.d.ts +57 -0
- package/dist/src/reactivity/replay-buffer.d.ts.map +1 -0
- package/dist/src/reactivity/replay-buffer.js +88 -0
- package/dist/src/reactivity/replay-buffer.js.map +1 -0
- package/dist/src/reactivity/resume.d.ts +214 -0
- package/dist/src/reactivity/resume.d.ts.map +1 -0
- package/dist/src/reactivity/resume.js +358 -0
- package/dist/src/reactivity/resume.js.map +1 -0
- package/dist/src/reactivity/rotation.d.ts +283 -0
- package/dist/src/reactivity/rotation.d.ts.map +1 -0
- package/dist/src/reactivity/rotation.js +265 -0
- package/dist/src/reactivity/rotation.js.map +1 -0
- package/dist/src/reactivity/subscriber.d.ts +66 -0
- package/dist/src/reactivity/subscriber.d.ts.map +1 -0
- package/dist/src/reactivity/subscriber.js +75 -0
- package/dist/src/reactivity/subscriber.js.map +1 -0
- package/dist/src/reactivity/subscription.d.ts +52 -0
- package/dist/src/reactivity/subscription.d.ts.map +1 -0
- package/dist/src/reactivity/subscription.js +28 -0
- package/dist/src/reactivity/subscription.js.map +1 -0
- package/dist/src/reactivity/topic-anchor.d.ts +46 -0
- package/dist/src/reactivity/topic-anchor.d.ts.map +1 -0
- package/dist/src/reactivity/topic-anchor.js +61 -0
- package/dist/src/reactivity/topic-anchor.js.map +1 -0
- package/dist/src/reactivity/verify.d.ts +41 -0
- package/dist/src/reactivity/verify.d.ts.map +1 -0
- package/dist/src/reactivity/verify.js +48 -0
- package/dist/src/reactivity/verify.js.map +1 -0
- package/dist/src/reactivity/wire-validate.d.ts +28 -0
- package/dist/src/reactivity/wire-validate.d.ts.map +1 -0
- package/dist/src/reactivity/wire-validate.js +79 -0
- package/dist/src/reactivity/wire-validate.js.map +1 -0
- package/dist/src/reactivity/wire.d.ts +102 -0
- package/dist/src/reactivity/wire.d.ts.map +1 -0
- package/dist/src/reactivity/wire.js +129 -0
- package/dist/src/reactivity/wire.js.map +1 -0
- package/dist/src/transaction/coordinator.d.ts +9 -5
- package/dist/src/transaction/coordinator.d.ts.map +1 -1
- package/dist/src/transaction/coordinator.js +48 -25
- package/dist/src/transaction/coordinator.js.map +1 -1
- package/dist/src/transactor/change-notifier.d.ts +74 -0
- package/dist/src/transactor/change-notifier.d.ts.map +1 -0
- package/dist/src/transactor/change-notifier.js +4 -0
- package/dist/src/transactor/change-notifier.js.map +1 -0
- package/dist/src/transactor/index.d.ts +1 -0
- package/dist/src/transactor/index.d.ts.map +1 -1
- package/dist/src/transactor/index.js +1 -0
- package/dist/src/transactor/index.js.map +1 -1
- package/dist/src/transactor/network-transactor.d.ts +34 -2
- package/dist/src/transactor/network-transactor.d.ts.map +1 -1
- package/dist/src/transactor/network-transactor.js +113 -13
- package/dist/src/transactor/network-transactor.js.map +1 -1
- package/package.json +2 -2
- package/src/cluster/structs.ts +13 -0
- package/src/cohort-topic/addressing.ts +112 -0
- package/src/cohort-topic/antidos/bootstrap-evidence-envelope.ts +253 -0
- package/src/cohort-topic/antidos/bootstrap-evidence.ts +94 -0
- package/src/cohort-topic/antidos/index.ts +5 -0
- package/src/cohort-topic/antidos/rate-limiter.ts +210 -0
- package/src/cohort-topic/antidos/replay-guard.ts +109 -0
- package/src/cohort-topic/antidos/topic-budget.ts +145 -0
- package/src/cohort-topic/antiflood/index.ts +2 -0
- package/src/cohort-topic/antiflood/invariants.ts +108 -0
- package/src/cohort-topic/antiflood/jitter.ts +117 -0
- package/src/cohort-topic/coldstart.ts +204 -0
- package/src/cohort-topic/dmax.ts +88 -0
- package/src/cohort-topic/gossip/bus.ts +217 -0
- package/src/cohort-topic/gossip/index.ts +3 -0
- package/src/cohort-topic/gossip/records.ts +45 -0
- package/src/cohort-topic/gossip/view.ts +66 -0
- package/src/cohort-topic/index.ts +20 -0
- package/src/cohort-topic/load/barometer.ts +134 -0
- package/src/cohort-topic/load/index.ts +1 -0
- package/src/cohort-topic/member-engine.ts +409 -0
- package/src/cohort-topic/membership/index.ts +3 -0
- package/src/cohort-topic/membership/publisher.ts +171 -0
- package/src/cohort-topic/membership/source.ts +41 -0
- package/src/cohort-topic/membership/verifier.ts +345 -0
- package/src/cohort-topic/ports.ts +157 -0
- package/src/cohort-topic/promotion.ts +384 -0
- package/src/cohort-topic/registration/bytes.ts +37 -0
- package/src/cohort-topic/registration/handoff.ts +154 -0
- package/src/cohort-topic/registration/index.ts +6 -0
- package/src/cohort-topic/registration/renewal.ts +423 -0
- package/src/cohort-topic/registration/sharding.ts +61 -0
- package/src/cohort-topic/registration/store.ts +81 -0
- package/src/cohort-topic/registration/types.ts +76 -0
- package/src/cohort-topic/ring-hash.ts +50 -0
- package/src/cohort-topic/service.ts +390 -0
- package/src/cohort-topic/sig/index.ts +2 -0
- package/src/cohort-topic/sig/payloads.ts +39 -0
- package/src/cohort-topic/sig/threshold.ts +64 -0
- package/src/cohort-topic/tiers.ts +74 -0
- package/src/cohort-topic/traffic.ts +211 -0
- package/src/cohort-topic/walk.ts +255 -0
- package/src/cohort-topic/willingness.ts +237 -0
- package/src/cohort-topic/wire/codec.ts +204 -0
- package/src/cohort-topic/wire/index.ts +16 -0
- package/src/cohort-topic/wire/payloads.ts +117 -0
- package/src/cohort-topic/wire/types.ts +343 -0
- package/src/cohort-topic/wire/validate.ts +478 -0
- package/src/collection/collection.ts +93 -1
- package/src/collections/tree/tree.ts +84 -3
- package/src/index.ts +3 -0
- package/src/log/log.ts +86 -7
- package/src/log/struct.ts +126 -2
- package/src/matchmaking/capability-filter.ts +45 -0
- package/src/matchmaking/config.ts +98 -0
- package/src/matchmaking/index.ts +21 -0
- package/src/matchmaking/multi-cohort-seeker.ts +234 -0
- package/src/matchmaking/provider.ts +123 -0
- package/src/matchmaking/query-eval.ts +105 -0
- package/src/matchmaking/seeker-walk.ts +127 -0
- package/src/matchmaking/seeker.ts +86 -0
- package/src/matchmaking/topic-anchor.ts +90 -0
- package/src/matchmaking/voting-quorum.ts +394 -0
- package/src/matchmaking/wire.ts +680 -0
- package/src/network/i-repo.ts +9 -0
- package/src/network/repo-protocol.ts +3 -2
- package/src/network/struct.ts +24 -1
- package/src/reactivity/backfill.ts +220 -0
- package/src/reactivity/backpressure.ts +191 -0
- package/src/reactivity/checkpoint.ts +308 -0
- package/src/reactivity/config.ts +172 -0
- package/src/reactivity/dedupe.ts +132 -0
- package/src/reactivity/forwarder.ts +87 -0
- package/src/reactivity/index.ts +34 -0
- package/src/reactivity/notification.ts +123 -0
- package/src/reactivity/policy.ts +79 -0
- package/src/reactivity/push-state.ts +343 -0
- package/src/reactivity/recover.ts +153 -0
- package/src/reactivity/replay-buffer.ts +141 -0
- package/src/reactivity/resume.ts +549 -0
- package/src/reactivity/rotation.ts +415 -0
- package/src/reactivity/subscriber.ts +132 -0
- package/src/reactivity/subscription.ts +66 -0
- package/src/reactivity/topic-anchor.ts +71 -0
- package/src/reactivity/verify.ts +73 -0
- package/src/reactivity/wire-validate.ts +87 -0
- package/src/reactivity/wire.ts +224 -0
- package/src/transaction/coordinator.ts +53 -27
- package/src/transactor/change-notifier.ts +80 -0
- package/src/transactor/index.ts +1 -0
- package/src/transactor/network-transactor.ts +133 -15
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cohort-topic substrate — byte-array helpers shared by the registration store, sharding, and
|
|
3
|
+
* handoff. Peer ids and topic ids are raw {@link Uint8Array}; these give them stable string map
|
|
4
|
+
* keys, value equality, and the ascending order the sharding hash relies on.
|
|
5
|
+
*/
|
|
6
|
+
import { compare as compareU8 } from "uint8arrays/compare";
|
|
7
|
+
import { equals as equalsU8 } from "uint8arrays/equals";
|
|
8
|
+
import { bytesToB64url } from "../wire/codec.js";
|
|
9
|
+
/** Stable, collision-free string map key for a byte array (base64url, the package's canonical form). */
|
|
10
|
+
export function bytesKey(b) {
|
|
11
|
+
return bytesToB64url(b);
|
|
12
|
+
}
|
|
13
|
+
/** Composite key for a registration, `topicKey|participantKey`. */
|
|
14
|
+
export function recordKey(topicId, participantId) {
|
|
15
|
+
return `${bytesKey(topicId)}|${bytesKey(participantId)}`;
|
|
16
|
+
}
|
|
17
|
+
/** Value equality over byte arrays. */
|
|
18
|
+
export function bytesEqual(a, b) {
|
|
19
|
+
return equalsU8(a, b);
|
|
20
|
+
}
|
|
21
|
+
/** Lexicographic byte order — the `sort(... by PeerId ascending)` of §Primary and backup sharding. */
|
|
22
|
+
export function compareBytes(a, b) {
|
|
23
|
+
return compareU8(a, b);
|
|
24
|
+
}
|
|
25
|
+
/** Concatenate two byte arrays into a fresh buffer (the `participantId ‖ cohortEpoch` hash input). */
|
|
26
|
+
export function concatBytes(a, b) {
|
|
27
|
+
const out = new Uint8Array(a.length + b.length);
|
|
28
|
+
out.set(a, 0);
|
|
29
|
+
out.set(b, a.length);
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../../src/cohort-topic/registration/bytes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wGAAwG;AACxG,MAAM,UAAU,QAAQ,CAAC,CAAa;IACrC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,OAAmB,EAAE,aAAyB;IACvE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,UAAU,CAAC,CAAa,EAAE,CAAa;IACtD,OAAO,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,YAAY,CAAC,CAAa,EAAE,CAAa;IACxD,OAAO,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,WAAW,CAAC,CAAa,EAAE,CAAa;IACvD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAChD,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACd,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cohort-topic substrate — membership-rotation primary handoff.
|
|
3
|
+
*
|
|
4
|
+
* Per `docs/cohort-topic.md` §Membership rotation and primary handoff. When membership changes the
|
|
5
|
+
* deterministic slot may move a registration's primary. Each member runs this state machine:
|
|
6
|
+
*
|
|
7
|
+
* 1. New membership stabilizes; all members compute the new `cohortEpoch`.
|
|
8
|
+
* 2. Members exchange a "primary inventory" listing the records they hold as primary ({@link start}).
|
|
9
|
+
* 3. For each record, the new computed primary either already holds it (no-op) or **pulls** it from
|
|
10
|
+
* the previous holder ({@link onInventory} → `transport.pull`).
|
|
11
|
+
* 4. **Resolved (GROUNDING):** the previous primary keeps serving (**dual-serve**) until the new
|
|
12
|
+
* primary acknowledges receipt ({@link onAck}) — closing the delivery gap.
|
|
13
|
+
* 5. Participants discover the new primary on their next ping/delivery (renewal module).
|
|
14
|
+
*
|
|
15
|
+
* The gossip *transport* for the inventory comes from a later ticket; it is injected here so the
|
|
16
|
+
* machine is unit-testable with a mock. The machine is purely cohort-local — FRET is unaware of it.
|
|
17
|
+
*/
|
|
18
|
+
import type { SlotAssigner } from "./sharding.js";
|
|
19
|
+
import type { RegistrationRecord, RegistrationStore } from "./types.js";
|
|
20
|
+
/** Identifies one registration in a {@link PrimaryInventory} or pull/ack exchange. */
|
|
21
|
+
export interface RecordRef {
|
|
22
|
+
topicId: Uint8Array;
|
|
23
|
+
participantId: Uint8Array;
|
|
24
|
+
}
|
|
25
|
+
/** A member's list of registrations it currently holds as primary, under the new `cohortEpoch`. */
|
|
26
|
+
export interface PrimaryInventory {
|
|
27
|
+
/** The advertising member. */
|
|
28
|
+
from: Uint8Array;
|
|
29
|
+
/** The new cohort epoch this inventory was computed under. */
|
|
30
|
+
epoch: Uint8Array;
|
|
31
|
+
entries: readonly RecordRef[];
|
|
32
|
+
}
|
|
33
|
+
/** Transport the handoff drives; supplied by the cohort-gossip ticket, mocked in tests. */
|
|
34
|
+
export interface HandoffTransport {
|
|
35
|
+
/** Broadcast this member's primary inventory to the cohort. */
|
|
36
|
+
sendInventory(inv: PrimaryInventory): void;
|
|
37
|
+
/** Pull a record this member is now primary for from its previous holder. */
|
|
38
|
+
pull(from: Uint8Array, ref: RecordRef): Promise<RegistrationRecord | undefined>;
|
|
39
|
+
/** Acknowledge receipt to the previous holder, ending its dual-serve for `ref`. */
|
|
40
|
+
ack(to: Uint8Array, ref: RecordRef): void;
|
|
41
|
+
}
|
|
42
|
+
export interface HandoffDeps {
|
|
43
|
+
store: RegistrationStore;
|
|
44
|
+
/** This member's own peer id. */
|
|
45
|
+
self: Uint8Array;
|
|
46
|
+
slots: SlotAssigner;
|
|
47
|
+
/** The new (post-rotation) cohort snapshot. */
|
|
48
|
+
cohort: () => {
|
|
49
|
+
members: readonly Uint8Array[];
|
|
50
|
+
cohortEpoch: Uint8Array;
|
|
51
|
+
};
|
|
52
|
+
transport: HandoffTransport;
|
|
53
|
+
}
|
|
54
|
+
/** Per-member primary-handoff driver. One instance handles one rotation. */
|
|
55
|
+
export interface MembershipHandoff {
|
|
56
|
+
/** Step 1+2: recompute under the new epoch, publish this member's inventory, mark hand-offs. */
|
|
57
|
+
start(): void;
|
|
58
|
+
/** Step 3: react to a peer's inventory — pull every record now assigned to this member, then ack. */
|
|
59
|
+
onInventory(inv: PrimaryInventory): Promise<void>;
|
|
60
|
+
/** Serve a pull from the new primary (this member is the previous holder); stays dual-serving. */
|
|
61
|
+
onPull(ref: RecordRef): RegistrationRecord | undefined;
|
|
62
|
+
/** New primary acked receipt: stop dual-serving `ref`. */
|
|
63
|
+
onAck(ref: RecordRef): void;
|
|
64
|
+
/** Whether this member should still answer renews for `(topicId, participantId)` right now. */
|
|
65
|
+
isServing(topicId: Uint8Array, participantId: Uint8Array): boolean;
|
|
66
|
+
}
|
|
67
|
+
/** Build a {@link MembershipHandoff} for one rotation. */
|
|
68
|
+
export declare function createMembershipHandoff(deps: HandoffDeps): MembershipHandoff;
|
|
69
|
+
//# sourceMappingURL=handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/registration/handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAExE,sFAAsF;AACtF,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,UAAU,CAAC;IACpB,aAAa,EAAE,UAAU,CAAC;CAC1B;AAED,mGAAmG;AACnG,MAAM,WAAW,gBAAgB;IAChC,8BAA8B;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,8DAA8D;IAC9D,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;CAC9B;AAED,2FAA2F;AAC3F,MAAM,WAAW,gBAAgB;IAChC,+DAA+D;IAC/D,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3C,6EAA6E;IAC7E,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;IAChF,mFAAmF;IACnF,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,iBAAiB,CAAC;IACzB,iCAAiC;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;IACpB,+CAA+C;IAC/C,MAAM,EAAE,MAAM;QAAE,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;QAAC,WAAW,EAAE,UAAU,CAAA;KAAE,CAAC;IAC1E,SAAS,EAAE,gBAAgB,CAAC;CAC5B;AAED,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IACjC,gGAAgG;IAChG,KAAK,IAAI,IAAI,CAAC;IACd,qGAAqG;IACrG,WAAW,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,kGAAkG;IAClG,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACvD,0DAA0D;IAC1D,KAAK,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,+FAA+F;IAC/F,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,GAAG,OAAO,CAAC;CACnE;AAiFD,0DAA0D;AAC1D,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW,GAAG,iBAAiB,CAE5E"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cohort-topic substrate — membership-rotation primary handoff.
|
|
3
|
+
*
|
|
4
|
+
* Per `docs/cohort-topic.md` §Membership rotation and primary handoff. When membership changes the
|
|
5
|
+
* deterministic slot may move a registration's primary. Each member runs this state machine:
|
|
6
|
+
*
|
|
7
|
+
* 1. New membership stabilizes; all members compute the new `cohortEpoch`.
|
|
8
|
+
* 2. Members exchange a "primary inventory" listing the records they hold as primary ({@link start}).
|
|
9
|
+
* 3. For each record, the new computed primary either already holds it (no-op) or **pulls** it from
|
|
10
|
+
* the previous holder ({@link onInventory} → `transport.pull`).
|
|
11
|
+
* 4. **Resolved (GROUNDING):** the previous primary keeps serving (**dual-serve**) until the new
|
|
12
|
+
* primary acknowledges receipt ({@link onAck}) — closing the delivery gap.
|
|
13
|
+
* 5. Participants discover the new primary on their next ping/delivery (renewal module).
|
|
14
|
+
*
|
|
15
|
+
* The gossip *transport* for the inventory comes from a later ticket; it is injected here so the
|
|
16
|
+
* machine is unit-testable with a mock. The machine is purely cohort-local — FRET is unaware of it.
|
|
17
|
+
*/
|
|
18
|
+
import { bytesEqual, recordKey } from "./bytes.js";
|
|
19
|
+
class StoreMembershipHandoff {
|
|
20
|
+
deps;
|
|
21
|
+
/** Records this member held as primary but no longer is — kept serving until acked. */
|
|
22
|
+
dualServing = new Set();
|
|
23
|
+
/** In-flight pulls, so a duplicate inventory does not pull twice. */
|
|
24
|
+
pulling = new Set();
|
|
25
|
+
constructor(deps) {
|
|
26
|
+
this.deps = deps;
|
|
27
|
+
}
|
|
28
|
+
start() {
|
|
29
|
+
const { members, cohortEpoch } = this.deps.cohort();
|
|
30
|
+
const entries = [];
|
|
31
|
+
for (const rec of this.deps.store.listAll()) {
|
|
32
|
+
if (!bytesEqual(rec.primary, this.deps.self)) {
|
|
33
|
+
continue; // only records this member currently holds as primary
|
|
34
|
+
}
|
|
35
|
+
entries.push({ topicId: rec.topicId, participantId: rec.participantId });
|
|
36
|
+
const { primary } = this.deps.slots.assignSlots(rec.participantId, cohortEpoch, members);
|
|
37
|
+
if (!bytesEqual(primary, this.deps.self)) {
|
|
38
|
+
// Primary moved away from this member: keep serving until the new primary acks.
|
|
39
|
+
this.dualServing.add(recordKey(rec.topicId, rec.participantId));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
this.deps.transport.sendInventory({ from: this.deps.self, epoch: cohortEpoch, entries });
|
|
43
|
+
}
|
|
44
|
+
async onInventory(inv) {
|
|
45
|
+
if (bytesEqual(inv.from, this.deps.self)) {
|
|
46
|
+
return; // ignore our own inventory
|
|
47
|
+
}
|
|
48
|
+
const { members, cohortEpoch } = this.deps.cohort();
|
|
49
|
+
for (const ref of inv.entries) {
|
|
50
|
+
await this.maybePull(inv.from, ref, members, cohortEpoch);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async maybePull(from, ref, members, cohortEpoch) {
|
|
54
|
+
const { primary, backups } = this.deps.slots.assignSlots(ref.participantId, cohortEpoch, members);
|
|
55
|
+
if (!bytesEqual(primary, this.deps.self)) {
|
|
56
|
+
return; // not assigned to this member now
|
|
57
|
+
}
|
|
58
|
+
if (this.deps.store.getByParticipant(ref.topicId, ref.participantId) !== undefined) {
|
|
59
|
+
return; // already hold it (no-op handoff)
|
|
60
|
+
}
|
|
61
|
+
const key = recordKey(ref.topicId, ref.participantId);
|
|
62
|
+
if (this.pulling.has(key)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.pulling.add(key);
|
|
66
|
+
try {
|
|
67
|
+
const rec = await this.deps.transport.pull(from, ref);
|
|
68
|
+
if (rec !== undefined) {
|
|
69
|
+
// Re-stamp the assignment so a later rotation's `start()` recognises this member as primary.
|
|
70
|
+
this.deps.store.put({ ...rec, primary, backups });
|
|
71
|
+
this.deps.transport.ack(from, ref); // ends dual-serve at the previous holder
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
this.pulling.delete(key);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
onPull(ref) {
|
|
79
|
+
// Previous holder serves the record; it remains in dualServing until the ack arrives.
|
|
80
|
+
return this.deps.store.getByParticipant(ref.topicId, ref.participantId);
|
|
81
|
+
}
|
|
82
|
+
onAck(ref) {
|
|
83
|
+
this.dualServing.delete(recordKey(ref.topicId, ref.participantId));
|
|
84
|
+
}
|
|
85
|
+
isServing(topicId, participantId) {
|
|
86
|
+
const { members, cohortEpoch } = this.deps.cohort();
|
|
87
|
+
const { primary } = this.deps.slots.assignSlots(participantId, cohortEpoch, members);
|
|
88
|
+
if (bytesEqual(primary, this.deps.self)) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return this.dualServing.has(recordKey(topicId, participantId));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** Build a {@link MembershipHandoff} for one rotation. */
|
|
95
|
+
export function createMembershipHandoff(deps) {
|
|
96
|
+
return new StoreMembershipHandoff(deps);
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=handoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../../../../src/cohort-topic/registration/handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAqDnD,MAAM,sBAAsB;IAME;IAL7B,uFAAuF;IACtE,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACjD,qEAAqE;IACpD,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAE7C,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK;QACJ,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACpD,MAAM,OAAO,GAAgB,EAAE,CAAC;QAChC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC9C,SAAS,CAAC,sDAAsD;YACjE,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;YACzE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;YACzF,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1C,gFAAgF;gBAChF,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAA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,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QACrF,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IAChE,CAAC;CACD;AAED,0DAA0D;AAC1D,MAAM,UAAU,uBAAuB,CAAC,IAAiB;IACxD,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/registration/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cohort-topic/registration/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cohort-topic substrate — TTL renewal and failover.
|
|
3
|
+
*
|
|
4
|
+
* Per `docs/cohort-topic.md` §TTL and renewal and §Failure modes:
|
|
5
|
+
*
|
|
6
|
+
* - Participant pings `primary` every `ttl/3`. Success → primary touches `lastPing` and gossips it.
|
|
7
|
+
* - Three consecutive ping failures → participant promotes `backups[0]` via a re-attach RPC: a renew
|
|
8
|
+
* carrying a **signed `reattach` flag** (no full re-registration). The backup accepts when it holds
|
|
9
|
+
* the record locally *and* is a computed backup under the current epoch — re-stamping `primary` to
|
|
10
|
+
* itself and serving subsequent plain pings via an epoch-scoped failover override (the unchanged
|
|
11
|
+
* `cohortEpoch` still names the dead node as the computed primary). A re-attach answered
|
|
12
|
+
* `primary_moved` means a real rotation moved primary to a live member: the participant adopts that
|
|
13
|
+
* payload instead of promoting the contacted backup (ignoring a reply that points back at the dead
|
|
14
|
+
* primary). **Resolved (GROUNDING):** the participant's `cohortEpoch` hint refreshes lazily — on the
|
|
15
|
+
* *next* ping/renewal after failover, not eagerly at failover time.
|
|
16
|
+
* - All of primary + backups fail → participant re-runs lookup from `d_max` (walk ticket, injected).
|
|
17
|
+
* - Cohort-side: evict where `now − lastPing > ttl`; eviction is gossiped so members converge.
|
|
18
|
+
*
|
|
19
|
+
* Both sides take their transport/gossip by injection so storage + sharding + TTL stay unit-testable
|
|
20
|
+
* in isolation; db-core never imports FRET or libp2p here.
|
|
21
|
+
*/
|
|
22
|
+
import type { RenewReplyV1, RenewV1 } from "../wire/types.js";
|
|
23
|
+
import type { SlotAssigner } from "./sharding.js";
|
|
24
|
+
import type { RegistrationRecord, RegistrationStore } from "./types.js";
|
|
25
|
+
/** Participant-side TTL renewal: periodic ping with 3-fail backup promotion. */
|
|
26
|
+
export interface RenewalParticipant {
|
|
27
|
+
/** Run one ping cycle: ping the current primary, count failures, promote/relookup as needed. */
|
|
28
|
+
pingLoop(): Promise<void>;
|
|
29
|
+
/** Re-attach to `target` (a backup), carrying the existing record; resolves with the reply. */
|
|
30
|
+
reattach(target: Uint8Array): Promise<RenewReplyV1>;
|
|
31
|
+
/**
|
|
32
|
+
* Best-effort remote tombstone: send a signed withdraw renew to the current primary so the cohort
|
|
33
|
+
* frees the registration immediately rather than holding it for a full TTL. Swallows any transport
|
|
34
|
+
* failure (TTL expiry remains the fallback) and does NOT touch the failure counters or trigger
|
|
35
|
+
* failover — withdraw is one-shot and fire-and-forget.
|
|
36
|
+
*/
|
|
37
|
+
withdraw(): Promise<void>;
|
|
38
|
+
/** `ttl/3` cadence the scheduler should call {@link pingLoop} at. */
|
|
39
|
+
readonly pingIntervalMs: number;
|
|
40
|
+
/** The participant's current view of its registration (primary/backups). */
|
|
41
|
+
readonly record: RegistrationRecord;
|
|
42
|
+
/**
|
|
43
|
+
* Cached cohort-epoch hint (subscriber-side `cohortHint`). Deliberately *not* refreshed at
|
|
44
|
+
* failover; a `primary_moved` reply on the next ping refreshes it lazily.
|
|
45
|
+
*/
|
|
46
|
+
readonly cohortEpochHint: Uint8Array | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** The unsigned body of a renew/re-attach RPC; the injected signer turns it into a {@link RenewV1}. */
|
|
49
|
+
export type UnsignedRenew = Omit<RenewV1, "signature">;
|
|
50
|
+
/** Transport the participant drives; supplied by db-p2p (FRET dial / RouteAndMaybeAct underneath). */
|
|
51
|
+
export interface RenewalParticipantTransport {
|
|
52
|
+
/** Send a renew/re-attach to `target`; resolves with the reply, rejects on RPC failure. */
|
|
53
|
+
send(target: Uint8Array, msg: RenewV1): Promise<RenewReplyV1>;
|
|
54
|
+
/** Primary + all backups unreachable: re-run lookup from `d_max` (walk ticket owns the body). */
|
|
55
|
+
relookup(): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export interface RenewalParticipantDeps {
|
|
58
|
+
transport: RenewalParticipantTransport;
|
|
59
|
+
/** Monotonic-ish wall clock in unix ms (injected for deterministic tests). */
|
|
60
|
+
clock: () => number;
|
|
61
|
+
/** Signs the renew body; db-p2p supplies the (async) peer-key signature. */
|
|
62
|
+
sign: (body: UnsignedRenew) => Promise<string>;
|
|
63
|
+
/** Correlation id matching the original RegisterV1, base64url. */
|
|
64
|
+
correlationId: string;
|
|
65
|
+
/** Initial cohort-epoch hint from the registration reply (refreshed lazily thereafter). */
|
|
66
|
+
initialCohortEpoch?: Uint8Array;
|
|
67
|
+
}
|
|
68
|
+
/** Build a {@link RenewalParticipant} around an initial record. */
|
|
69
|
+
export declare function createRenewalParticipant(initial: RegistrationRecord, deps: RenewalParticipantDeps): RenewalParticipant;
|
|
70
|
+
/** Emits cohort gossip so members converge on the active set after a touch or eviction. */
|
|
71
|
+
export interface RenewalGossip {
|
|
72
|
+
/** Gossip a `lastPing` touch for `rec`. */
|
|
73
|
+
touch(rec: RegistrationRecord): void;
|
|
74
|
+
/** Gossip an eviction for `rec`. */
|
|
75
|
+
evicted(rec: RegistrationRecord): void;
|
|
76
|
+
}
|
|
77
|
+
export interface RenewalCohortSideDeps {
|
|
78
|
+
store: RegistrationStore;
|
|
79
|
+
/** This member's own peer id. */
|
|
80
|
+
self: Uint8Array;
|
|
81
|
+
/** Deterministic slot assignment, shared with the handoff. */
|
|
82
|
+
slots: SlotAssigner;
|
|
83
|
+
/** Current cohort snapshot — db-p2p supplies it from the membership source. */
|
|
84
|
+
cohort: () => {
|
|
85
|
+
members: readonly Uint8Array[];
|
|
86
|
+
cohortEpoch: Uint8Array;
|
|
87
|
+
};
|
|
88
|
+
gossip: RenewalGossip;
|
|
89
|
+
/**
|
|
90
|
+
* Optional dual-serve predicate, wired to the rotation handoff's `isServing`. During a handoff
|
|
91
|
+
* the previous primary is no longer the computed primary but must keep serving until it is acked;
|
|
92
|
+
* when this returns `true` `onRenew` touches and serves instead of replying `primary_moved`.
|
|
93
|
+
*/
|
|
94
|
+
isServing?: (topicId: Uint8Array, participantId: Uint8Array) => boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Optional participant peer-key signature verifier (db-p2p binds it to the peer-sig primitive over
|
|
97
|
+
* {@link import("../wire/payloads.js").renewSigningPayload}). It gates the two privileged
|
|
98
|
+
* participant-attested paths: a `reattach` promotion and a `withdraw` eviction. A renew on either path
|
|
99
|
+
* whose signature does not verify against the claimed `participantId` must never act — a stray/MITM'd
|
|
100
|
+
* ping cannot usurp a live primary or evict someone else's registration (§TTL and renewal). Absent →
|
|
101
|
+
* the gate is skipped (unit tests run without peer crypto); plain pings are never verified here (they
|
|
102
|
+
* only touch `lastPing`).
|
|
103
|
+
*/
|
|
104
|
+
verifyParticipantSig?: (renew: RenewV1) => boolean;
|
|
105
|
+
}
|
|
106
|
+
/** Cohort-side TTL handling: touch on renew, redirect on rotation, sweep stale records. */
|
|
107
|
+
export interface RenewalCohortSide {
|
|
108
|
+
/** Handle an inbound renew. Touches the record, or replies `primary_moved` if this member is no longer primary. */
|
|
109
|
+
onRenew(msg: RenewV1, now: number): RenewReplyV1;
|
|
110
|
+
/** Evict every stale record and gossip each eviction; returns the evicted set. */
|
|
111
|
+
sweepStale(now: number): readonly RegistrationRecord[];
|
|
112
|
+
}
|
|
113
|
+
/** Build a {@link RenewalCohortSide}. */
|
|
114
|
+
export declare function createRenewalCohortSide(deps: RenewalCohortSideDeps): RenewalCohortSide;
|
|
115
|
+
//# sourceMappingURL=renewal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renewal.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/registration/renewal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIxE,gFAAgF;AAChF,MAAM,WAAW,kBAAkB;IAClC,gGAAgG;IAChG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,+FAA+F;IAC/F,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACpD;;;;;OAKG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAA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