@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,80 @@
|
|
|
1
|
+
import type { BlockId, CollectionId } from '../index.js';
|
|
2
|
+
import type { ActionId } from '../collection/action.js';
|
|
3
|
+
|
|
4
|
+
/** A commit landed on this node mutating one collection's blocks. */
|
|
5
|
+
export type CollectionChangeEvent = {
|
|
6
|
+
/** Header/collection id of the affected collection (block.header.collectionId). */
|
|
7
|
+
readonly collectionId: CollectionId;
|
|
8
|
+
/** Blocks within that collection mutated by this commit. */
|
|
9
|
+
readonly blockIds: readonly BlockId[];
|
|
10
|
+
readonly actionId: ActionId;
|
|
11
|
+
readonly rev: number;
|
|
12
|
+
/**
|
|
13
|
+
* The collection's chain tail block id at the time of this commit (the `CommitRequest.tailId`).
|
|
14
|
+
* Anchors the rotating reactivity topic `H(tailId ‖ "reactivity")`. Present on commit-driven
|
|
15
|
+
* events; `undefined` on read-driven promotions (the `StorageRepo.get` path has no commit tail —
|
|
16
|
+
* those never originate anyway, and are cert-gated out downstream).
|
|
17
|
+
*/
|
|
18
|
+
readonly tailId?: BlockId;
|
|
19
|
+
/**
|
|
20
|
+
* `true` iff this change event is a durable **invalidation** — a compensating revision + appended
|
|
21
|
+
* `InvalidationEntry` reversing a previously-committed action proven invalid by dispute
|
|
22
|
+
* (`docs/right-is-right.md` §Durable Invalidation), rather than an ordinary commit. An invalidation
|
|
23
|
+
* is a committed collection change like any other, so it flows through the same notification path;
|
|
24
|
+
* this flag lets a subscriber distinguish it (drop derived results + resubmit) from a plain commit
|
|
25
|
+
* (refresh). A hint only — correctness never depends on it: the subscriber always re-reads the
|
|
26
|
+
* authoritative reverted state. Absent (falsy) on ordinary commits.
|
|
27
|
+
*/
|
|
28
|
+
readonly invalidation?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* When {@link invalidation} is set, the `actionId` of the original committed action that was
|
|
31
|
+
* reversed (the `InvalidationEntry.invalidatedActionId`). Lets an invalidation-aware client
|
|
32
|
+
* dedup/coalesce multiple cascade notifications by the action they reverse, and resubmit exactly
|
|
33
|
+
* the affected work. Absent on ordinary commits.
|
|
34
|
+
*/
|
|
35
|
+
readonly invalidatedActionId?: ActionId;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type CollectionChangeListener = (event: CollectionChangeEvent) => void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The cluster-consensus commit certificate for a committed action — the **authoritative** proof
|
|
42
|
+
* that the cohort agreed the commit. It is the cross-package currency the local change-notifier
|
|
43
|
+
* bridge forwards into the cohort-topic substrate (`CohortTopicService.onLocalCommit`) so reactivity
|
|
44
|
+
* can originate notifications **without re-signing**: a notification's signature is bit-for-bit this
|
|
45
|
+
* `thresholdSig`. The bridge and every downstream consumer treat the bytes as opaque and pass them
|
|
46
|
+
* through unchanged — only the cluster layer that produced consensus ever mints one.
|
|
47
|
+
*
|
|
48
|
+
* Peer ids are carried as their string form (the cluster keys signatures by peer-id string); db-core
|
|
49
|
+
* stays cross-platform and never references a libp2p `PeerId` type here.
|
|
50
|
+
*/
|
|
51
|
+
export type CommitCert = {
|
|
52
|
+
/** Threshold signature bytes proving `signers` agreed the commit. Forwarded UNCHANGED; never re-signed. */
|
|
53
|
+
readonly thresholdSig: Uint8Array;
|
|
54
|
+
/** Peer-id strings whose signatures compose {@link thresholdSig} (a distinct set of size ≥ {@link minSigs}). */
|
|
55
|
+
readonly signers: readonly string[];
|
|
56
|
+
/** Threshold the signer set satisfies (the cluster super-majority / cohort `k − x`). */
|
|
57
|
+
readonly minSigs: number;
|
|
58
|
+
/**
|
|
59
|
+
* The exact byte preimage each `signers[i]` signed to produce its 64-byte chunk of
|
|
60
|
+
* {@link thresholdSig} — the cluster's per-member commit-vote payload `utf8(commitHash + ":approve")`,
|
|
61
|
+
* identical across all approving signers. Reactivity sets a notification's `digest` to
|
|
62
|
+
* base64url(signedPayload) so a subscriber's threshold-verify over `digest` reproduces the exact
|
|
63
|
+
* signed image. Opaque to db-core; minted only by the cluster layer.
|
|
64
|
+
*/
|
|
65
|
+
readonly signedPayload: Uint8Array;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export interface IBlockChangeNotifier {
|
|
69
|
+
/**
|
|
70
|
+
* Subscribe to commits that mutate the given collection. Returns an
|
|
71
|
+
* idempotent unsubscribe. Listeners are invoked AFTER the commit's critical
|
|
72
|
+
* section (locks released), synchronously in commit order; a throwing
|
|
73
|
+
* listener must not break the commit or other listeners (log + continue).
|
|
74
|
+
*/
|
|
75
|
+
onCollectionChange(collectionId: CollectionId, listener: CollectionChangeListener): () => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function isBlockChangeNotifier(x: unknown): x is IBlockChangeNotifier {
|
|
79
|
+
return !!x && typeof (x as IBlockChangeNotifier).onCollectionChange === 'function';
|
|
80
|
+
}
|
package/src/transactor/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { peerIdFromString } from "../network/types.js";
|
|
2
2
|
import type { PeerId } from "../network/types.js";
|
|
3
|
-
import type { ActionTransforms, ActionBlocks, BlockActionStatus, ITransactor, PendSuccess, StaleFailure, IKeyNetwork, BlockId, GetBlockResults, PendResult, CommitResult, PendRequest, IRepo, BlockGets, Transforms, CommitRequest, ActionId, RepoCommitRequest, ClusterNomineesResult } from "../index.js";
|
|
4
|
-
import {
|
|
3
|
+
import type { ActionTransforms, ActionBlocks, BlockActionStatus, ITransactor, PendSuccess, StaleFailure, IKeyNetwork, BlockId, GetBlockResults, PendResult, CommitResult, PendRequest, IRepo, BlockGets, Transforms, CommitRequest, ActionId, RepoCommitRequest, ClusterNomineesResult, CollectionId, IBlock } from "../index.js";
|
|
4
|
+
import type { IBlockChangeNotifier, CollectionChangeListener } from "./change-notifier.js";
|
|
5
|
+
import { transformForBlockId, groupBy, concatTransforms, concatTransform, transformsFromTransform, blockIdsForTransforms, Log, Tracker, CacheSource, TransactorSource } from "../index.js";
|
|
5
6
|
import { blockIdToBytes } from "../utility/block-id-to-bytes.js";
|
|
6
7
|
import { isRecordEmpty } from "../utility/is-record-empty.js";
|
|
7
8
|
import { type CoordinatorBatch, makeBatchesByPeer, incompleteBatches, everyBatch, allBatches, mergeBlocks, processBatches, createBatchesForPayload } from "../utility/batch-coordinator.js";
|
|
@@ -23,6 +24,14 @@ type NetworkTransactorInit = {
|
|
|
23
24
|
* Omit to fall back to a sensible default (3s); set 0 / negative to disable.
|
|
24
25
|
*/
|
|
25
26
|
dialTimeoutMs?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Optional local change-notifier (e.g. the hosting node's StorageRepo) used to
|
|
29
|
+
* satisfy {@link IBlockChangeNotifier}. When supplied, `onCollectionChange`
|
|
30
|
+
* delegates to it so consumers can feature-detect change notifications on the
|
|
31
|
+
* transactor they already hold rather than reaching into node internals. When
|
|
32
|
+
* absent, `onCollectionChange` is a logged no-op.
|
|
33
|
+
*/
|
|
34
|
+
localChangeNotifier?: IBlockChangeNotifier;
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
/**
|
|
@@ -34,12 +43,13 @@ type NetworkTransactorInit = {
|
|
|
34
43
|
*/
|
|
35
44
|
const DEFAULT_DIAL_TIMEOUT_MS = 3000;
|
|
36
45
|
|
|
37
|
-
export class NetworkTransactor implements ITransactor {
|
|
46
|
+
export class NetworkTransactor implements ITransactor, IBlockChangeNotifier {
|
|
38
47
|
private readonly keyNetwork: IKeyNetwork;
|
|
39
48
|
private readonly timeoutMs: number;
|
|
40
49
|
private readonly abortOrCancelTimeoutMs: number;
|
|
41
50
|
private readonly dialTimeoutMs: number | undefined;
|
|
42
51
|
private readonly getRepo: (peerId: PeerId) => IRepo;
|
|
52
|
+
private readonly localChangeNotifier: IBlockChangeNotifier | undefined;
|
|
43
53
|
|
|
44
54
|
constructor(
|
|
45
55
|
init: NetworkTransactorInit,
|
|
@@ -53,6 +63,21 @@ export class NetworkTransactor implements ITransactor {
|
|
|
53
63
|
? DEFAULT_DIAL_TIMEOUT_MS
|
|
54
64
|
: (init.dialTimeoutMs > 0 ? init.dialTimeoutMs : undefined);
|
|
55
65
|
this.getRepo = init.getRepo;
|
|
66
|
+
this.localChangeNotifier = init.localChangeNotifier;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Subscribe to commits landing on the local node for `collectionId`, delegating
|
|
71
|
+
* to the `localChangeNotifier` supplied at construction. When no notifier was
|
|
72
|
+
* supplied this is a no-op (returns an inert unsubscribe) — a NetworkTransactor
|
|
73
|
+
* with no co-located storage cannot observe commits locally.
|
|
74
|
+
*/
|
|
75
|
+
onCollectionChange(collectionId: CollectionId, listener: CollectionChangeListener): () => void {
|
|
76
|
+
if (!this.localChangeNotifier) {
|
|
77
|
+
log('onCollectionChange: no localChangeNotifier configured; subscription is a no-op for collection=%s', collectionId);
|
|
78
|
+
return () => { };
|
|
79
|
+
}
|
|
80
|
+
return this.localChangeNotifier.onCollectionChange(collectionId, listener);
|
|
56
81
|
}
|
|
57
82
|
|
|
58
83
|
async get(blockGets: BlockGets): Promise<GetBlockResults> {
|
|
@@ -188,7 +213,7 @@ export class NetworkTransactor implements ITransactor {
|
|
|
188
213
|
const blockStates = await this.get({ blockIds: allBlockIds });
|
|
189
214
|
|
|
190
215
|
// Determine status for each action ref
|
|
191
|
-
|
|
216
|
+
const results: BlockActionStatus[] = blockActions.map(ref => ({
|
|
192
217
|
...ref,
|
|
193
218
|
statuses: ref.blockIds.map(blockId => {
|
|
194
219
|
const result = blockStates[blockId];
|
|
@@ -202,12 +227,85 @@ export class NetworkTransactor implements ITransactor {
|
|
|
202
227
|
if (state.latest?.actionId === ref.actionId) {
|
|
203
228
|
return 'committed';
|
|
204
229
|
}
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
230
|
+
// Neither pending nor the latest committed. Block state alone calls this `aborted`, but a
|
|
231
|
+
// committed action that was later durably **invalidated** also presents this way — the
|
|
232
|
+
// compensating revision is now the block's latest, so the original action is no longer it.
|
|
233
|
+
// The `refineInvalidatedStatuses` pass below disambiguates from the authoritative log.
|
|
208
234
|
return 'aborted';
|
|
209
235
|
})
|
|
210
236
|
}));
|
|
237
|
+
|
|
238
|
+
// Authoritative `committed-invalidated` from durable state: consult each affected collection's
|
|
239
|
+
// log for an InvalidationEntry against the queried action (survives a node restart — the in-memory
|
|
240
|
+
// dispute map is only a fast cache; the log is the source of truth). Only `aborted` slots are
|
|
241
|
+
// ambiguous, so this is a no-op for ordinary pending/committed queries.
|
|
242
|
+
await this.refineInvalidatedStatuses(results, blockStates);
|
|
243
|
+
return results;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Refine the otherwise-`aborted` statuses to `committed-invalidated` for any queried action that has a
|
|
248
|
+
* durable {@link import("../log/struct.js").InvalidationEntry} against it. Reads the collection log via
|
|
249
|
+
* {@link Log.findInvalidation} — the durable, restart-surviving source of truth (`docs/right-is-right.md`
|
|
250
|
+
* §Durable Invalidation) — rather than the per-node, in-memory dispute map. A `pending` slot is left
|
|
251
|
+
* untouched: a still-pending transaction whose base was invalidated will be rejected on its own
|
|
252
|
+
* validation ("pending → will-be-rejected"), which is not the same as `committed-invalidated`.
|
|
253
|
+
*
|
|
254
|
+
* Best-effort and isolated: a log-open/read fault leaves the slot `aborted` (logged) rather than
|
|
255
|
+
* failing the whole status query. The per-call caches keep one log open and one lookup per
|
|
256
|
+
* `(collection, action)` even when many refs share a collection.
|
|
257
|
+
*/
|
|
258
|
+
private async refineInvalidatedStatuses(results: BlockActionStatus[], blockStates: GetBlockResults): Promise<void> {
|
|
259
|
+
const logByCollection = new Map<CollectionId, Log<unknown> | undefined>();
|
|
260
|
+
const invalidatedByKey = new Map<string, boolean>();
|
|
261
|
+
|
|
262
|
+
for (const ref of results) {
|
|
263
|
+
if (!ref.statuses.some(status => status === 'aborted')) {
|
|
264
|
+
continue; // no ambiguous slot — an invalidation could not change this ref's answer
|
|
265
|
+
}
|
|
266
|
+
const collectionId = collectionIdForRef(ref, blockStates);
|
|
267
|
+
if (collectionId === undefined) {
|
|
268
|
+
continue; // genuinely aborted: no fetched block to anchor a collection log on
|
|
269
|
+
}
|
|
270
|
+
const key = `${collectionId} ${ref.actionId}`;
|
|
271
|
+
let invalidated = invalidatedByKey.get(key);
|
|
272
|
+
if (invalidated === undefined) {
|
|
273
|
+
invalidated = await this.hasDurableInvalidation(collectionId, ref.actionId, logByCollection);
|
|
274
|
+
invalidatedByKey.set(key, invalidated);
|
|
275
|
+
}
|
|
276
|
+
if (!invalidated) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
for (let i = 0; i < ref.statuses.length; i++) {
|
|
280
|
+
if (ref.statuses[i] === 'aborted') {
|
|
281
|
+
ref.statuses[i] = 'committed-invalidated';
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Whether `actionId` has a durable invalidation entry in `collectionId`'s log (opened once, cached). */
|
|
288
|
+
private async hasDurableInvalidation(
|
|
289
|
+
collectionId: CollectionId,
|
|
290
|
+
actionId: ActionId,
|
|
291
|
+
logByCollection: Map<CollectionId, Log<unknown> | undefined>,
|
|
292
|
+
): Promise<boolean> {
|
|
293
|
+
try {
|
|
294
|
+
let collectionLog = logByCollection.get(collectionId);
|
|
295
|
+
if (!logByCollection.has(collectionId)) {
|
|
296
|
+
const source = new TransactorSource<IBlock>(collectionId, this, undefined);
|
|
297
|
+
const tracker = new Tracker<IBlock>(new CacheSource<IBlock>(source));
|
|
298
|
+
collectionLog = await Log.open<unknown>(tracker, collectionId);
|
|
299
|
+
logByCollection.set(collectionId, collectionLog);
|
|
300
|
+
}
|
|
301
|
+
if (!collectionLog) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
return (await collectionLog.findInvalidation(actionId)) !== undefined;
|
|
305
|
+
} catch (err) {
|
|
306
|
+
log('getStatus: durable invalidation lookup failed collection=%s action=%s: %o', collectionId, actionId, err);
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
211
309
|
}
|
|
212
310
|
|
|
213
311
|
private async consolidateCoordinators(
|
|
@@ -432,16 +530,20 @@ export class NetworkTransactor implements ITransactor {
|
|
|
432
530
|
log('commit actionId=%s rev=%d blockIds=%d', request.actionId, request.rev, request.blockIds.length);
|
|
433
531
|
const allBlockIds = [...new Set([...request.blockIds, request.tailId])];
|
|
434
532
|
|
|
435
|
-
// Commit the header block if provided and not already in blockIds
|
|
533
|
+
// Commit the header block if provided and not already in blockIds.
|
|
534
|
+
// `request.tailId` is threaded into every per-block commit so the coordinator carries it into the
|
|
535
|
+
// consensus commit op → each committing node's StorageRepo.commit stamps it onto the emitted
|
|
536
|
+
// CollectionChangeEvent (the reactivity topic anchor). Without this the per-block RepoCommitRequest
|
|
537
|
+
// drops the collection tail and reactivity origination is gated off (undefined tail → non-member).
|
|
436
538
|
if (request.headerId && !request.blockIds.includes(request.headerId)) {
|
|
437
|
-
const headerResult = await this.commitBlock(request.headerId, allBlockIds, request.actionId, request.rev);
|
|
539
|
+
const headerResult = await this.commitBlock(request.headerId, allBlockIds, request.actionId, request.rev, request.tailId);
|
|
438
540
|
if (!headerResult.success) {
|
|
439
541
|
return headerResult;
|
|
440
542
|
}
|
|
441
543
|
}
|
|
442
544
|
|
|
443
545
|
// Commit the tail block
|
|
444
|
-
const tailResult = await this.commitBlock(request.tailId, allBlockIds, request.actionId, request.rev);
|
|
546
|
+
const tailResult = await this.commitBlock(request.tailId, allBlockIds, request.actionId, request.rev, request.tailId);
|
|
445
547
|
if (!tailResult.success) {
|
|
446
548
|
return tailResult;
|
|
447
549
|
}
|
|
@@ -452,7 +554,7 @@ export class NetworkTransactor implements ITransactor {
|
|
|
452
554
|
!(request.headerId && bid === request.headerId && !request.blockIds.includes(request.headerId))
|
|
453
555
|
);
|
|
454
556
|
if (remainingBlocks.length > 0) {
|
|
455
|
-
const { error } = await this.commitBlocks({ blockIds: remainingBlocks, actionId: request.actionId, rev: request.rev });
|
|
557
|
+
const { error } = await this.commitBlocks({ blockIds: remainingBlocks, actionId: request.actionId, rev: request.rev, tailId: request.tailId });
|
|
456
558
|
if (error) {
|
|
457
559
|
// Non-tail block commit failures should not fail the overall action once the tail has committed.
|
|
458
560
|
// Proceed and rely on reconciliation paths (e.g. reads with context) to finalize state on lagging peers.
|
|
@@ -464,8 +566,8 @@ export class NetworkTransactor implements ITransactor {
|
|
|
464
566
|
return { success: true };
|
|
465
567
|
}
|
|
466
568
|
|
|
467
|
-
private async commitBlock(blockId: BlockId, blockIds: BlockId[], actionId: ActionId, rev: number): Promise<CommitResult> {
|
|
468
|
-
const { batches: tailBatches, error: tailError } = await this.commitBlocks({ blockIds: [blockId], actionId, rev });
|
|
569
|
+
private async commitBlock(blockId: BlockId, blockIds: BlockId[], actionId: ActionId, rev: number, tailId?: BlockId): Promise<CommitResult> {
|
|
570
|
+
const { batches: tailBatches, error: tailError } = await this.commitBlocks({ blockIds: [blockId], actionId, rev, tailId });
|
|
469
571
|
if (tailError) {
|
|
470
572
|
// Cancel all pending actions as background microtask
|
|
471
573
|
Promise.resolve().then(() => this.cancel({ blockIds, actionId }));
|
|
@@ -480,7 +582,7 @@ export class NetworkTransactor implements ITransactor {
|
|
|
480
582
|
}
|
|
481
583
|
|
|
482
584
|
/** Attempts to commit a set of blocks, and handles failures and errors */
|
|
483
|
-
private async commitBlocks({ blockIds, actionId, rev }: RepoCommitRequest) {
|
|
585
|
+
private async commitBlocks({ blockIds, actionId, rev, tailId }: RepoCommitRequest) {
|
|
484
586
|
const expiration = Date.now() + this.timeoutMs;
|
|
485
587
|
const batches = await this.batchesForPayload<BlockId[], CommitResult>(blockIds, blockIds, mergeBlocks, []);
|
|
486
588
|
log('commitBlocks actionId=%s rev=%d batches=%d', actionId, rev, batches.length);
|
|
@@ -488,7 +590,7 @@ export class NetworkTransactor implements ITransactor {
|
|
|
488
590
|
try {
|
|
489
591
|
await processBatches(
|
|
490
592
|
batches,
|
|
491
|
-
(batch) => this.getRepo(batch.peerId).commit({ actionId, blockIds: batch.payload, rev }, { expiration, dialTimeoutMs: this.dialTimeoutMs }),
|
|
593
|
+
(batch) => this.getRepo(batch.peerId).commit({ actionId, blockIds: batch.payload, rev, tailId }, { expiration, dialTimeoutMs: this.dialTimeoutMs }),
|
|
492
594
|
batch => batch.payload,
|
|
493
595
|
mergeBlocks,
|
|
494
596
|
expiration,
|
|
@@ -569,6 +671,22 @@ export class NetworkTransactor implements ITransactor {
|
|
|
569
671
|
}
|
|
570
672
|
|
|
571
673
|
|
|
674
|
+
/**
|
|
675
|
+
* The owning collection id for an action ref, read from any fetched block's header. A
|
|
676
|
+
* committed-then-invalidated action still has a materialized (compensating) block whose header carries
|
|
677
|
+
* the collection id; a genuinely-aborted action has no fetched block, so this returns `undefined` and
|
|
678
|
+
* the status stays `aborted`.
|
|
679
|
+
*/
|
|
680
|
+
function collectionIdForRef(ref: ActionBlocks, blockStates: GetBlockResults): CollectionId | undefined {
|
|
681
|
+
for (const blockId of ref.blockIds) {
|
|
682
|
+
const collectionId = blockStates[blockId]?.block?.header.collectionId;
|
|
683
|
+
if (collectionId !== undefined) {
|
|
684
|
+
return collectionId;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return undefined;
|
|
688
|
+
}
|
|
689
|
+
|
|
572
690
|
/** Returns a readable message for an unknown error value. */
|
|
573
691
|
function errorMessage(err: unknown): string {
|
|
574
692
|
if (err instanceof Error) return err.message;
|