@optimystic/db-core 0.13.5 → 0.14.1
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
package/dist/src/log/struct.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BlockId, CollectionId, ActionContext, ActionId, ActionRev } from "../index.js";
|
|
2
|
-
/** A log entry -
|
|
1
|
+
import type { BlockId, CollectionId, ActionContext, ActionId, ActionRev, ReadDependency } from "../index.js";
|
|
2
|
+
/** A log entry - an action, a checkpoint, or an invalidation */
|
|
3
3
|
export type LogEntry<TAction> = {
|
|
4
4
|
/** Linux timestamp of the entry */
|
|
5
5
|
readonly timestamp: number;
|
|
@@ -7,6 +7,8 @@ export type LogEntry<TAction> = {
|
|
|
7
7
|
readonly rev: number;
|
|
8
8
|
readonly action?: ActionEntry<TAction>;
|
|
9
9
|
readonly checkpoint?: CheckpointEntry;
|
|
10
|
+
/** A compensating entry that reverses a previously-committed action proven invalid by dispute. */
|
|
11
|
+
readonly invalidation?: InvalidationEntry;
|
|
10
12
|
};
|
|
11
13
|
/** An action entry represents a unit of work that is atomic */
|
|
12
14
|
export type ActionEntry<TAction> = {
|
|
@@ -18,6 +20,124 @@ export type ActionEntry<TAction> = {
|
|
|
18
20
|
blockIds: BlockId[];
|
|
19
21
|
/** Other collection ids affected by the action - this action is conditional on successful commit in all of these collections */
|
|
20
22
|
readonly collectionIds?: CollectionId[];
|
|
23
|
+
/**
|
|
24
|
+
* The `(blockId, revision)` reads this transaction observed during execution — the same
|
|
25
|
+
* read set the {@link Transaction} carried in its PEND request (see `Transaction.reads`).
|
|
26
|
+
*
|
|
27
|
+
* Persisted so a later invalidation cascade can discover this action's read-dependents:
|
|
28
|
+
* a committed action is a read-dependent of an invalidated one iff its read set contains a
|
|
29
|
+
* `(blockId, revision)` that the invalidated action produced.
|
|
30
|
+
*
|
|
31
|
+
* **Format / back-compat:** added by the invalidation-cascade work (ActionEntry v2). An entry
|
|
32
|
+
* written before this field existed (or by a path that does not carry a `Transaction`, e.g. the
|
|
33
|
+
* low-level `Collection.sync` direct-commit) has `reads === undefined` — treated by the cascade
|
|
34
|
+
* as an *unknown dependency* (conservatively re-evaluated, never silently assumed independent).
|
|
35
|
+
* `reads === []` is distinct: a transaction that genuinely read nothing.
|
|
36
|
+
*/
|
|
37
|
+
readonly reads?: ReadDependency[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* One arbitrator's signed verdict — the minimal subset of a dispute vote needed to re-verify
|
|
41
|
+
* it independently. The Ed25519 public key that verifies {@link signature} is embedded in
|
|
42
|
+
* {@link arbitratorPeerId} (a libp2p Ed25519 peer id).
|
|
43
|
+
*
|
|
44
|
+
* The signed payload is **target- and arbitrator-set-bound** (v3):
|
|
45
|
+
* `utf8(`v3:${disputeId}:${vote}:${computedHash}:${targetHash}:${setHash}`)`, where
|
|
46
|
+
* - `targetHash = hashString(`${messageHash}|${invalidatedActionId}|${sortedBlockIds.join(',')}`)`
|
|
47
|
+
* commits the vote to the *specific* transaction being reversed (#2), and
|
|
48
|
+
* - `setHash = hashString(sortedArbitratorSet.join(','))` commits it to the *legitimately-selected
|
|
49
|
+
* arbitrator set* (#1) carried on {@link DisputeResolutionProof.arbitratorSet}.
|
|
50
|
+
*
|
|
51
|
+
* A verifier recomputes both digests from the proof plus the apply-path target, so a genuine vote can
|
|
52
|
+
* neither be replayed against an unrelated transaction nor presented under a swapped cohort. v1/v2
|
|
53
|
+
* (un-set-bound) votes are rejected, not accepted-by-default; the {@link version} marker is required.
|
|
54
|
+
*/
|
|
55
|
+
export type ArbitrationVoteProof = {
|
|
56
|
+
/** Wire-format version of the signed payload. Only `'v3'` is accepted; absent/unrecognized → rejected. */
|
|
57
|
+
readonly version: 'v3';
|
|
58
|
+
/** Peer id of the arbitrator; its embedded Ed25519 public key verifies {@link signature}. */
|
|
59
|
+
readonly arbitratorPeerId: string;
|
|
60
|
+
/** The arbitrator's verdict. */
|
|
61
|
+
readonly vote: 'agree-with-challenger' | 'agree-with-majority' | 'inconclusive';
|
|
62
|
+
/** The operations hash the arbitrator computed (part of the signed payload). */
|
|
63
|
+
readonly computedHash: string;
|
|
64
|
+
/** Base64url-encoded Ed25519 signature over `v3:${disputeId}:${vote}:${computedHash}:${targetHash}:${setHash}`. */
|
|
65
|
+
readonly signature: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The authoritative, independently-verifiable subset of a dispute resolution that proves a
|
|
69
|
+
* committed transaction invalid. Carried inside an {@link InvalidationEntry}.
|
|
70
|
+
*
|
|
71
|
+
* Defined in db-core (the log layer) deliberately: the log must not import db-p2p, so the dispute
|
|
72
|
+
* layer's richer `DisputeResolution` maps *onto* this proof rather than this proof importing it.
|
|
73
|
+
* A member treats the proof as a reversal certificate — `outcome === 'challenger-wins'` with a
|
|
74
|
+
* 2/3 super-majority of decisive votes agreeing with the challenger (each signature verifiable
|
|
75
|
+
* against its arbitrator's embedded key, each vote target-bound, drawn from the legitimately-selected
|
|
76
|
+
* {@link arbitratorSet}, and counted at most once per arbitrator).
|
|
77
|
+
*
|
|
78
|
+
* **Unforgeability.** Votes are bound to the reversed transaction (`targetHash`, #2), counted at most
|
|
79
|
+
* once per arbitrator (#3), and bound to the legitimately-selected arbitrator set (#1):
|
|
80
|
+
* {@link arbitratorSet} carries the K peer-ids the challenger selected, every counted vote must be a
|
|
81
|
+
* member of it, and {@link arbitratorSetSignature} — the challenger's Ed25519 signature (verified
|
|
82
|
+
* against {@link challengerPeerId}) over `(disputeId, target, arbitratorSet)` — binds the set to the
|
|
83
|
+
* originator so a third-party relay cannot swap in its own sybils. A verifying member additionally
|
|
84
|
+
* re-derives the eligible set from its own topology when it can (an injected recompute capability),
|
|
85
|
+
* closing even a fully-malicious challenger; when it cannot (late-joiner / churned DHT view) it accepts
|
|
86
|
+
* on the challenger-bound set + membership + dedup and *logs* the residual topology-anchoring gap rather
|
|
87
|
+
* than silently accepting — a gap closed in full by the cohort-topic membership-cert trust-anchor chain
|
|
88
|
+
* (`tickets/plan/cohort-topic-membership-cert-trust-anchoring.md`). Net: a compromised peer can withhold
|
|
89
|
+
* an invalidation but cannot forge one.
|
|
90
|
+
*/
|
|
91
|
+
export type DisputeResolutionProof = {
|
|
92
|
+
/** Identifies the dispute these votes resolved. */
|
|
93
|
+
readonly disputeId: string;
|
|
94
|
+
/** messageHash of the original (now-invalid) committed transaction. */
|
|
95
|
+
readonly messageHash: string;
|
|
96
|
+
/** Resolution outcome; only `challenger-wins` authorizes an invalidation. */
|
|
97
|
+
readonly outcome: 'challenger-wins' | 'majority-wins' | 'inconclusive';
|
|
98
|
+
/**
|
|
99
|
+
* Peer-id of the challenger (dissent coordinator) that selected the arbitrator set and produced
|
|
100
|
+
* {@link arbitratorSetSignature}; its embedded Ed25519 key verifies that signature.
|
|
101
|
+
*/
|
|
102
|
+
readonly challengerPeerId: string;
|
|
103
|
+
/**
|
|
104
|
+
* The legitimately-selected arbitrator set — the K peer-ids the challenger computed via
|
|
105
|
+
* `selectArbitrators` (the next K peers beyond the original cluster by XOR distance to the disputed
|
|
106
|
+
* block). Every counted vote's `arbitratorPeerId` must be a member; the set is bound to the originator
|
|
107
|
+
* by {@link arbitratorSetSignature} and, when feasible, re-derived from the verifying member's topology.
|
|
108
|
+
*/
|
|
109
|
+
readonly arbitratorSet: ReadonlyArray<string>;
|
|
110
|
+
/**
|
|
111
|
+
* The challenger's base64url Ed25519 signature (verified against {@link challengerPeerId}'s embedded
|
|
112
|
+
* key) over `utf8(`v3set:${disputeId}:${targetHash}:${setHash}`)` — binds `(disputeId, target,
|
|
113
|
+
* arbitratorSet)` to the originator so a relay cannot substitute its own cohort. Tampering with
|
|
114
|
+
* {@link arbitratorSet} (e.g. adding sybils) invalidates this signature.
|
|
115
|
+
*/
|
|
116
|
+
readonly arbitratorSetSignature: string;
|
|
117
|
+
/** Signed arbitrator votes. */
|
|
118
|
+
readonly votes: ReadonlyArray<ArbitrationVoteProof>;
|
|
119
|
+
};
|
|
120
|
+
/** Per-block compensating result an invalidation produced. */
|
|
121
|
+
export type RevertedBlock = {
|
|
122
|
+
/** Block whose tip was reverted. */
|
|
123
|
+
readonly blockId: BlockId;
|
|
124
|
+
/** Revision the block was at before this invalidation (the tip that was reverted). */
|
|
125
|
+
readonly fromRev: number;
|
|
126
|
+
/** Content hash of the new revision restoring the as-if-`T_inv`-absent content. */
|
|
127
|
+
readonly restoredContentHash: string;
|
|
128
|
+
};
|
|
129
|
+
/** A compensating entry that reverses a previously-committed action proven invalid by dispute. */
|
|
130
|
+
export type InvalidationEntry = {
|
|
131
|
+
/** actionId of the committed {@link ActionEntry} being reversed. */
|
|
132
|
+
readonly invalidatedActionId: ActionId;
|
|
133
|
+
/** rev of the invalidated entry — pins which block revisions to roll back. */
|
|
134
|
+
readonly invalidatedRev: number;
|
|
135
|
+
/** Authoritative proof: a challenger-wins resolution carrying the signed arbitrator votes. */
|
|
136
|
+
readonly resolution: DisputeResolutionProof;
|
|
137
|
+
/** Per-block compensating result this entry produced (new monotonic revision restoring pre-`T_inv` content). */
|
|
138
|
+
readonly reverted: ReadonlyArray<RevertedBlock>;
|
|
139
|
+
/** When this invalidation is a cascade step, the root invalidation that triggered it (unused this ticket; see cascade ticket). */
|
|
140
|
+
readonly cascadeRoot?: ActionId;
|
|
21
141
|
};
|
|
22
142
|
/** A checkpoint entry restates the currently uncheckpointed actions */
|
|
23
143
|
export type CheckpointEntry = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../../../src/log/struct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE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;IAC5C,gHAAgH;IAChH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAChD,kIAAkI;IAClI,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;CAChC,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,eAAe,GAAG;IAC7B;;;qEAGiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AACtC,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC,MAAM,MAAM,aAAa,CAAC,OAAO,IAAI;IACpC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IACnC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;CAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"struct.js","sourceRoot":"","sources":["../../../src/log/struct.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"struct.js","sourceRoot":"","sources":["../../../src/log/struct.ts"],"names":[],"mappings":"AA6JA,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matchmaking — cohort-side capability-filter evaluation (db-core, pure).
|
|
3
|
+
*
|
|
4
|
+
* Per `docs/matchmaking.md` §Capability filter: the filter is evaluated **locally at the cohort** and
|
|
5
|
+
* is **advisory only** — it biases which providers the cohort returns but is never admission. The
|
|
6
|
+
* seeker re-validates the returned set (`registrationSig`) and escalates if the filter matches too
|
|
7
|
+
* little (§Edge cases 4). A pathological filter that matches almost nothing is therefore acceptable.
|
|
8
|
+
*
|
|
9
|
+
* Semantics (`docs/matchmaking.md` §Capability filter / §Wire formats):
|
|
10
|
+
* - `must` — every tag must be present in the provider's `capabilities`.
|
|
11
|
+
* - `mustNot` — no tag may be present in the provider's `capabilities`.
|
|
12
|
+
* - `minBudget` — when set, the provider's `capacityBudget` must be `>= minBudget`.
|
|
13
|
+
*
|
|
14
|
+
* An absent filter matches every provider.
|
|
15
|
+
*/
|
|
16
|
+
import type { CapabilityFilter } from "./wire.js";
|
|
17
|
+
/** The provider attributes a {@link CapabilityFilter} is evaluated against. */
|
|
18
|
+
export interface FilterableProvider {
|
|
19
|
+
readonly capabilities: readonly string[];
|
|
20
|
+
readonly capacityBudget: number;
|
|
21
|
+
}
|
|
22
|
+
/** True iff `p` satisfies `f` (`must` ⊆ caps, `mustNot` ∩ caps = ∅, `capacityBudget >= minBudget`). */
|
|
23
|
+
export declare function matchesFilter(p: FilterableProvider, f: CapabilityFilter | undefined): boolean;
|
|
24
|
+
//# sourceMappingURL=capability-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-filter.d.ts","sourceRoot":"","sources":["../../../src/matchmaking/capability-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,+EAA+E;AAC/E,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CAChC;AAED,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAmB7F"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matchmaking — cohort-side capability-filter evaluation (db-core, pure).
|
|
3
|
+
*
|
|
4
|
+
* Per `docs/matchmaking.md` §Capability filter: the filter is evaluated **locally at the cohort** and
|
|
5
|
+
* is **advisory only** — it biases which providers the cohort returns but is never admission. The
|
|
6
|
+
* seeker re-validates the returned set (`registrationSig`) and escalates if the filter matches too
|
|
7
|
+
* little (§Edge cases 4). A pathological filter that matches almost nothing is therefore acceptable.
|
|
8
|
+
*
|
|
9
|
+
* Semantics (`docs/matchmaking.md` §Capability filter / §Wire formats):
|
|
10
|
+
* - `must` — every tag must be present in the provider's `capabilities`.
|
|
11
|
+
* - `mustNot` — no tag may be present in the provider's `capabilities`.
|
|
12
|
+
* - `minBudget` — when set, the provider's `capacityBudget` must be `>= minBudget`.
|
|
13
|
+
*
|
|
14
|
+
* An absent filter matches every provider.
|
|
15
|
+
*/
|
|
16
|
+
/** True iff `p` satisfies `f` (`must` ⊆ caps, `mustNot` ∩ caps = ∅, `capacityBudget >= minBudget`). */
|
|
17
|
+
export function matchesFilter(p, f) {
|
|
18
|
+
if (f === undefined) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
const caps = new Set(p.capabilities);
|
|
22
|
+
for (const tag of f.must) {
|
|
23
|
+
if (!caps.has(tag)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
for (const tag of f.mustNot) {
|
|
28
|
+
if (caps.has(tag)) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (f.minBudget !== undefined && p.capacityBudget < f.minBudget) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=capability-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-filter.js","sourceRoot":"","sources":["../../../src/matchmaking/capability-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,uGAAuG;AACvG,MAAM,UAAU,aAAa,CAAC,CAAqB,EAAE,CAA+B;IACnF,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACrC,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;QACjE,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matchmaking — configuration defaults.
|
|
3
|
+
*
|
|
4
|
+
* Transcribed from `docs/matchmaking.md` §Configuration. This module owns the matchmaking config
|
|
5
|
+
* surface: the **wire/TTL** constants (provider/seeker TTLs, the query limit, the seeker renew grace,
|
|
6
|
+
* the aggregate-count minimum tier) AND the seeker **hang-out tuning** rows (`patience_*`,
|
|
7
|
+
* `filter_accept_ratio_initial`, `contention_factor_cap`, `requery_interval_ms`, `mean_want_count`)
|
|
8
|
+
* consumed by the {@link import("./seeker-walk.js").decide} engine and the db-p2p seeker-walk client.
|
|
9
|
+
*
|
|
10
|
+
* The TTL/limit constants are wire-stable and do **not** depend on simulator findings; the hang-out
|
|
11
|
+
* rows DO (folded via `fold-simulator-findings-into-design-docs`) — they carry the simulator-validated
|
|
12
|
+
* defaults (`contention_factor_cap = 4.0`, `mean_want_count = 3`, …; see `docs/matchmaking.md`
|
|
13
|
+
* §Configuration "Defaults validated by simulator"). The `push_*` rows belong to the arrival-push
|
|
14
|
+
* path (a separate slice) and are intentionally not modeled here.
|
|
15
|
+
*/
|
|
16
|
+
import type { NodeProfile } from "../cohort-topic/tiers.js";
|
|
17
|
+
/** Provider registration TTL on a Core node (ms). */
|
|
18
|
+
export declare const PROVIDER_TTL_CORE_MS = 90000;
|
|
19
|
+
/** Provider registration TTL on an Edge node (ms). */
|
|
20
|
+
export declare const PROVIDER_TTL_EDGE_MS = 60000;
|
|
21
|
+
/** Seeker registration TTL (ms) — short, since seekers normally don't wait long. */
|
|
22
|
+
export declare const SEEKER_TTL_MS = 10000;
|
|
23
|
+
/** Documented seeker-TTL range (ms); `SEEKER_TTL_MS` sits inside it. */
|
|
24
|
+
export declare const SEEKER_TTL_MIN_MS = 5000;
|
|
25
|
+
export declare const SEEKER_TTL_MAX_MS = 15000;
|
|
26
|
+
/** Max entries returned in a single `QueryV1` reply. */
|
|
27
|
+
export declare const QUERY_LIMIT_MAX = 256;
|
|
28
|
+
/** Grace window a seeker may keep querying after its TTL expires (ms). */
|
|
29
|
+
export declare const SEEKER_RENEW_GRACE_MS = 5000;
|
|
30
|
+
/** Root cohorts produce aggregate counts only when tree depth ≥ this. */
|
|
31
|
+
export declare const AGGREGATE_COUNT_MINIMUM_TIER = 1;
|
|
32
|
+
/** Fallback `patienceMs` when a caller does not specify it per-task (ms). */
|
|
33
|
+
export declare const PATIENCE_DEFAULT_MS = 10000;
|
|
34
|
+
/** Fraction of remaining patience spent at one tier before considering escalation (1.0 = spend it all here). */
|
|
35
|
+
export declare const PATIENCE_PER_TIER_FRACTION = 1;
|
|
36
|
+
/** Starting estimate for `filterAcceptRatio`, refined per walk from observed query yields. */
|
|
37
|
+
export declare const FILTER_ACCEPT_RATIO_INITIAL = 1;
|
|
38
|
+
/** Upper bound on the contention multiplier in the hang-out decision (simulator-validated global scalar). */
|
|
39
|
+
export declare const CONTENTION_FACTOR_CAP = 4;
|
|
40
|
+
/** Mean `wantCount` assumed for competing seekers in the contention estimate (small constant; simulator value). */
|
|
41
|
+
export declare const MEAN_WANT_COUNT_DEFAULT = 3;
|
|
42
|
+
/** How often a hanging-out seeker re-issues `QueryV1` on the non-push (poll) path (ms). */
|
|
43
|
+
export declare const REQUERY_INTERVAL_MS = 1000;
|
|
44
|
+
/** Window the seeker's primary batches fresh matchable arrivals before flushing one push (ms; arrival-push path). */
|
|
45
|
+
export declare const PUSH_COALESCE_MS = 250;
|
|
46
|
+
/** Sparse fallback `QueryV1` cadence for a push-aware hanging-out seeker (ms; arrival-push path). */
|
|
47
|
+
export declare const PUSH_SAFETY_POLL_MS = 5000;
|
|
48
|
+
/**
|
|
49
|
+
* The seeker hang-out decision tuning (`docs/matchmaking.md` §Hang-out vs. continue / §Configuration).
|
|
50
|
+
* `meanWantCount` lives here because {@link import("./seeker-walk.js").SeekerDecisionInputs} carries it
|
|
51
|
+
* per-call (it may be learned), but the default is this constant.
|
|
52
|
+
*/
|
|
53
|
+
export interface HangOutConfig {
|
|
54
|
+
/** Clamp on the contention multiplier; protects against pathological `queriesPerMin / arrivalsPerMin`. */
|
|
55
|
+
readonly contentionFactorCap: number;
|
|
56
|
+
/** Hang-out poll cadence on the non-push path. */
|
|
57
|
+
readonly requeryIntervalMs: number;
|
|
58
|
+
}
|
|
59
|
+
/** The default hang-out decision config (simulator-validated). */
|
|
60
|
+
export declare const DEFAULT_HANG_OUT_CONFIG: HangOutConfig;
|
|
61
|
+
/** The full matchmaking config, with the documented defaults. */
|
|
62
|
+
export interface MatchmakingConfig {
|
|
63
|
+
readonly providerTtlCoreMs: number;
|
|
64
|
+
readonly providerTtlEdgeMs: number;
|
|
65
|
+
readonly seekerTtlMs: number;
|
|
66
|
+
readonly queryLimitMax: number;
|
|
67
|
+
readonly seekerRenewGraceMs: number;
|
|
68
|
+
readonly aggregateCountMinimumTier: number;
|
|
69
|
+
}
|
|
70
|
+
/** The default matchmaking config (this ticket's slice). */
|
|
71
|
+
export declare const DEFAULT_MATCHMAKING_CONFIG: MatchmakingConfig;
|
|
72
|
+
/**
|
|
73
|
+
* Provider TTL for a node profile: Core nodes hold registrations for `PROVIDER_TTL_CORE_MS`, Edge
|
|
74
|
+
* nodes for the shorter `PROVIDER_TTL_EDGE_MS` (`docs/matchmaking.md` §Provider registration).
|
|
75
|
+
*/
|
|
76
|
+
export declare function providerTtlForProfile(profile: NodeProfile, config?: MatchmakingConfig): number;
|
|
77
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/matchmaking/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,sDAAsD;AACtD,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,oFAAoF;AACpF,eAAO,MAAM,aAAa,QAAS,CAAC;AACpC,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,OAAQ,CAAC;AACvC,eAAO,MAAM,iBAAiB,QAAS,CAAC;AACxC,wDAAwD;AACxD,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAC3C,yEAAyE;AACzE,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAI9C,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAC1C,gHAAgH;AAChH,eAAO,MAAM,0BAA0B,IAAM,CAAC;AAC9C,8FAA8F;AAC9F,eAAO,MAAM,2BAA2B,IAAM,CAAC;AAC/C,6GAA6G;AAC7G,eAAO,MAAM,qBAAqB,IAAM,CAAC;AACzC,mHAAmH;AACnH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,2FAA2F;AAC3F,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,qHAAqH;AACrH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AAEzC;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,0GAA0G;IAC1G,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,kDAAkD;IAClD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACnC;AAED,kEAAkE;AAClE,eAAO,MAAM,uBAAuB,EAAE,aAGrC,CAAC;AAEF,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,yBAAyB,EAAE,MAAM,CAAC;CAC3C;AAED,4DAA4D;AAC5D,eAAO,MAAM,0BAA0B,EAAE,iBAOxC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,GAAE,iBAA8C,GAAG,MAAM,CAE1H"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matchmaking — configuration defaults.
|
|
3
|
+
*
|
|
4
|
+
* Transcribed from `docs/matchmaking.md` §Configuration. This module owns the matchmaking config
|
|
5
|
+
* surface: the **wire/TTL** constants (provider/seeker TTLs, the query limit, the seeker renew grace,
|
|
6
|
+
* the aggregate-count minimum tier) AND the seeker **hang-out tuning** rows (`patience_*`,
|
|
7
|
+
* `filter_accept_ratio_initial`, `contention_factor_cap`, `requery_interval_ms`, `mean_want_count`)
|
|
8
|
+
* consumed by the {@link import("./seeker-walk.js").decide} engine and the db-p2p seeker-walk client.
|
|
9
|
+
*
|
|
10
|
+
* The TTL/limit constants are wire-stable and do **not** depend on simulator findings; the hang-out
|
|
11
|
+
* rows DO (folded via `fold-simulator-findings-into-design-docs`) — they carry the simulator-validated
|
|
12
|
+
* defaults (`contention_factor_cap = 4.0`, `mean_want_count = 3`, …; see `docs/matchmaking.md`
|
|
13
|
+
* §Configuration "Defaults validated by simulator"). The `push_*` rows belong to the arrival-push
|
|
14
|
+
* path (a separate slice) and are intentionally not modeled here.
|
|
15
|
+
*/
|
|
16
|
+
/** Provider registration TTL on a Core node (ms). */
|
|
17
|
+
export const PROVIDER_TTL_CORE_MS = 90_000;
|
|
18
|
+
/** Provider registration TTL on an Edge node (ms). */
|
|
19
|
+
export const PROVIDER_TTL_EDGE_MS = 60_000;
|
|
20
|
+
/** Seeker registration TTL (ms) — short, since seekers normally don't wait long. */
|
|
21
|
+
export const SEEKER_TTL_MS = 10_000;
|
|
22
|
+
/** Documented seeker-TTL range (ms); `SEEKER_TTL_MS` sits inside it. */
|
|
23
|
+
export const SEEKER_TTL_MIN_MS = 5_000;
|
|
24
|
+
export const SEEKER_TTL_MAX_MS = 15_000;
|
|
25
|
+
/** Max entries returned in a single `QueryV1` reply. */
|
|
26
|
+
export const QUERY_LIMIT_MAX = 256;
|
|
27
|
+
/** Grace window a seeker may keep querying after its TTL expires (ms). */
|
|
28
|
+
export const SEEKER_RENEW_GRACE_MS = 5_000;
|
|
29
|
+
/** Root cohorts produce aggregate counts only when tree depth ≥ this. */
|
|
30
|
+
export const AGGREGATE_COUNT_MINIMUM_TIER = 1;
|
|
31
|
+
// --- Seeker hang-out tuning (simulator-folded; consumed by seeker-walk.ts + the walk client) ---
|
|
32
|
+
/** Fallback `patienceMs` when a caller does not specify it per-task (ms). */
|
|
33
|
+
export const PATIENCE_DEFAULT_MS = 10_000;
|
|
34
|
+
/** Fraction of remaining patience spent at one tier before considering escalation (1.0 = spend it all here). */
|
|
35
|
+
export const PATIENCE_PER_TIER_FRACTION = 1.0;
|
|
36
|
+
/** Starting estimate for `filterAcceptRatio`, refined per walk from observed query yields. */
|
|
37
|
+
export const FILTER_ACCEPT_RATIO_INITIAL = 1.0;
|
|
38
|
+
/** Upper bound on the contention multiplier in the hang-out decision (simulator-validated global scalar). */
|
|
39
|
+
export const CONTENTION_FACTOR_CAP = 4.0;
|
|
40
|
+
/** Mean `wantCount` assumed for competing seekers in the contention estimate (small constant; simulator value). */
|
|
41
|
+
export const MEAN_WANT_COUNT_DEFAULT = 3;
|
|
42
|
+
/** How often a hanging-out seeker re-issues `QueryV1` on the non-push (poll) path (ms). */
|
|
43
|
+
export const REQUERY_INTERVAL_MS = 1_000;
|
|
44
|
+
/** Window the seeker's primary batches fresh matchable arrivals before flushing one push (ms; arrival-push path). */
|
|
45
|
+
export const PUSH_COALESCE_MS = 250;
|
|
46
|
+
/** Sparse fallback `QueryV1` cadence for a push-aware hanging-out seeker (ms; arrival-push path). */
|
|
47
|
+
export const PUSH_SAFETY_POLL_MS = 5_000;
|
|
48
|
+
/** The default hang-out decision config (simulator-validated). */
|
|
49
|
+
export const DEFAULT_HANG_OUT_CONFIG = {
|
|
50
|
+
contentionFactorCap: CONTENTION_FACTOR_CAP,
|
|
51
|
+
requeryIntervalMs: REQUERY_INTERVAL_MS,
|
|
52
|
+
};
|
|
53
|
+
/** The default matchmaking config (this ticket's slice). */
|
|
54
|
+
export const DEFAULT_MATCHMAKING_CONFIG = {
|
|
55
|
+
providerTtlCoreMs: PROVIDER_TTL_CORE_MS,
|
|
56
|
+
providerTtlEdgeMs: PROVIDER_TTL_EDGE_MS,
|
|
57
|
+
seekerTtlMs: SEEKER_TTL_MS,
|
|
58
|
+
queryLimitMax: QUERY_LIMIT_MAX,
|
|
59
|
+
seekerRenewGraceMs: SEEKER_RENEW_GRACE_MS,
|
|
60
|
+
aggregateCountMinimumTier: AGGREGATE_COUNT_MINIMUM_TIER,
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Provider TTL for a node profile: Core nodes hold registrations for `PROVIDER_TTL_CORE_MS`, Edge
|
|
64
|
+
* nodes for the shorter `PROVIDER_TTL_EDGE_MS` (`docs/matchmaking.md` §Provider registration).
|
|
65
|
+
*/
|
|
66
|
+
export function providerTtlForProfile(profile, config = DEFAULT_MATCHMAKING_CONFIG) {
|
|
67
|
+
return profile.kind === "edge" ? config.providerTtlEdgeMs : config.providerTtlCoreMs;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/matchmaking/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,qDAAqD;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC3C,sDAAsD;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC3C,oFAAoF;AACpF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AACpC,wEAAwE;AACxE,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC,wDAAwD;AACxD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AACnC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAC3C,yEAAyE;AACzE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAE9C,kGAAkG;AAElG,6EAA6E;AAC7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C,gHAAgH;AAChH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,8FAA8F;AAC9F,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAC/C,6GAA6G;AAC7G,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,mHAAmH;AACnH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AACzC,qHAAqH;AACrH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,qGAAqG;AACrG,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAczC,kEAAkE;AAClE,MAAM,CAAC,MAAM,uBAAuB,GAAkB;IACrD,mBAAmB,EAAE,qBAAqB;IAC1C,iBAAiB,EAAE,mBAAmB;CACtC,CAAC;AAYF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC5D,iBAAiB,EAAE,oBAAoB;IACvC,iBAAiB,EAAE,oBAAoB;IACvC,WAAW,EAAE,aAAa;IAC1B,aAAa,EAAE,eAAe;IAC9B,kBAAkB,EAAE,qBAAqB;IACzC,yBAAyB,EAAE,4BAA4B;CACvD,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAoB,EAAE,SAA4B,0BAA0B;IACjH,OAAO,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matchmaking — the directory application of the cohort-topic substrate.
|
|
3
|
+
*
|
|
4
|
+
* See `docs/matchmaking.md`. The db-core layer owns the transport-agnostic pieces: wire codecs +
|
|
5
|
+
* seeker-side entry re-validation, the stable topic-anchor derivation, configuration, both
|
|
6
|
+
* registration roles' decision/state (provider attach/renew/self-throttle; seeker short-TTL
|
|
7
|
+
* registration), the cohort-side capability filter + pure query evaluation, and the seeker
|
|
8
|
+
* hang-out-vs-continue decision engine. The db-p2p layer wires these to the cohort-topic substrate
|
|
9
|
+
* (managers, the cohort query handler, the seeker walk client).
|
|
10
|
+
*/
|
|
11
|
+
export * from "./config.js";
|
|
12
|
+
export * from "./topic-anchor.js";
|
|
13
|
+
export * from "./wire.js";
|
|
14
|
+
export * from "./provider.js";
|
|
15
|
+
export * from "./seeker.js";
|
|
16
|
+
export * from "./capability-filter.js";
|
|
17
|
+
export * from "./query-eval.js";
|
|
18
|
+
export * from "./seeker-walk.js";
|
|
19
|
+
export * from "./multi-cohort-seeker.js";
|
|
20
|
+
export * from "./voting-quorum.js";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/matchmaking/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matchmaking — the directory application of the cohort-topic substrate.
|
|
3
|
+
*
|
|
4
|
+
* See `docs/matchmaking.md`. The db-core layer owns the transport-agnostic pieces: wire codecs +
|
|
5
|
+
* seeker-side entry re-validation, the stable topic-anchor derivation, configuration, both
|
|
6
|
+
* registration roles' decision/state (provider attach/renew/self-throttle; seeker short-TTL
|
|
7
|
+
* registration), the cohort-side capability filter + pure query evaluation, and the seeker
|
|
8
|
+
* hang-out-vs-continue decision engine. The db-p2p layer wires these to the cohort-topic substrate
|
|
9
|
+
* (managers, the cohort query handler, the seeker walk client).
|
|
10
|
+
*/
|
|
11
|
+
export * from "./config.js";
|
|
12
|
+
export * from "./topic-anchor.js";
|
|
13
|
+
export * from "./wire.js";
|
|
14
|
+
export * from "./provider.js";
|
|
15
|
+
export * from "./seeker.js";
|
|
16
|
+
export * from "./capability-filter.js";
|
|
17
|
+
export * from "./query-eval.js";
|
|
18
|
+
export * from "./seeker-walk.js";
|
|
19
|
+
export * from "./multi-cohort-seeker.js";
|
|
20
|
+
export * from "./voting-quorum.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/matchmaking/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matchmaking — multi-cohort sweep (db-core, pure orchestration of the hot-topic representative sample).
|
|
3
|
+
*
|
|
4
|
+
* Per `docs/matchmaking.md` §Multi-cohort sweep. When a topic is hot enough that its providers live
|
|
5
|
+
* across many tier-`d >= 1` cohorts, a seeker that wants a *representative* cross-ring sample (rather
|
|
6
|
+
* than the prefix-biased single-cohort slice) does:
|
|
7
|
+
*
|
|
8
|
+
* 1. Registers at its natural tier as usual (the single-cohort {@link import("./seeker-walk.js").decide}
|
|
9
|
+
* walk — not this module).
|
|
10
|
+
* 2. Queries the **root** cohort, which returns an {@link AggregateCountV1}: log-bucketed provider counts
|
|
11
|
+
* per tier-1 prefix shard, **threshold-signed**. A cold root that fell through to `NoState` produces
|
|
12
|
+
* no aggregate (the producer gates on tree depth — see `db-p2p/matchmaking/aggregate-counts.ts`).
|
|
13
|
+
* 3. Selects the high-population tier-1 shards ({@link selectShards}) and queries them directly, unioning
|
|
14
|
+
* the returned providers into a deduped, re-validated set.
|
|
15
|
+
*
|
|
16
|
+
* This module is **pure**: the root-aggregate fetch, the per-shard query, and the optional threshold-sig
|
|
17
|
+
* verification are injected as a {@link MultiCohortSweepPorts} port (db-p2p binds them to the matchmaking
|
|
18
|
+
* query RPCs), exactly like the single-cohort walk splits pure `decide` (here) from the db-p2p walk
|
|
19
|
+
* client. The advisory trust model is preserved end-to-end: every shard entry is re-validated with
|
|
20
|
+
* {@link verifyProviderEntry} before it counts, so a lying shard primary buys nothing.
|
|
21
|
+
*
|
|
22
|
+
* The sweep costs more RPCs than the single-cohort sample and is reserved for representativeness-over-
|
|
23
|
+
* latency use cases (voting quorums, capability fairness audits); db-p2p binds it to the voting
|
|
24
|
+
* `QuorumDiscovery.sweep` port.
|
|
25
|
+
*/
|
|
26
|
+
import { type AggregateCountV1, type CapabilityFilter, type EntrySigVerifier, type ProviderEntryV1 } from "./wire.js";
|
|
27
|
+
/** The tier whose prefix shards the sweep ranges over (`docs/matchmaking.md` §Wire formats — typically 1). */
|
|
28
|
+
export declare const DEFAULT_SWEEP_TARGET_TIER = 1;
|
|
29
|
+
/** Fan-out ceiling: never query more than this many shards in one sweep (bounds RPC cost). */
|
|
30
|
+
export declare const DEFAULT_SWEEP_MAX_SHARDS = 16;
|
|
31
|
+
/**
|
|
32
|
+
* Multiplier on `wantCount` when accumulating bucketed shard populations. `1` because {@link logBucketCount}
|
|
33
|
+
* already rounds counts *down* — the true population is `>=` the reported sum, so the selection already
|
|
34
|
+
* over-provisions without an extra factor.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEFAULT_SWEEP_OVERPROVISION = 1;
|
|
37
|
+
/** One tier-1 prefix shard the sweep elected to query, with its (bucketed) reported population. */
|
|
38
|
+
export interface ShardSelection {
|
|
39
|
+
/** Prefix slot `0..F-1` identifying the tier-1 cohort. */
|
|
40
|
+
readonly prefixSlot: number;
|
|
41
|
+
/** The tier whose shard this is (typically 1). */
|
|
42
|
+
readonly targetTier: number;
|
|
43
|
+
/** The shard's log-bucketed reported provider count (rounds down — see {@link logBucketCount}). */
|
|
44
|
+
readonly bucketedCount: number;
|
|
45
|
+
}
|
|
46
|
+
/** Inputs to {@link selectShards}. */
|
|
47
|
+
export interface SelectShardsOptions {
|
|
48
|
+
/** Providers the seeker needs (drives how many shards are unioned). */
|
|
49
|
+
readonly wantCount: number;
|
|
50
|
+
/** Which `targetTier` buckets to consider. Default {@link DEFAULT_SWEEP_TARGET_TIER}. */
|
|
51
|
+
readonly targetTier?: number;
|
|
52
|
+
/** Fan-out ceiling. Default {@link DEFAULT_SWEEP_MAX_SHARDS}. */
|
|
53
|
+
readonly maxShards?: number;
|
|
54
|
+
/** Multiplier on `wantCount`. Default {@link DEFAULT_SWEEP_OVERPROVISION}. */
|
|
55
|
+
readonly overprovision?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Choose which tier-1 shards to query from an {@link AggregateCountV1}: the highest-population shards
|
|
59
|
+
* first (ties broken by ascending `prefixSlot` for determinism), accumulating bucketed counts until they
|
|
60
|
+
* cover `wantCount * overprovision`, capped at `maxShards`. Empty shards (`count === 0`) are skipped.
|
|
61
|
+
* Pure and deterministic.
|
|
62
|
+
*/
|
|
63
|
+
export declare function selectShards(aggregate: AggregateCountV1, opts: SelectShardsOptions): ShardSelection[];
|
|
64
|
+
/** Identifies one tier shard to query directly (db-p2p resolves it to `coord_d` and dials the cohort). */
|
|
65
|
+
export interface SweepShardQuery {
|
|
66
|
+
readonly prefixSlot: number;
|
|
67
|
+
readonly targetTier: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The transport seam the sweep drives, injected by db-p2p. `fetchAggregate` queries the root cohort
|
|
71
|
+
* (resolving `undefined` when the root is cold / unpromoted and returns no {@link AggregateCountV1});
|
|
72
|
+
* `queryShard` queries one elected tier-1 cohort; `verifyAggregate` (optional) threshold-verifies the
|
|
73
|
+
* aggregate before its counts are trusted.
|
|
74
|
+
*/
|
|
75
|
+
export interface MultiCohortSweepPorts {
|
|
76
|
+
/** Query the root cohort for the aggregate; `undefined` when the root produced none (cold / unpromoted). */
|
|
77
|
+
fetchAggregate(): Promise<AggregateCountV1 | undefined>;
|
|
78
|
+
/** Threshold-verify the aggregate (db-p2p binds the cohort crypto). Omitted → trusted unconditionally. */
|
|
79
|
+
verifyAggregate?(aggregate: AggregateCountV1): boolean;
|
|
80
|
+
/** Query one elected shard; returns its advisory provider entries (the sweep re-validates each). */
|
|
81
|
+
queryShard(shard: SweepShardQuery): Promise<readonly ProviderEntryV1[]>;
|
|
82
|
+
}
|
|
83
|
+
/** Inputs to {@link runMultiCohortSweep}. */
|
|
84
|
+
export interface MultiCohortSweepOptions {
|
|
85
|
+
/** The matchmaking topic id (used to re-validate each forwarded entry's `registrationSig`). */
|
|
86
|
+
readonly topicId: Uint8Array;
|
|
87
|
+
/** Providers the seeker needs (drives shard selection). */
|
|
88
|
+
readonly wantCount: number;
|
|
89
|
+
/** Per-entry signature verifier (db-p2p binds `verifyPeerSig`). */
|
|
90
|
+
readonly verifyEntry: EntrySigVerifier;
|
|
91
|
+
/** Optional capability filter, re-applied over every shard's returned set. */
|
|
92
|
+
readonly filter?: CapabilityFilter;
|
|
93
|
+
/** Which `targetTier` shards to range over. Default {@link DEFAULT_SWEEP_TARGET_TIER}. */
|
|
94
|
+
readonly targetTier?: number;
|
|
95
|
+
/** Fan-out ceiling. Default {@link DEFAULT_SWEEP_MAX_SHARDS}. */
|
|
96
|
+
readonly maxShards?: number;
|
|
97
|
+
/** Multiplier on `wantCount`. Default {@link DEFAULT_SWEEP_OVERPROVISION}. */
|
|
98
|
+
readonly overprovision?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Patience budget (ms) for the whole sweep; drains across the shard fan-out. Omitted ⇒ unbounded
|
|
101
|
+
* (query every selected shard, today's behaviour). Mirrors the walk leg's budget.
|
|
102
|
+
*/
|
|
103
|
+
readonly patienceMs?: number;
|
|
104
|
+
/** Wall clock (unix ms); injectable for tests. Default `Date.now`. Only consulted when `patienceMs` set. */
|
|
105
|
+
readonly clock?: () => number;
|
|
106
|
+
}
|
|
107
|
+
/** The assembled result of a multi-cohort sweep. */
|
|
108
|
+
export interface MultiCohortSweepResult {
|
|
109
|
+
/** The unioned, filtered, `registrationSig`-re-validated providers, deduped by `participantId`. */
|
|
110
|
+
readonly providers: ProviderEntryV1[];
|
|
111
|
+
/** The shards selected from the aggregate (empty when no aggregate / untrusted). */
|
|
112
|
+
readonly selectedShards: ShardSelection[];
|
|
113
|
+
/** How many shards were actually queried (== `selectedShards.length` on success). */
|
|
114
|
+
readonly shardsQueried: number;
|
|
115
|
+
/** Whether the root produced an aggregate at all (`false` for a cold / unpromoted root). */
|
|
116
|
+
readonly aggregateAvailable: boolean;
|
|
117
|
+
/** Whether the aggregate's threshold signature verified (`false` when absent or invalid). */
|
|
118
|
+
readonly aggregateTrusted: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Run the multi-cohort sweep (`docs/matchmaking.md` §Multi-cohort sweep): fetch the root aggregate,
|
|
122
|
+
* threshold-verify it, select high-population shards, query each, and union the deduped + re-validated
|
|
123
|
+
* providers. A cold root (no aggregate) or an aggregate that fails verification yields an empty set so
|
|
124
|
+
* the caller falls back to the single-cohort sample. Each shard entry is filtered and
|
|
125
|
+
* `registrationSig`-re-validated before it counts — the cohort vouches only for "the set I held".
|
|
126
|
+
*
|
|
127
|
+
* When `opts.patienceMs` is supplied, a wall-clock deadline is fixed at entry and the shard fan-out
|
|
128
|
+
* stops as soon as the budget drains — mirroring the walk leg's patience model. This is
|
|
129
|
+
* "stop starting new shard queries": an in-flight `queryShard` call is not cancelled mid-flight.
|
|
130
|
+
* When `opts.patienceMs` is absent, every elected shard is queried (today's behaviour).
|
|
131
|
+
*/
|
|
132
|
+
export declare function runMultiCohortSweep(ports: MultiCohortSweepPorts, opts: MultiCohortSweepOptions): Promise<MultiCohortSweepResult>;
|
|
133
|
+
//# sourceMappingURL=multi-cohort-seeker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-cohort-seeker.d.ts","source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