@earendil-works/chord 1.4.0 → 1.5.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/CHANGELOG.md +41 -0
- package/README.md +79 -14
- package/dist/cell.d.ts +7 -7
- package/dist/cell.d.ts.map +1 -1
- package/dist/cell.js.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/contract.d.ts +51 -52
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +19 -24
- package/dist/contract.js.map +1 -1
- package/dist/delta/apply-immutable-trusted.js +3 -4
- package/dist/delta/apply-immutable-trusted.js.map +1 -1
- package/dist/delta/diff.d.ts.map +1 -1
- package/dist/delta/diff.js +5 -3
- package/dist/delta/diff.js.map +1 -1
- package/dist/delta/index.d.ts +9 -1
- package/dist/delta/index.d.ts.map +1 -1
- package/dist/delta/index.js +15 -11
- package/dist/delta/index.js.map +1 -1
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/tracker.d.ts +12 -0
- package/dist/delta/tracker.d.ts.map +1 -1
- package/dist/delta/tracker.js +109 -39
- package/dist/delta/tracker.js.map +1 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +9 -7
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/next/contracts/accepts.d.ts +81 -0
- package/dist/next/contracts/accepts.d.ts.map +1 -0
- package/dist/next/contracts/accepts.js +123 -0
- package/dist/next/contracts/accepts.js.map +1 -0
- package/dist/next/contracts/contract.d.ts +121 -0
- package/dist/next/contracts/contract.d.ts.map +1 -0
- package/dist/next/contracts/contract.js +50 -0
- package/dist/next/contracts/contract.js.map +1 -0
- package/dist/next/contracts/declare.d.ts +107 -0
- package/dist/next/contracts/declare.d.ts.map +1 -0
- package/dist/next/contracts/declare.js +136 -0
- package/dist/next/contracts/declare.js.map +1 -0
- package/dist/next/contracts/evolve.d.ts +92 -0
- package/dist/next/contracts/evolve.d.ts.map +1 -0
- package/dist/next/contracts/evolve.js +179 -0
- package/dist/next/contracts/evolve.js.map +1 -0
- package/dist/next/contracts/fingerprint.d.ts +16 -0
- package/dist/next/contracts/fingerprint.d.ts.map +1 -0
- package/dist/next/contracts/fingerprint.js +50 -0
- package/dist/next/contracts/fingerprint.js.map +1 -0
- package/dist/next/contracts/history.d.ts +71 -0
- package/dist/next/contracts/history.d.ts.map +1 -0
- package/dist/next/contracts/history.js +3 -0
- package/dist/next/contracts/history.js.map +1 -0
- package/dist/next/contracts/host-kind.d.ts +40 -0
- package/dist/next/contracts/host-kind.d.ts.map +1 -0
- package/dist/next/contracts/host-kind.js +37 -0
- package/dist/next/contracts/host-kind.js.map +1 -0
- package/dist/next/contracts/index.d.ts +7 -0
- package/dist/next/contracts/index.d.ts.map +1 -0
- package/dist/next/contracts/index.js +6 -0
- package/dist/next/contracts/index.js.map +1 -0
- package/dist/next/contracts/internal.d.ts +10 -0
- package/dist/next/contracts/internal.d.ts.map +1 -0
- package/dist/next/contracts/internal.js +9 -0
- package/dist/next/contracts/internal.js.map +1 -0
- package/dist/next/contracts/names.d.ts +3 -0
- package/dist/next/contracts/names.d.ts.map +1 -0
- package/dist/next/contracts/names.js +13 -0
- package/dist/next/contracts/names.js.map +1 -0
- package/dist/next/contracts/params.d.ts +28 -0
- package/dist/next/contracts/params.d.ts.map +1 -0
- package/dist/next/contracts/params.js +50 -0
- package/dist/next/contracts/params.js.map +1 -0
- package/dist/next/contracts/schema.d.ts +102 -0
- package/dist/next/contracts/schema.d.ts.map +1 -0
- package/dist/next/contracts/schema.js +103 -0
- package/dist/next/contracts/schema.js.map +1 -0
- package/dist/next/contracts/snapshot.d.ts +16 -0
- package/dist/next/contracts/snapshot.d.ts.map +1 -0
- package/dist/next/contracts/snapshot.js +167 -0
- package/dist/next/contracts/snapshot.js.map +1 -0
- package/dist/next/data/args.d.ts +50 -0
- package/dist/next/data/args.d.ts.map +1 -0
- package/dist/next/data/args.js +83 -0
- package/dist/next/data/args.js.map +1 -0
- package/dist/next/data/errors.d.ts +73 -0
- package/dist/next/data/errors.d.ts.map +1 -0
- package/dist/next/data/errors.js +107 -0
- package/dist/next/data/errors.js.map +1 -0
- package/dist/next/data/failure.d.ts +26 -0
- package/dist/next/data/failure.d.ts.map +1 -0
- package/dist/next/data/failure.js +72 -0
- package/dist/next/data/failure.js.map +1 -0
- package/dist/next/data/index.d.ts +4 -0
- package/dist/next/data/index.d.ts.map +1 -0
- package/dist/next/data/index.js +4 -0
- package/dist/next/data/index.js.map +1 -0
- package/dist/next/data/internal.d.ts +7 -0
- package/dist/next/data/internal.d.ts.map +1 -0
- package/dist/next/data/internal.js +8 -0
- package/dist/next/data/internal.js.map +1 -0
- package/dist/next/data/params.d.ts +20 -0
- package/dist/next/data/params.d.ts.map +1 -0
- package/dist/next/data/params.js +31 -0
- package/dist/next/data/params.js.map +1 -0
- package/dist/next/data/principal.d.ts +17 -0
- package/dist/next/data/principal.d.ts.map +1 -0
- package/dist/next/data/principal.js +41 -0
- package/dist/next/data/principal.js.map +1 -0
- package/dist/next/data/validator.d.ts +12 -0
- package/dist/next/data/validator.d.ts.map +1 -0
- package/dist/next/data/validator.js +34 -0
- package/dist/next/data/validator.js.map +1 -0
- package/dist/next/documents/address-source.d.ts +20 -0
- package/dist/next/documents/address-source.d.ts.map +1 -0
- package/dist/next/documents/address-source.js +44 -0
- package/dist/next/documents/address-source.js.map +1 -0
- package/dist/next/documents/definition.d.ts +84 -0
- package/dist/next/documents/definition.d.ts.map +1 -0
- package/dist/next/documents/definition.js +73 -0
- package/dist/next/documents/definition.js.map +1 -0
- package/dist/next/documents/documents.d.ts +106 -0
- package/dist/next/documents/documents.d.ts.map +1 -0
- package/dist/next/documents/documents.js +224 -0
- package/dist/next/documents/documents.js.map +1 -0
- package/dist/next/documents/fence.d.ts +9 -0
- package/dist/next/documents/fence.d.ts.map +1 -0
- package/dist/next/documents/fence.js +15 -0
- package/dist/next/documents/fence.js.map +1 -0
- package/dist/next/documents/handles.d.ts +76 -0
- package/dist/next/documents/handles.d.ts.map +1 -0
- package/dist/next/documents/handles.js +66 -0
- package/dist/next/documents/handles.js.map +1 -0
- package/dist/next/documents/index.d.ts +4 -0
- package/dist/next/documents/index.d.ts.map +1 -0
- package/dist/next/documents/index.js +3 -0
- package/dist/next/documents/index.js.map +1 -0
- package/dist/next/documents/internal.d.ts +9 -0
- package/dist/next/documents/internal.d.ts.map +1 -0
- package/dist/next/documents/internal.js +9 -0
- package/dist/next/documents/internal.js.map +1 -0
- package/dist/next/documents/keyed-slot.d.ts +103 -0
- package/dist/next/documents/keyed-slot.d.ts.map +1 -0
- package/dist/next/documents/keyed-slot.js +395 -0
- package/dist/next/documents/keyed-slot.js.map +1 -0
- package/dist/next/documents/line.d.ts +7 -0
- package/dist/next/documents/line.d.ts.map +1 -0
- package/dist/next/documents/line.js +14 -0
- package/dist/next/documents/line.js.map +1 -0
- package/dist/next/documents/persistence.d.ts +104 -0
- package/dist/next/documents/persistence.d.ts.map +1 -0
- package/dist/next/documents/persistence.js +128 -0
- package/dist/next/documents/persistence.js.map +1 -0
- package/dist/next/documents/residency.d.ts +31 -0
- package/dist/next/documents/residency.d.ts.map +1 -0
- package/dist/next/documents/residency.js +93 -0
- package/dist/next/documents/residency.js.map +1 -0
- package/dist/next/documents/slot.d.ts +109 -0
- package/dist/next/documents/slot.d.ts.map +1 -0
- package/dist/next/documents/slot.js +181 -0
- package/dist/next/documents/slot.js.map +1 -0
- package/dist/next/documents/transaction.d.ts +133 -0
- package/dist/next/documents/transaction.d.ts.map +1 -0
- package/dist/next/documents/transaction.js +409 -0
- package/dist/next/documents/transaction.js.map +1 -0
- package/dist/next/host/activity.d.ts +31 -0
- package/dist/next/host/activity.d.ts.map +1 -0
- package/dist/next/host/activity.js +40 -0
- package/dist/next/host/activity.js.map +1 -0
- package/dist/next/host/adapted.d.ts +49 -0
- package/dist/next/host/adapted.d.ts.map +1 -0
- package/dist/next/host/adapted.js +214 -0
- package/dist/next/host/adapted.js.map +1 -0
- package/dist/next/host/attempt.d.ts +278 -0
- package/dist/next/host/attempt.d.ts.map +1 -0
- package/dist/next/host/attempt.js +1072 -0
- package/dist/next/host/attempt.js.map +1 -0
- package/dist/next/host/backoff.d.ts +29 -0
- package/dist/next/host/backoff.d.ts.map +1 -0
- package/dist/next/host/backoff.js +69 -0
- package/dist/next/host/backoff.js.map +1 -0
- package/dist/next/host/ctx.d.ts +47 -0
- package/dist/next/host/ctx.d.ts.map +1 -0
- package/dist/next/host/ctx.js +108 -0
- package/dist/next/host/ctx.js.map +1 -0
- package/dist/next/host/deadline.d.ts +12 -0
- package/dist/next/host/deadline.d.ts.map +1 -0
- package/dist/next/host/deadline.js +40 -0
- package/dist/next/host/deadline.js.map +1 -0
- package/dist/next/host/dependencies.d.ts +65 -0
- package/dist/next/host/dependencies.d.ts.map +1 -0
- package/dist/next/host/dependencies.js +115 -0
- package/dist/next/host/dependencies.js.map +1 -0
- package/dist/next/host/destination.d.ts +48 -0
- package/dist/next/host/destination.d.ts.map +1 -0
- package/dist/next/host/destination.js +101 -0
- package/dist/next/host/destination.js.map +1 -0
- package/dist/next/host/facet.d.ts +79 -0
- package/dist/next/host/facet.d.ts.map +1 -0
- package/dist/next/host/facet.js +55 -0
- package/dist/next/host/facet.js.map +1 -0
- package/dist/next/host/follow.d.ts +52 -0
- package/dist/next/host/follow.d.ts.map +1 -0
- package/dist/next/host/follow.js +207 -0
- package/dist/next/host/follow.js.map +1 -0
- package/dist/next/host/host.d.ts +495 -0
- package/dist/next/host/host.d.ts.map +1 -0
- package/dist/next/host/host.js +1075 -0
- package/dist/next/host/host.js.map +1 -0
- package/dist/next/host/index.d.ts +17 -0
- package/dist/next/host/index.d.ts.map +1 -0
- package/dist/next/host/index.js +6 -0
- package/dist/next/host/index.js.map +1 -0
- package/dist/next/host/internal.d.ts +10 -0
- package/dist/next/host/internal.d.ts.map +1 -0
- package/dist/next/host/internal.js +8 -0
- package/dist/next/host/internal.js.map +1 -0
- package/dist/next/host/members.d.ts +50 -0
- package/dist/next/host/members.d.ts.map +1 -0
- package/dist/next/host/members.js +107 -0
- package/dist/next/host/members.js.map +1 -0
- package/dist/next/host/native.d.ts +55 -0
- package/dist/next/host/native.d.ts.map +1 -0
- package/dist/next/host/native.js +92 -0
- package/dist/next/host/native.js.map +1 -0
- package/dist/next/host/object.d.ts +290 -0
- package/dist/next/host/object.d.ts.map +1 -0
- package/dist/next/host/object.js +1127 -0
- package/dist/next/host/object.js.map +1 -0
- package/dist/next/host/parked.d.ts +23 -0
- package/dist/next/host/parked.d.ts.map +1 -0
- package/dist/next/host/parked.js +79 -0
- package/dist/next/host/parked.js.map +1 -0
- package/dist/next/host/presence.d.ts +34 -0
- package/dist/next/host/presence.d.ts.map +1 -0
- package/dist/next/host/presence.js +117 -0
- package/dist/next/host/presence.js.map +1 -0
- package/dist/next/host/ref-state.d.ts +53 -0
- package/dist/next/host/ref-state.d.ts.map +1 -0
- package/dist/next/host/ref-state.js +83 -0
- package/dist/next/host/ref-state.js.map +1 -0
- package/dist/next/host/reference-keys.d.ts +36 -0
- package/dist/next/host/reference-keys.d.ts.map +1 -0
- package/dist/next/host/reference-keys.js +168 -0
- package/dist/next/host/reference-keys.js.map +1 -0
- package/dist/next/host/reference-source.d.ts +65 -0
- package/dist/next/host/reference-source.d.ts.map +1 -0
- package/dist/next/host/reference-source.js +285 -0
- package/dist/next/host/reference-source.js.map +1 -0
- package/dist/next/host/reference.d.ts +308 -0
- package/dist/next/host/reference.d.ts.map +1 -0
- package/dist/next/host/reference.js +775 -0
- package/dist/next/host/reference.js.map +1 -0
- package/dist/next/host/retry-on.d.ts +28 -0
- package/dist/next/host/retry-on.d.ts.map +1 -0
- package/dist/next/host/retry-on.js +52 -0
- package/dist/next/host/retry-on.js.map +1 -0
- package/dist/next/host/revocation.d.ts +16 -0
- package/dist/next/host/revocation.d.ts.map +1 -0
- package/dist/next/host/revocation.js +27 -0
- package/dist/next/host/revocation.js.map +1 -0
- package/dist/next/host/root.d.ts +27 -0
- package/dist/next/host/root.d.ts.map +1 -0
- package/dist/next/host/root.js +68 -0
- package/dist/next/host/root.js.map +1 -0
- package/dist/next/host/route.d.ts +64 -0
- package/dist/next/host/route.d.ts.map +1 -0
- package/dist/next/host/route.js +190 -0
- package/dist/next/host/route.js.map +1 -0
- package/dist/next/host/routines.d.ts +76 -0
- package/dist/next/host/routines.d.ts.map +1 -0
- package/dist/next/host/routines.js +350 -0
- package/dist/next/host/routines.js.map +1 -0
- package/dist/next/host/sleep.d.ts +9 -0
- package/dist/next/host/sleep.d.ts.map +1 -0
- package/dist/next/host/sleep.js +40 -0
- package/dist/next/host/sleep.js.map +1 -0
- package/dist/next/host/staging.d.ts +94 -0
- package/dist/next/host/staging.d.ts.map +1 -0
- package/dist/next/host/staging.js +302 -0
- package/dist/next/host/staging.js.map +1 -0
- package/dist/next/host/unbound.d.ts +30 -0
- package/dist/next/host/unbound.d.ts.map +1 -0
- package/dist/next/host/unbound.js +67 -0
- package/dist/next/host/unbound.js.map +1 -0
- package/dist/next/host/uuid.d.ts +3 -0
- package/dist/next/host/uuid.d.ts.map +1 -0
- package/dist/next/host/uuid.js +38 -0
- package/dist/next/host/uuid.js.map +1 -0
- package/dist/next/index.d.ts +28 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +18 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/jobs/definition.d.ts +96 -0
- package/dist/next/jobs/definition.d.ts.map +1 -0
- package/dist/next/jobs/definition.js +83 -0
- package/dist/next/jobs/definition.js.map +1 -0
- package/dist/next/jobs/index.d.ts +5 -0
- package/dist/next/jobs/index.d.ts.map +1 -0
- package/dist/next/jobs/index.js +3 -0
- package/dist/next/jobs/index.js.map +1 -0
- package/dist/next/jobs/internal.d.ts +3 -0
- package/dist/next/jobs/internal.d.ts.map +1 -0
- package/dist/next/jobs/internal.js +4 -0
- package/dist/next/jobs/internal.js.map +1 -0
- package/dist/next/jobs/job.d.ts +152 -0
- package/dist/next/jobs/job.d.ts.map +1 -0
- package/dist/next/jobs/job.js +320 -0
- package/dist/next/jobs/job.js.map +1 -0
- package/dist/next/jobs/persisted.d.ts +38 -0
- package/dist/next/jobs/persisted.d.ts.map +1 -0
- package/dist/next/jobs/persisted.js +95 -0
- package/dist/next/jobs/persisted.js.map +1 -0
- package/dist/next/jobs/records.d.ts +231 -0
- package/dist/next/jobs/records.d.ts.map +1 -0
- package/dist/next/jobs/records.js +869 -0
- package/dist/next/jobs/records.js.map +1 -0
- package/dist/next/jobs/run-states.d.ts +69 -0
- package/dist/next/jobs/run-states.d.ts.map +1 -0
- package/dist/next/jobs/run-states.js +228 -0
- package/dist/next/jobs/run-states.js.map +1 -0
- package/dist/next/jobs/run.d.ts +113 -0
- package/dist/next/jobs/run.d.ts.map +1 -0
- package/dist/next/jobs/run.js +200 -0
- package/dist/next/jobs/run.js.map +1 -0
- package/dist/next/jobs/running.d.ts +44 -0
- package/dist/next/jobs/running.d.ts.map +1 -0
- package/dist/next/jobs/running.js +117 -0
- package/dist/next/jobs/running.js.map +1 -0
- package/dist/next/jobs/stored.d.ts +63 -0
- package/dist/next/jobs/stored.d.ts.map +1 -0
- package/dist/next/jobs/stored.js +55 -0
- package/dist/next/jobs/stored.js.map +1 -0
- package/dist/next/link/binary.d.ts +4 -0
- package/dist/next/link/binary.d.ts.map +1 -0
- package/dist/next/link/binary.js +534 -0
- package/dist/next/link/binary.js.map +1 -0
- package/dist/next/link/channel.d.ts +63 -0
- package/dist/next/link/channel.d.ts.map +1 -0
- package/dist/next/link/channel.js +202 -0
- package/dist/next/link/channel.js.map +1 -0
- package/dist/next/link/errors.d.ts +7 -0
- package/dist/next/link/errors.d.ts.map +1 -0
- package/dist/next/link/errors.js +21 -0
- package/dist/next/link/errors.js.map +1 -0
- package/dist/next/link/index.d.ts +8 -0
- package/dist/next/link/index.d.ts.map +1 -0
- package/dist/next/link/index.js +8 -0
- package/dist/next/link/index.js.map +1 -0
- package/dist/next/link/internal.d.ts +9 -0
- package/dist/next/link/internal.d.ts.map +1 -0
- package/dist/next/link/internal.js +10 -0
- package/dist/next/link/internal.js.map +1 -0
- package/dist/next/link/ipc.d.ts +22 -0
- package/dist/next/link/ipc.d.ts.map +1 -0
- package/dist/next/link/ipc.js +64 -0
- package/dist/next/link/ipc.js.map +1 -0
- package/dist/next/link/link.d.ts +34 -0
- package/dist/next/link/link.d.ts.map +1 -0
- package/dist/next/link/link.js +87 -0
- package/dist/next/link/link.js.map +1 -0
- package/dist/next/link/message.d.ts +249 -0
- package/dist/next/link/message.d.ts.map +1 -0
- package/dist/next/link/message.js +123 -0
- package/dist/next/link/message.js.map +1 -0
- package/dist/next/link/part.d.ts +80 -0
- package/dist/next/link/part.d.ts.map +1 -0
- package/dist/next/link/part.js +164 -0
- package/dist/next/link/part.js.map +1 -0
- package/dist/next/link/text.d.ts +6 -0
- package/dist/next/link/text.d.ts.map +1 -0
- package/dist/next/link/text.js +335 -0
- package/dist/next/link/text.js.map +1 -0
- package/dist/next/link/values.d.ts +40 -0
- package/dist/next/link/values.d.ts.map +1 -0
- package/dist/next/link/values.js +117 -0
- package/dist/next/link/values.js.map +1 -0
- package/dist/next/link/websocket.d.ts +26 -0
- package/dist/next/link/websocket.d.ts.map +1 -0
- package/dist/next/link/websocket.js +91 -0
- package/dist/next/link/websocket.js.map +1 -0
- package/dist/next/registries/contribution.d.ts +50 -0
- package/dist/next/registries/contribution.d.ts.map +1 -0
- package/dist/next/registries/contribution.js +129 -0
- package/dist/next/registries/contribution.js.map +1 -0
- package/dist/next/registries/entries.d.ts +18 -0
- package/dist/next/registries/entries.d.ts.map +1 -0
- package/dist/next/registries/entries.js +42 -0
- package/dist/next/registries/entries.js.map +1 -0
- package/dist/next/registries/index.d.ts +3 -0
- package/dist/next/registries/index.d.ts.map +1 -0
- package/dist/next/registries/index.js +5 -0
- package/dist/next/registries/index.js.map +1 -0
- package/dist/next/registries/internal.d.ts +4 -0
- package/dist/next/registries/internal.d.ts.map +1 -0
- package/dist/next/registries/internal.js +5 -0
- package/dist/next/registries/internal.js.map +1 -0
- package/dist/next/registries/record.d.ts +94 -0
- package/dist/next/registries/record.d.ts.map +1 -0
- package/dist/next/registries/record.js +253 -0
- package/dist/next/registries/record.js.map +1 -0
- package/dist/next/registries/registry.d.ts +74 -0
- package/dist/next/registries/registry.d.ts.map +1 -0
- package/dist/next/registries/registry.js +14 -0
- package/dist/next/registries/registry.js.map +1 -0
- package/dist/next/registries/value.d.ts +48 -0
- package/dist/next/registries/value.d.ts.map +1 -0
- package/dist/next/registries/value.js +199 -0
- package/dist/next/registries/value.js.map +1 -0
- package/dist/next/remote/calls.d.ts +25 -0
- package/dist/next/remote/calls.d.ts.map +1 -0
- package/dist/next/remote/calls.js +62 -0
- package/dist/next/remote/calls.js.map +1 -0
- package/dist/next/remote/consumer.d.ts +42 -0
- package/dist/next/remote/consumer.d.ts.map +1 -0
- package/dist/next/remote/consumer.js +343 -0
- package/dist/next/remote/consumer.js.map +1 -0
- package/dist/next/remote/hold.d.ts +130 -0
- package/dist/next/remote/hold.d.ts.map +1 -0
- package/dist/next/remote/hold.js +537 -0
- package/dist/next/remote/hold.js.map +1 -0
- package/dist/next/remote/host-link.d.ts +77 -0
- package/dist/next/remote/host-link.d.ts.map +1 -0
- package/dist/next/remote/host-link.js +182 -0
- package/dist/next/remote/host-link.js.map +1 -0
- package/dist/next/remote/internal.d.ts +6 -0
- package/dist/next/remote/internal.d.ts.map +1 -0
- package/dist/next/remote/internal.js +6 -0
- package/dist/next/remote/internal.js.map +1 -0
- package/dist/next/remote/path.d.ts +46 -0
- package/dist/next/remote/path.d.ts.map +1 -0
- package/dist/next/remote/path.js +73 -0
- package/dist/next/remote/path.js.map +1 -0
- package/dist/next/remote/provider.d.ts +76 -0
- package/dist/next/remote/provider.d.ts.map +1 -0
- package/dist/next/remote/provider.js +506 -0
- package/dist/next/remote/provider.js.map +1 -0
- package/dist/next/remote/relay.d.ts +58 -0
- package/dist/next/remote/relay.d.ts.map +1 -0
- package/dist/next/remote/relay.js +117 -0
- package/dist/next/remote/relay.js.map +1 -0
- package/dist/next/remote/remote-object.d.ts +133 -0
- package/dist/next/remote/remote-object.d.ts.map +1 -0
- package/dist/next/remote/remote-object.js +411 -0
- package/dist/next/remote/remote-object.js.map +1 -0
- package/dist/next/remote/replica.d.ts +59 -0
- package/dist/next/remote/replica.d.ts.map +1 -0
- package/dist/next/remote/replica.js +125 -0
- package/dist/next/remote/replica.js.map +1 -0
- package/dist/next/state/batch.d.ts +64 -0
- package/dist/next/state/batch.d.ts.map +1 -0
- package/dist/next/state/batch.js +163 -0
- package/dist/next/state/batch.js.map +1 -0
- package/dist/next/state/derive.d.ts +52 -0
- package/dist/next/state/derive.d.ts.map +1 -0
- package/dist/next/state/derive.js +182 -0
- package/dist/next/state/derive.js.map +1 -0
- package/dist/next/state/index.d.ts +6 -0
- package/dist/next/state/index.d.ts.map +1 -0
- package/dist/next/state/index.js +4 -0
- package/dist/next/state/index.js.map +1 -0
- package/dist/next/state/internal.d.ts +6 -0
- package/dist/next/state/internal.d.ts.map +1 -0
- package/dist/next/state/internal.js +8 -0
- package/dist/next/state/internal.js.map +1 -0
- package/dist/next/state/native-source.d.ts +106 -0
- package/dist/next/state/native-source.d.ts.map +1 -0
- package/dist/next/state/native-source.js +240 -0
- package/dist/next/state/native-source.js.map +1 -0
- package/dist/next/state/watchable.d.ts +114 -0
- package/dist/next/state/watchable.d.ts.map +1 -0
- package/dist/next/state/watchable.js +156 -0
- package/dist/next/state/watchable.js.map +1 -0
- package/dist/next/state/writable.d.ts +32 -0
- package/dist/next/state/writable.d.ts.map +1 -0
- package/dist/next/state/writable.js +49 -0
- package/dist/next/state/writable.js.map +1 -0
- package/dist/next/store/adapter.d.ts +67 -0
- package/dist/next/store/adapter.d.ts.map +1 -0
- package/dist/next/store/adapter.js +118 -0
- package/dist/next/store/adapter.js.map +1 -0
- package/dist/next/store/allocator.d.ts +17 -0
- package/dist/next/store/allocator.d.ts.map +1 -0
- package/dist/next/store/allocator.js +30 -0
- package/dist/next/store/allocator.js.map +1 -0
- package/dist/next/store/applier.d.ts +8 -0
- package/dist/next/store/applier.d.ts.map +1 -0
- package/dist/next/store/applier.js +375 -0
- package/dist/next/store/applier.js.map +1 -0
- package/dist/next/store/apply-batch.d.ts +12 -0
- package/dist/next/store/apply-batch.d.ts.map +1 -0
- package/dist/next/store/apply-batch.js +83 -0
- package/dist/next/store/apply-batch.js.map +1 -0
- package/dist/next/store/archive.d.ts +32 -0
- package/dist/next/store/archive.d.ts.map +1 -0
- package/dist/next/store/archive.js +129 -0
- package/dist/next/store/archive.js.map +1 -0
- package/dist/next/store/backend.d.ts +10 -0
- package/dist/next/store/backend.d.ts.map +1 -0
- package/dist/next/store/backend.js +15 -0
- package/dist/next/store/backend.js.map +1 -0
- package/dist/next/store/catalog.d.ts +24 -0
- package/dist/next/store/catalog.d.ts.map +1 -0
- package/dist/next/store/catalog.js +17 -0
- package/dist/next/store/catalog.js.map +1 -0
- package/dist/next/store/claims.d.ts +23 -0
- package/dist/next/store/claims.d.ts.map +1 -0
- package/dist/next/store/claims.js +65 -0
- package/dist/next/store/claims.js.map +1 -0
- package/dist/next/store/columns.d.ts +77 -0
- package/dist/next/store/columns.d.ts.map +1 -0
- package/dist/next/store/columns.js +77 -0
- package/dist/next/store/columns.js.map +1 -0
- package/dist/next/store/engine.d.ts +176 -0
- package/dist/next/store/engine.d.ts.map +1 -0
- package/dist/next/store/engine.js +283 -0
- package/dist/next/store/engine.js.map +1 -0
- package/dist/next/store/evaluate.d.ts +17 -0
- package/dist/next/store/evaluate.d.ts.map +1 -0
- package/dist/next/store/evaluate.js +128 -0
- package/dist/next/store/evaluate.js.map +1 -0
- package/dist/next/store/export.d.ts +17 -0
- package/dist/next/store/export.d.ts.map +1 -0
- package/dist/next/store/export.js +200 -0
- package/dist/next/store/export.js.map +1 -0
- package/dist/next/store/expression.d.ts +150 -0
- package/dist/next/store/expression.d.ts.map +1 -0
- package/dist/next/store/expression.js +268 -0
- package/dist/next/store/expression.js.map +1 -0
- package/dist/next/store/import.d.ts +10 -0
- package/dist/next/store/import.d.ts.map +1 -0
- package/dist/next/store/import.js +276 -0
- package/dist/next/store/import.js.map +1 -0
- package/dist/next/store/index.d.ts +16 -0
- package/dist/next/store/index.d.ts.map +1 -0
- package/dist/next/store/index.js +13 -0
- package/dist/next/store/index.js.map +1 -0
- package/dist/next/store/json-column.d.ts +33 -0
- package/dist/next/store/json-column.d.ts.map +1 -0
- package/dist/next/store/json-column.js +61 -0
- package/dist/next/store/json-column.js.map +1 -0
- package/dist/next/store/jsonl.d.ts +9 -0
- package/dist/next/store/jsonl.d.ts.map +1 -0
- package/dist/next/store/jsonl.js +61 -0
- package/dist/next/store/jsonl.js.map +1 -0
- package/dist/next/store/outbox.d.ts +26 -0
- package/dist/next/store/outbox.d.ts.map +1 -0
- package/dist/next/store/outbox.js +80 -0
- package/dist/next/store/outbox.js.map +1 -0
- package/dist/next/store/query.d.ts +39 -0
- package/dist/next/store/query.d.ts.map +1 -0
- package/dist/next/store/query.js +97 -0
- package/dist/next/store/query.js.map +1 -0
- package/dist/next/store/refusal.d.ts +15 -0
- package/dist/next/store/refusal.d.ts.map +1 -0
- package/dist/next/store/refusal.js +36 -0
- package/dist/next/store/refusal.js.map +1 -0
- package/dist/next/store/rows.d.ts +80 -0
- package/dist/next/store/rows.d.ts.map +1 -0
- package/dist/next/store/rows.js +183 -0
- package/dist/next/store/rows.js.map +1 -0
- package/dist/next/store/schema.d.ts +25 -0
- package/dist/next/store/schema.d.ts.map +1 -0
- package/dist/next/store/schema.js +115 -0
- package/dist/next/store/schema.js.map +1 -0
- package/dist/next/store/sql.d.ts +73 -0
- package/dist/next/store/sql.d.ts.map +1 -0
- package/dist/next/store/sql.js +234 -0
- package/dist/next/store/sql.js.map +1 -0
- package/dist/next/store/step.d.ts +48 -0
- package/dist/next/store/step.d.ts.map +1 -0
- package/dist/next/store/step.js +50 -0
- package/dist/next/store/step.js.map +1 -0
- package/dist/next/store/store.d.ts +161 -0
- package/dist/next/store/store.d.ts.map +1 -0
- package/dist/next/store/store.js +627 -0
- package/dist/next/store/store.js.map +1 -0
- package/dist/next/store/table-changes.d.ts +29 -0
- package/dist/next/store/table-changes.d.ts.map +1 -0
- package/dist/next/store/table-changes.js +102 -0
- package/dist/next/store/table-changes.js.map +1 -0
- package/dist/next/store/table-evolve.d.ts +74 -0
- package/dist/next/store/table-evolve.d.ts.map +1 -0
- package/dist/next/store/table-evolve.js +201 -0
- package/dist/next/store/table-evolve.js.map +1 -0
- package/dist/next/store/table-handle.d.ts +67 -0
- package/dist/next/store/table-handle.d.ts.map +1 -0
- package/dist/next/store/table-handle.js +101 -0
- package/dist/next/store/table-handle.js.map +1 -0
- package/dist/next/store/table-history.d.ts +75 -0
- package/dist/next/store/table-history.d.ts.map +1 -0
- package/dist/next/store/table-history.js +42 -0
- package/dist/next/store/table-history.js.map +1 -0
- package/dist/next/store/table-migration.d.ts +16 -0
- package/dist/next/store/table-migration.d.ts.map +1 -0
- package/dist/next/store/table-migration.js +202 -0
- package/dist/next/store/table-migration.js.map +1 -0
- package/dist/next/store/table-writes.d.ts +125 -0
- package/dist/next/store/table-writes.d.ts.map +1 -0
- package/dist/next/store/table-writes.js +165 -0
- package/dist/next/store/table-writes.js.map +1 -0
- package/dist/next/store/table.d.ts +80 -0
- package/dist/next/store/table.d.ts.map +1 -0
- package/dist/next/store/table.js +103 -0
- package/dist/next/store/table.js.map +1 -0
- package/dist/next/store/text.d.ts +14 -0
- package/dist/next/store/text.d.ts.map +1 -0
- package/dist/next/store/text.js +51 -0
- package/dist/next/store/text.js.map +1 -0
- package/dist/next/store/writes.d.ts +5 -0
- package/dist/next/store/writes.d.ts.map +1 -0
- package/dist/next/store/writes.js +4 -0
- package/dist/next/store/writes.js.map +1 -0
- package/dist/next-node/compression.d.ts +7 -0
- package/dist/next-node/compression.d.ts.map +1 -0
- package/dist/next-node/compression.js +24 -0
- package/dist/next-node/compression.js.map +1 -0
- package/dist/next-node/http/admission.d.ts +63 -0
- package/dist/next-node/http/admission.d.ts.map +1 -0
- package/dist/next-node/http/admission.js +134 -0
- package/dist/next-node/http/admission.js.map +1 -0
- package/dist/next-node/http/authenticate.d.ts +21 -0
- package/dist/next-node/http/authenticate.d.ts.map +1 -0
- package/dist/next-node/http/authenticate.js +34 -0
- package/dist/next-node/http/authenticate.js.map +1 -0
- package/dist/next-node/http/cookies.d.ts +24 -0
- package/dist/next-node/http/cookies.d.ts.map +1 -0
- package/dist/next-node/http/cookies.js +62 -0
- package/dist/next-node/http/cookies.js.map +1 -0
- package/dist/next-node/http/file.d.ts +23 -0
- package/dist/next-node/http/file.d.ts.map +1 -0
- package/dist/next-node/http/file.js +94 -0
- package/dist/next-node/http/file.js.map +1 -0
- package/dist/next-node/http/headers.d.ts +37 -0
- package/dist/next-node/http/headers.d.ts.map +1 -0
- package/dist/next-node/http/headers.js +129 -0
- package/dist/next-node/http/headers.js.map +1 -0
- package/dist/next-node/http/http.d.ts +100 -0
- package/dist/next-node/http/http.d.ts.map +1 -0
- package/dist/next-node/http/http.js +462 -0
- package/dist/next-node/http/http.js.map +1 -0
- package/dist/next-node/http/incoming.d.ts +19 -0
- package/dist/next-node/http/incoming.d.ts.map +1 -0
- package/dist/next-node/http/incoming.js +31 -0
- package/dist/next-node/http/incoming.js.map +1 -0
- package/dist/next-node/http/index.d.ts +11 -0
- package/dist/next-node/http/index.d.ts.map +1 -0
- package/dist/next-node/http/index.js +12 -0
- package/dist/next-node/http/index.js.map +1 -0
- package/dist/next-node/http/node.d.ts +78 -0
- package/dist/next-node/http/node.d.ts.map +1 -0
- package/dist/next-node/http/node.js +291 -0
- package/dist/next-node/http/node.js.map +1 -0
- package/dist/next-node/http/request.d.ts +54 -0
- package/dist/next-node/http/request.d.ts.map +1 -0
- package/dist/next-node/http/request.js +116 -0
- package/dist/next-node/http/request.js.map +1 -0
- package/dist/next-node/http/response.d.ts +63 -0
- package/dist/next-node/http/response.d.ts.map +1 -0
- package/dist/next-node/http/response.js +202 -0
- package/dist/next-node/http/response.js.map +1 -0
- package/dist/next-node/http/router.d.ts +114 -0
- package/dist/next-node/http/router.d.ts.map +1 -0
- package/dist/next-node/http/router.js +261 -0
- package/dist/next-node/http/router.js.map +1 -0
- package/dist/next-node/http/upgrades.d.ts +58 -0
- package/dist/next-node/http/upgrades.d.ts.map +1 -0
- package/dist/next-node/http/upgrades.js +184 -0
- package/dist/next-node/http/upgrades.js.map +1 -0
- package/dist/next-node/plugins/build.d.ts +57 -0
- package/dist/next-node/plugins/build.d.ts.map +1 -0
- package/dist/next-node/plugins/build.js +334 -0
- package/dist/next-node/plugins/build.js.map +1 -0
- package/dist/next-node/plugins/discover.d.ts +36 -0
- package/dist/next-node/plugins/discover.d.ts.map +1 -0
- package/dist/next-node/plugins/discover.js +91 -0
- package/dist/next-node/plugins/discover.js.map +1 -0
- package/dist/next-node/plugins/evaluate.d.ts +33 -0
- package/dist/next-node/plugins/evaluate.d.ts.map +1 -0
- package/dist/next-node/plugins/evaluate.js +98 -0
- package/dist/next-node/plugins/evaluate.js.map +1 -0
- package/dist/next-node/plugins/index.d.ts +9 -0
- package/dist/next-node/plugins/index.d.ts.map +1 -0
- package/dist/next-node/plugins/index.js +11 -0
- package/dist/next-node/plugins/index.js.map +1 -0
- package/dist/next-node/plugins/install.d.ts +13 -0
- package/dist/next-node/plugins/install.d.ts.map +1 -0
- package/dist/next-node/plugins/install.js +37 -0
- package/dist/next-node/plugins/install.js.map +1 -0
- package/dist/next-node/plugins/plugins.d.ts +135 -0
- package/dist/next-node/plugins/plugins.d.ts.map +1 -0
- package/dist/next-node/plugins/plugins.js +206 -0
- package/dist/next-node/plugins/plugins.js.map +1 -0
- package/dist/next-node/plugins/runtime.d.ts +41 -0
- package/dist/next-node/plugins/runtime.d.ts.map +1 -0
- package/dist/next-node/plugins/runtime.js +136 -0
- package/dist/next-node/plugins/runtime.js.map +1 -0
- package/dist/next-node/plugins/stack.d.ts +16 -0
- package/dist/next-node/plugins/stack.d.ts.map +1 -0
- package/dist/next-node/plugins/stack.js +61 -0
- package/dist/next-node/plugins/stack.js.map +1 -0
- package/dist/next-node/plugins/watcher.d.ts +58 -0
- package/dist/next-node/plugins/watcher.d.ts.map +1 -0
- package/dist/next-node/plugins/watcher.js +281 -0
- package/dist/next-node/plugins/watcher.js.map +1 -0
- package/dist/next-node/workers/control.d.ts +83 -0
- package/dist/next-node/workers/control.d.ts.map +1 -0
- package/dist/next-node/workers/control.js +77 -0
- package/dist/next-node/workers/control.js.map +1 -0
- package/dist/next-node/workers/index.d.ts +5 -0
- package/dist/next-node/workers/index.d.ts.map +1 -0
- package/dist/next-node/workers/index.js +7 -0
- package/dist/next-node/workers/index.js.map +1 -0
- package/dist/next-node/workers/lock.d.ts +21 -0
- package/dist/next-node/workers/lock.d.ts.map +1 -0
- package/dist/next-node/workers/lock.js +137 -0
- package/dist/next-node/workers/lock.js.map +1 -0
- package/dist/next-node/workers/main.d.ts +46 -0
- package/dist/next-node/workers/main.d.ts.map +1 -0
- package/dist/next-node/workers/main.js +230 -0
- package/dist/next-node/workers/main.js.map +1 -0
- package/dist/next-node/workers/process.d.ts +42 -0
- package/dist/next-node/workers/process.d.ts.map +1 -0
- package/dist/next-node/workers/process.js +125 -0
- package/dist/next-node/workers/process.js.map +1 -0
- package/dist/next-node/workers/workers.d.ts +80 -0
- package/dist/next-node/workers/workers.d.ts.map +1 -0
- package/dist/next-node/workers/workers.js +572 -0
- package/dist/next-node/workers/workers.js.map +1 -0
- package/dist/object.d.ts +4 -4
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +3 -4
- package/dist/object.js.map +1 -1
- package/dist/output.d.ts +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +4 -2
- package/dist/output.js.map +1 -1
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +2 -2
- package/dist/remote.js.map +1 -1
- package/dist/schema.d.ts +8 -4
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +180 -5
- package/dist/schema.js.map +1 -1
- package/dist/sqlite/cloudflare.d.ts +2 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -1
- package/dist/sqlite/cloudflare.js +10 -0
- package/dist/sqlite/cloudflare.js.map +1 -1
- package/dist/sqlite/database.d.ts +5 -2
- package/dist/sqlite/database.d.ts.map +1 -1
- package/dist/sqlite/database.js.map +1 -1
- package/dist/sqlite/node.d.ts +4 -1
- package/dist/sqlite/node.d.ts.map +1 -1
- package/dist/sqlite/node.js +22 -5
- package/dist/sqlite/node.js.map +1 -1
- package/dist/watch.d.ts +194 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +383 -0
- package/dist/watch.js.map +1 -0
- package/dist/wire.d.ts +174 -193
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +81 -80
- package/dist/wire.js.map +1 -1
- package/docs/guide.md +15 -15
- package/docs/next/benchmarks.md +959 -0
- package/docs/next/decisions.md +2957 -0
- package/docs/next/dependencies/book.md +1671 -0
- package/docs/next/dependencies/index.html +2641 -0
- package/docs/next/dependencies/model.md +330 -0
- package/docs/next/design.md +2554 -0
- package/docs/next/durable-observers/book.md +432 -0
- package/docs/next/durable-observers/index.html +517 -0
- package/docs/next/flow-control/book.md +333 -0
- package/docs/next/flow-control/fold/index.html +265 -0
- package/docs/next/flow-control/index.html +548 -0
- package/docs/next/flow-control/window/index.html +228 -0
- package/docs/next/guide-plugins-hosts/book.md +607 -0
- package/docs/next/guide-plugins-hosts/index.html +652 -0
- package/docs/next/http-workers/book.md +378 -0
- package/docs/next/http-workers/index.html +515 -0
- package/docs/next/layer-1.md +311 -0
- package/docs/next/layer-2.md +216 -0
- package/docs/next/plugin-model/book.md +186 -0
- package/docs/next/plugin-model/index.html +310 -0
- package/docs/next/plugin-primer/book.md +273 -0
- package/docs/next/plugin-primer/index.html +430 -0
- package/docs/next/slice-1.md +236 -0
- package/docs/next/slice-10.md +285 -0
- package/docs/next/slice-11.md +93 -0
- package/docs/next/slice-2.md +174 -0
- package/docs/next/slice-3a.md +296 -0
- package/docs/next/slice-3b.md +197 -0
- package/docs/next/slice-4.md +146 -0
- package/docs/next/slice-4a.md +418 -0
- package/docs/next/slice-4b.md +208 -0
- package/docs/next/slice-5.md +281 -0
- package/docs/next/slice-6a.md +676 -0
- package/docs/next/slice-6b.md +332 -0
- package/docs/next/slice-7a.md +130 -0
- package/docs/next/slice-7b/book.md +608 -0
- package/docs/next/slice-7b/index.html +842 -0
- package/docs/next/slice-7b.md +255 -0
- package/docs/next/slice-7c.md +165 -0
- package/docs/next/slice-8.md +194 -0
- package/docs/next/slices.md +230 -0
- package/docs/next/store/book.md +665 -0
- package/docs/next/store/index.html +861 -0
- package/docs/next/store/walkthrough.md +193 -0
- package/docs/spec.md +9 -9
- package/docs/tutorial.md +26 -25
- package/package.json +22 -6
- package/src/delta/README.md +69 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Context } from "../../context/index.ts";
|
|
2
|
+
import type { ChordError, Principal } from "../data/index.ts";
|
|
3
|
+
import type { AnyHost } from "../host/internal.ts";
|
|
4
|
+
import { type ChannelHandler, type Codec, DeflatedPart, type Limits, type Link, type Message, type Part } from "../link/internal.ts";
|
|
5
|
+
import { ConsumerSide } from "./consumer.ts";
|
|
6
|
+
import { ProviderSide } from "./provider.ts";
|
|
7
|
+
/**
|
|
8
|
+
* How a link was made: `parent` by `connect` (holds arriving on it may name whom they act for), `child` by `accept`,
|
|
9
|
+
* `route` by a route's `resolve`.
|
|
10
|
+
*/
|
|
11
|
+
export type LinkRole = "parent" | "child" | "route";
|
|
12
|
+
/** What a link is made with. */
|
|
13
|
+
type HostLinkOptions = {
|
|
14
|
+
readonly role: LinkRole;
|
|
15
|
+
/** The peer, as this host stamps it. */
|
|
16
|
+
readonly principal: Principal;
|
|
17
|
+
/** Skips the message schema check (framing and the owners' checks still run). */
|
|
18
|
+
readonly trusted: boolean;
|
|
19
|
+
readonly codec: Codec;
|
|
20
|
+
readonly limits: Limits;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A link of a host, both directions over one channel. Closing it, from either end, ends both sides: the provider sides
|
|
24
|
+
* release the peer's holds, the consumer side's holds go loading until their path's next link.
|
|
25
|
+
*/
|
|
26
|
+
export declare class HostLink implements ChannelHandler {
|
|
27
|
+
#private;
|
|
28
|
+
readonly host: AnyHost;
|
|
29
|
+
readonly role: LinkRole;
|
|
30
|
+
readonly principal: Principal;
|
|
31
|
+
/** Whether the link is trusted: activation chains on holds arriving on it are honoured (Q5). */
|
|
32
|
+
readonly trusted: boolean;
|
|
33
|
+
/** The limits per part of what arrives on this link (Q2). */
|
|
34
|
+
readonly limits: Limits;
|
|
35
|
+
/** The parent of the work arriving on this link. */
|
|
36
|
+
readonly context: Context;
|
|
37
|
+
readonly consumer: ConsumerSide;
|
|
38
|
+
constructor(host: AnyHost, link: Link, options: HostLinkOptions, context: Context);
|
|
39
|
+
/** The peer's incarnation, from its `hello`. */
|
|
40
|
+
get peer(): string;
|
|
41
|
+
/** Whether the peer's `hello` arrived (it may have arrived while the link was made). */
|
|
42
|
+
get greeted(): boolean;
|
|
43
|
+
/** Whether the link is open; one closed already when made is not kept. */
|
|
44
|
+
get open(): boolean;
|
|
45
|
+
send(message: Message): void;
|
|
46
|
+
close(): void;
|
|
47
|
+
/** The heartbeat (see `Channel.tick`). */
|
|
48
|
+
tick(now: number, ping: number, close: number): void;
|
|
49
|
+
opened(): void;
|
|
50
|
+
/** A JSON part this host originates on this link: deflated above the threshold when the host compresses. */
|
|
51
|
+
part(json: string, context: Context): Part;
|
|
52
|
+
/** The JSON of a part arriving on this link, where it is owned, within `limits`. Throws as `openPart` does. */
|
|
53
|
+
openPart(part: Part, limits: Limits, context: Context): string | Uint8Array;
|
|
54
|
+
/**
|
|
55
|
+
* Whether `part` waits for an asynchronous inflate before its owner can open it: deflated, not inflated yet, on a
|
|
56
|
+
* host without a synchronous compressor, and within the wire limit (past it, opening refuses it uninflated).
|
|
57
|
+
*/
|
|
58
|
+
inflates(part: Part | undefined, limits: Limits): part is DeflatedPart;
|
|
59
|
+
/**
|
|
60
|
+
* Inflates `parts` (deflated parts an owner admitted, each with its decoded limit) one after another with the web
|
|
61
|
+
* `DecompressionStream`, then lets the owner handle its message again (`handle`); the channel holds the link's later
|
|
62
|
+
* messages until then. A link closed meanwhile stops the inflate at once and drops the message (race 13).
|
|
63
|
+
*/
|
|
64
|
+
inflate(parts: readonly (readonly [DeflatedPart, number])[], handle: () => void): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* A message from the peer, to its side. One whose owner first waits for an asynchronous inflate returns its promise:
|
|
67
|
+
* the channel holds later messages until it settled.
|
|
68
|
+
*/
|
|
69
|
+
message(message: Message): void | Promise<void>;
|
|
70
|
+
/** `provider` holds nothing any more: it goes (its relay's upstream links are told `closed`). */
|
|
71
|
+
drop(provider: ProviderSide): void;
|
|
72
|
+
/** Ends the holds on this link that hold nothing and act for a principal `revoked` names (§4). */
|
|
73
|
+
revokeUnbound(revoked: (principal: Principal) => boolean, error: ChordError): void;
|
|
74
|
+
closed(): void;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=host-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-link.d.ts","sourceRoot":"","sources":["../../../src/next/remote/host-link.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAA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,CAErB;IAED,0EAA0E;IAC1E,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE3B;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,0CAA0C;IAC1C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEnD;IAED,MAAM,IAAI,IAAI,CAGb;IAED,4GAA4G;IAC5G,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAEzC;IAED,+GAA+G;IAC/G,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAE1E;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,IAAI,YAAY,CAOrE;IAED;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpG;IAED;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC9C;IAED,iGAAiG;IACjG,IAAI,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAIjC;IAED,kGAAkG;IAClG,aAAa,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAEjF;IAED,MAAM,IAAI,IAAI,CAMb;CAYD"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// One link of a host (§3, §22): its channel, its role, the peer's principal, its limits per part, and both sides: a
|
|
2
|
+
// provider side per origin (holds and calls the peer sent, its own or a relay's for one of its downstream links) and
|
|
3
|
+
// the consumer side (holds and calls this host sent). Message kinds are directional, so each goes to its side; a
|
|
4
|
+
// revocation is honoured from the parent only. Parts are made and opened here, with the host's compressor, or inflated
|
|
5
|
+
// asynchronously for their owner when the host has none.
|
|
6
|
+
import { Channel, DeflatedPart, inflateAsync, openPart, originPart, } from "../link/internal.js";
|
|
7
|
+
import { ConsumerSide } from "./consumer.js";
|
|
8
|
+
import { ProviderSide } from "./provider.js";
|
|
9
|
+
/** How many concurrent calls a host accepts on each of its links, announced in `hello`. */
|
|
10
|
+
const CALLS = 256;
|
|
11
|
+
/**
|
|
12
|
+
* A link of a host, both directions over one channel. Closing it, from either end, ends both sides: the provider sides
|
|
13
|
+
* release the peer's holds, the consumer side's holds go loading until their path's next link.
|
|
14
|
+
*/
|
|
15
|
+
export class HostLink {
|
|
16
|
+
host;
|
|
17
|
+
role;
|
|
18
|
+
principal;
|
|
19
|
+
/** Whether the link is trusted: activation chains on holds arriving on it are honoured (Q5). */
|
|
20
|
+
trusted;
|
|
21
|
+
/** The limits per part of what arrives on this link (Q2). */
|
|
22
|
+
limits;
|
|
23
|
+
/** The parent of the work arriving on this link. */
|
|
24
|
+
context;
|
|
25
|
+
consumer;
|
|
26
|
+
/**
|
|
27
|
+
* The provider side of each origin the peer sent holds for, made by its first and dropped once it holds nothing;
|
|
28
|
+
* `origin` is honoured only on parent and route links, where a relay's messages arrive (decision "Origins only from
|
|
29
|
+
* relays").
|
|
30
|
+
*/
|
|
31
|
+
#providers = new Map();
|
|
32
|
+
#channel;
|
|
33
|
+
/** Aborted when the link closes: stops its asynchronous inflates at once. */
|
|
34
|
+
#closing = new AbortController();
|
|
35
|
+
constructor(host, link, options, context) {
|
|
36
|
+
this.host = host;
|
|
37
|
+
this.role = options.role;
|
|
38
|
+
this.principal = options.principal;
|
|
39
|
+
this.trusted = options.trusted;
|
|
40
|
+
this.limits = options.limits;
|
|
41
|
+
this.context = context;
|
|
42
|
+
this.consumer = new ConsumerSide(this);
|
|
43
|
+
const { codec, trusted } = options;
|
|
44
|
+
const report = (error) => host.report({ kind: "protocol_error", error });
|
|
45
|
+
const channel = { codec, incarnation: host.incarnation, calls: CALLS, trusted, report };
|
|
46
|
+
this.#channel = new Channel(link, this, channel, context);
|
|
47
|
+
// Last: a link closed already calls `closed` at once.
|
|
48
|
+
this.#channel.start();
|
|
49
|
+
}
|
|
50
|
+
/** The peer's incarnation, from its `hello`. */
|
|
51
|
+
get peer() {
|
|
52
|
+
return this.#channel.peer;
|
|
53
|
+
}
|
|
54
|
+
/** Whether the peer's `hello` arrived (it may have arrived while the link was made). */
|
|
55
|
+
get greeted() {
|
|
56
|
+
return this.#channel.opened;
|
|
57
|
+
}
|
|
58
|
+
/** Whether the link is open; one closed already when made is not kept. */
|
|
59
|
+
get open() {
|
|
60
|
+
return !this.#channel.closed;
|
|
61
|
+
}
|
|
62
|
+
send(message) {
|
|
63
|
+
this.#channel.send(message);
|
|
64
|
+
}
|
|
65
|
+
close() {
|
|
66
|
+
this.#channel.close();
|
|
67
|
+
}
|
|
68
|
+
/** The heartbeat (see `Channel.tick`). */
|
|
69
|
+
tick(now, ping, close) {
|
|
70
|
+
this.#channel.tick(now, ping, close);
|
|
71
|
+
}
|
|
72
|
+
opened() {
|
|
73
|
+
this.consumer.opened(this.#channel.peerCalls);
|
|
74
|
+
this.host.linkOpened(this);
|
|
75
|
+
}
|
|
76
|
+
/** A JSON part this host originates on this link: deflated above the threshold when the host compresses. */
|
|
77
|
+
part(json, context) {
|
|
78
|
+
return originPart(json, this.host.compression, context);
|
|
79
|
+
}
|
|
80
|
+
/** The JSON of a part arriving on this link, where it is owned, within `limits`. Throws as `openPart` does. */
|
|
81
|
+
openPart(part, limits, context) {
|
|
82
|
+
return openPart(part, limits, this.host.compression, context);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Whether `part` waits for an asynchronous inflate before its owner can open it: deflated, not inflated yet, on a
|
|
86
|
+
* host without a synchronous compressor, and within the wire limit (past it, opening refuses it uninflated).
|
|
87
|
+
*/
|
|
88
|
+
inflates(part, limits) {
|
|
89
|
+
return (part instanceof DeflatedPart &&
|
|
90
|
+
part.inflated === undefined &&
|
|
91
|
+
this.host.compression === undefined &&
|
|
92
|
+
part.bytes.byteLength <= limits.part);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Inflates `parts` (deflated parts an owner admitted, each with its decoded limit) one after another with the web
|
|
96
|
+
* `DecompressionStream`, then lets the owner handle its message again (`handle`); the channel holds the link's later
|
|
97
|
+
* messages until then. A link closed meanwhile stops the inflate at once and drops the message (race 13).
|
|
98
|
+
*/
|
|
99
|
+
async inflate(parts, handle) {
|
|
100
|
+
const { signal } = this.#closing;
|
|
101
|
+
for (const [part, limit] of parts) {
|
|
102
|
+
await inflateAsync(part, limit, signal, this.context);
|
|
103
|
+
if (signal.aborted)
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
handle();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A message from the peer, to its side. One whose owner first waits for an asynchronous inflate returns its promise:
|
|
110
|
+
* the channel holds later messages until it settled.
|
|
111
|
+
*/
|
|
112
|
+
message(message) {
|
|
113
|
+
// A child (a tab, a TUI) relays nothing: its origins would each get their own call window and record.
|
|
114
|
+
if (this.role === "child" && "origin" in message && message.origin !== undefined) {
|
|
115
|
+
throw new Error(`${message.kind}: an origin on a child link`);
|
|
116
|
+
}
|
|
117
|
+
switch (message.kind) {
|
|
118
|
+
case "hold":
|
|
119
|
+
this.#hold(message);
|
|
120
|
+
break;
|
|
121
|
+
case "release":
|
|
122
|
+
case "call":
|
|
123
|
+
case "abort":
|
|
124
|
+
case "retry":
|
|
125
|
+
case "ack":
|
|
126
|
+
// An origin this link has no holds for: its ids are unknown (Q1).
|
|
127
|
+
return this.#providers.get(message.origin ?? 0)?.message(message);
|
|
128
|
+
case "closed":
|
|
129
|
+
this.#providers.get(message.origin)?.closed();
|
|
130
|
+
this.#providers.delete(message.origin);
|
|
131
|
+
break;
|
|
132
|
+
case "bound":
|
|
133
|
+
case "state":
|
|
134
|
+
case "failed":
|
|
135
|
+
case "loading":
|
|
136
|
+
case "result":
|
|
137
|
+
case "error":
|
|
138
|
+
case "gone":
|
|
139
|
+
return this.consumer.message(message);
|
|
140
|
+
case "revoke":
|
|
141
|
+
// Only the parent revokes; a child or a route cannot (race 6).
|
|
142
|
+
// JSON from the parent, the app's revocation type there as here (the same app code).
|
|
143
|
+
if (this.role === "parent")
|
|
144
|
+
this.host.revoke(message.revocation, this.context);
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
// `hello`, `ping` and `pong` are the channel's.
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/** `provider` holds nothing any more: it goes (its relay's upstream links are told `closed`). */
|
|
152
|
+
drop(provider) {
|
|
153
|
+
if (this.#providers.get(provider.origin) !== provider)
|
|
154
|
+
return;
|
|
155
|
+
this.#providers.delete(provider.origin);
|
|
156
|
+
provider.closed();
|
|
157
|
+
}
|
|
158
|
+
/** Ends the holds on this link that hold nothing and act for a principal `revoked` names (§4). */
|
|
159
|
+
revokeUnbound(revoked, error) {
|
|
160
|
+
for (const provider of this.#providers.values())
|
|
161
|
+
provider.revokeUnbound(revoked, error);
|
|
162
|
+
}
|
|
163
|
+
closed() {
|
|
164
|
+
this.#closing.abort();
|
|
165
|
+
for (const provider of this.#providers.values())
|
|
166
|
+
provider.closed();
|
|
167
|
+
this.#providers.clear();
|
|
168
|
+
this.consumer.closed();
|
|
169
|
+
this.host.unlink(this);
|
|
170
|
+
}
|
|
171
|
+
/** A `hold` goes to its origin's provider side, made for the origin's first. */
|
|
172
|
+
#hold(message) {
|
|
173
|
+
const origin = message.origin ?? 0;
|
|
174
|
+
let provider = this.#providers.get(origin);
|
|
175
|
+
if (provider === undefined) {
|
|
176
|
+
provider = new ProviderSide(this, origin, CALLS);
|
|
177
|
+
this.#providers.set(origin, provider);
|
|
178
|
+
}
|
|
179
|
+
provider.message(message);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=host-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-link.js","sourceRoot":"","sources":["../../../src/next/remote/host-link.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,qHAAqH;AACrH,iHAAiH;AACjH,uHAAuH;AACvH,yDAAyD;AAMzD,OAAO,EACN,OAAO,EAGP,YAAY,EACZ,YAAY,EAIZ,QAAQ,EACR,UAAU,GAEV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAmB7C,2FAA2F;AAC3F,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACX,IAAI,CAAU;IACd,IAAI,CAAW;IACf,SAAS,CAAY;IAC9B,gGAAgG;IACvF,OAAO,CAAU;IAC1B,6DAA6D;IACpD,MAAM,CAAS;IACxB,oDAAoD;IAC3C,OAAO,CAAU;IACjB,QAAQ,CAAe;IAChC;;;;OAIG;IACM,UAAU,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC7C,QAAQ,CAAU;IAC3B,6EAA6E;IACpE,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;IAE1C,YAAY,IAAa,EAAE,IAAU,EAAE,OAAwB,EAAE,OAAgB;QAChF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,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(§3, §22): its channel, its role, the peer's principal, its limits per part, and both sides: a\n// provider side per origin (holds and calls the peer sent, its own or a relay's for one of its downstream links) and\n// the consumer side (holds and calls this host sent). Message kinds are directional, so each goes to its side; a\n// revocation is honoured from the parent only. Parts are made and opened here, with the host's compressor, or inflated\n// asynchronously for their owner when the host has none.\n\nimport type { Context } from \"../../context/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\nimport type { ChordError, Principal } from \"../data/index.ts\";\nimport type { AnyHost } from \"../host/internal.ts\";\nimport {\n\tChannel,\n\ttype ChannelHandler,\n\ttype Codec,\n\tDeflatedPart,\n\tinflateAsync,\n\ttype Limits,\n\ttype Link,\n\ttype Message,\n\topenPart,\n\toriginPart,\n\ttype Part,\n} from \"../link/internal.ts\";\nimport { ConsumerSide } from \"./consumer.ts\";\nimport { ProviderSide } from \"./provider.ts\";\n\n/**\n * How a link was made: `parent` by `connect` (holds arriving on it may name whom they act for), `child` by `accept`,\n * `route` by a route's `resolve`.\n */\nexport type LinkRole = \"parent\" | \"child\" | \"route\";\n\n/** What a link is made with. */\ntype HostLinkOptions = {\n\treadonly role: LinkRole;\n\t/** The peer, as this host stamps it. */\n\treadonly principal: Principal;\n\t/** Skips the message schema check (framing and the owners' checks still run). */\n\treadonly trusted: boolean;\n\treadonly codec: Codec;\n\treadonly limits: Limits;\n};\n\n/** How many concurrent calls a host accepts on each of its links, announced in `hello`. */\nconst CALLS = 256;\n\n/**\n * A link of a host, both directions over one channel. Closing it, from either end, ends both sides: the provider sides\n * release the peer's holds, the consumer side's holds go loading until their path's next link.\n */\nexport class HostLink implements ChannelHandler {\n\treadonly host: AnyHost;\n\treadonly role: LinkRole;\n\treadonly principal: Principal;\n\t/** Whether the link is trusted: activation chains on holds arriving on it are honoured (Q5). */\n\treadonly trusted: boolean;\n\t/** The limits per part of what arrives on this link (Q2). */\n\treadonly limits: Limits;\n\t/** The parent of the work arriving on this link. */\n\treadonly context: Context;\n\treadonly consumer: ConsumerSide;\n\t/**\n\t * The provider side of each origin the peer sent holds for, made by its first and dropped once it holds nothing;\n\t * `origin` is honoured only on parent and route links, where a relay's messages arrive (decision \"Origins only from\n\t * relays\").\n\t */\n\treadonly #providers = new Map<number, ProviderSide>();\n\treadonly #channel: Channel;\n\t/** Aborted when the link closes: stops its asynchronous inflates at once. */\n\treadonly #closing = new AbortController();\n\n\tconstructor(host: AnyHost, link: Link, options: HostLinkOptions, context: Context) {\n\t\tthis.host = host;\n\t\tthis.role = options.role;\n\t\tthis.principal = options.principal;\n\t\tthis.trusted = options.trusted;\n\t\tthis.limits = options.limits;\n\t\tthis.context = context;\n\t\tthis.consumer = new ConsumerSide(this);\n\t\tconst { codec, trusted } = options;\n\t\tconst report = (error: unknown): void => host.report({ kind: \"protocol_error\", error });\n\t\tconst channel = { codec, incarnation: host.incarnation, calls: CALLS, trusted, report };\n\t\tthis.#channel = new Channel(link, this, channel, context);\n\t\t// Last: a link closed already calls `closed` at once.\n\t\tthis.#channel.start();\n\t}\n\n\t/** The peer's incarnation, from its `hello`. */\n\tget peer(): string {\n\t\treturn this.#channel.peer;\n\t}\n\n\t/** Whether the peer's `hello` arrived (it may have arrived while the link was made). */\n\tget greeted(): boolean {\n\t\treturn this.#channel.opened;\n\t}\n\n\t/** Whether the link is open; one closed already when made is not kept. */\n\tget open(): boolean {\n\t\treturn !this.#channel.closed;\n\t}\n\n\tsend(message: Message): void {\n\t\tthis.#channel.send(message);\n\t}\n\n\tclose(): void {\n\t\tthis.#channel.close();\n\t}\n\n\t/** The heartbeat (see `Channel.tick`). */\n\ttick(now: number, ping: number, close: number): void {\n\t\tthis.#channel.tick(now, ping, close);\n\t}\n\n\topened(): void {\n\t\tthis.consumer.opened(this.#channel.peerCalls);\n\t\tthis.host.linkOpened(this);\n\t}\n\n\t/** A JSON part this host originates on this link: deflated above the threshold when the host compresses. */\n\tpart(json: string, context: Context): Part {\n\t\treturn originPart(json, this.host.compression, context);\n\t}\n\n\t/** The JSON of a part arriving on this link, where it is owned, within `limits`. Throws as `openPart` does. */\n\topenPart(part: Part, limits: Limits, context: Context): string | Uint8Array {\n\t\treturn openPart(part, limits, this.host.compression, context);\n\t}\n\n\t/**\n\t * Whether `part` waits for an asynchronous inflate before its owner can open it: deflated, not inflated yet, on a\n\t * host without a synchronous compressor, and within the wire limit (past it, opening refuses it uninflated).\n\t */\n\tinflates(part: Part | undefined, limits: Limits): part is DeflatedPart {\n\t\treturn (\n\t\t\tpart instanceof DeflatedPart &&\n\t\t\tpart.inflated === undefined &&\n\t\t\tthis.host.compression === undefined &&\n\t\t\tpart.bytes.byteLength <= limits.part\n\t\t);\n\t}\n\n\t/**\n\t * Inflates `parts` (deflated parts an owner admitted, each with its decoded limit) one after another with the web\n\t * `DecompressionStream`, then lets the owner handle its message again (`handle`); the channel holds the link's later\n\t * messages until then. A link closed meanwhile stops the inflate at once and drops the message (race 13).\n\t */\n\tasync inflate(parts: readonly (readonly [DeflatedPart, number])[], handle: () => void): Promise<void> {\n\t\tconst { signal } = this.#closing;\n\t\tfor (const [part, limit] of parts) {\n\t\t\tawait inflateAsync(part, limit, signal, this.context);\n\t\t\tif (signal.aborted) return;\n\t\t}\n\t\thandle();\n\t}\n\n\t/**\n\t * A message from the peer, to its side. One whose owner first waits for an asynchronous inflate returns its promise:\n\t * the channel holds later messages until it settled.\n\t */\n\tmessage(message: Message): void | Promise<void> {\n\t\t// A child (a tab, a TUI) relays nothing: its origins would each get their own call window and record.\n\t\tif (this.role === \"child\" && \"origin\" in message && message.origin !== undefined) {\n\t\t\tthrow new Error(`${message.kind}: an origin on a child link`);\n\t\t}\n\t\tswitch (message.kind) {\n\t\t\tcase \"hold\":\n\t\t\t\tthis.#hold(message);\n\t\t\t\tbreak;\n\t\t\tcase \"release\":\n\t\t\tcase \"call\":\n\t\t\tcase \"abort\":\n\t\t\tcase \"retry\":\n\t\t\tcase \"ack\":\n\t\t\t\t// An origin this link has no holds for: its ids are unknown (Q1).\n\t\t\t\treturn this.#providers.get(message.origin ?? 0)?.message(message);\n\t\t\tcase \"closed\":\n\t\t\t\tthis.#providers.get(message.origin)?.closed();\n\t\t\t\tthis.#providers.delete(message.origin);\n\t\t\t\tbreak;\n\t\t\tcase \"bound\":\n\t\t\tcase \"state\":\n\t\t\tcase \"failed\":\n\t\t\tcase \"loading\":\n\t\t\tcase \"result\":\n\t\t\tcase \"error\":\n\t\t\tcase \"gone\":\n\t\t\t\treturn this.consumer.message(message);\n\t\t\tcase \"revoke\":\n\t\t\t\t// Only the parent revokes; a child or a route cannot (race 6).\n\t\t\t\t// JSON from the parent, the app's revocation type there as here (the same app code).\n\t\t\t\tif (this.role === \"parent\") this.host.revoke(message.revocation as JsonValue, this.context);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t// `hello`, `ping` and `pong` are the channel's.\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/** `provider` holds nothing any more: it goes (its relay's upstream links are told `closed`). */\n\tdrop(provider: ProviderSide): void {\n\t\tif (this.#providers.get(provider.origin) !== provider) return;\n\t\tthis.#providers.delete(provider.origin);\n\t\tprovider.closed();\n\t}\n\n\t/** Ends the holds on this link that hold nothing and act for a principal `revoked` names (§4). */\n\trevokeUnbound(revoked: (principal: Principal) => boolean, error: ChordError): void {\n\t\tfor (const provider of this.#providers.values()) provider.revokeUnbound(revoked, error);\n\t}\n\n\tclosed(): void {\n\t\tthis.#closing.abort();\n\t\tfor (const provider of this.#providers.values()) provider.closed();\n\t\tthis.#providers.clear();\n\t\tthis.consumer.closed();\n\t\tthis.host.unlink(this);\n\t}\n\n\t/** A `hold` goes to its origin's provider side, made for the origin's first. */\n\t#hold(message: Extract<Message, { readonly kind: \"hold\" }>): void {\n\t\tconst origin = message.origin ?? 0;\n\t\tlet provider = this.#providers.get(origin);\n\t\tif (provider === undefined) {\n\t\t\tprovider = new ProviderSide(this, origin, CALLS);\n\t\t\tthis.#providers.set(origin, provider);\n\t\t}\n\t\tprovider.message(message);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { HoldRequest } from "./hold.ts";
|
|
2
|
+
export { HostLink, type LinkRole } from "./host-link.ts";
|
|
3
|
+
export { Path, type PathEvent, type Upstream } from "./path.ts";
|
|
4
|
+
export type { ProviderSide } from "./provider.ts";
|
|
5
|
+
export { RemoteObject } from "./remote-object.ts";
|
|
6
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/next/remote/internal.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Remote objects for Chord's layers: a host's links (both sides of each), the paths its upstream holds take, and the
|
|
2
|
+
// objects of its remote references.
|
|
3
|
+
export { HostLink } from "./host-link.js";
|
|
4
|
+
export { Path } from "./path.js";
|
|
5
|
+
export { RemoteObject } from "./remote-object.js";
|
|
6
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/next/remote/internal.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,oCAAoC;AAGpC,OAAO,EAAE,QAAQ,EAAiB,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAiC,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["// Remote objects for Chord's layers: a host's links (both sides of each), the paths its upstream holds take, and the\n// objects of its remote references.\n\nexport type { HoldRequest } from \"./hold.ts\";\nexport { HostLink, type LinkRole } from \"./host-link.ts\";\nexport { Path, type PathEvent, type Upstream } from \"./path.ts\";\nexport type { ProviderSide } from \"./provider.ts\";\nexport { RemoteObject } from \"./remote-object.ts\";\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ChordError } from "../data/index.ts";
|
|
2
|
+
import type { HostLink } from "./host-link.ts";
|
|
3
|
+
import type { RelayedHold } from "./relay.ts";
|
|
4
|
+
import type { RemoteObject } from "./remote-object.ts";
|
|
5
|
+
/** What a path holds on its links: one of this host's remote references, or a hold it relays. */
|
|
6
|
+
export type Upstream = RemoteObject | RelayedHold;
|
|
7
|
+
/**
|
|
8
|
+
* What changed on a path without a link, for its route: a holder attached, its link dropped (its holders went
|
|
9
|
+
* loading), its last holder left.
|
|
10
|
+
*/
|
|
11
|
+
export type PathEvent = {
|
|
12
|
+
readonly kind: "attached";
|
|
13
|
+
readonly holder: Upstream;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: "dropped";
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "released";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The parent link or one route address: its current link and its holders, held on that link and again on every next
|
|
21
|
+
* one. `changed` runs when it gets a holder without a link, loses its link or its last holder (a route decides whether
|
|
22
|
+
* to resolve), saying which.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Path {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(changed: (event: PathEvent) => void);
|
|
27
|
+
/** The current link while one is open. */
|
|
28
|
+
get link(): HostLink | undefined;
|
|
29
|
+
/** Whether it had a link once (it may be down now: its holders wait for the next). */
|
|
30
|
+
get linked(): boolean;
|
|
31
|
+
/** Whether anything is held over this path. */
|
|
32
|
+
get held(): boolean;
|
|
33
|
+
/** Holds `holder` over this path: on the current link now, and on every next one. */
|
|
34
|
+
attach(holder: Upstream): void;
|
|
35
|
+
/** `holder` was released or ended; no later link holds it. */
|
|
36
|
+
detach(holder: Upstream): void;
|
|
37
|
+
/** `link` is the path's link now: every holder is held on it. */
|
|
38
|
+
connected(link: HostLink): void;
|
|
39
|
+
/** `link` closed (its sides ended their calls already): every holder goes loading until the next link. */
|
|
40
|
+
disconnected(link: HostLink): void;
|
|
41
|
+
/** Its address cannot be reached for now (a route's `resolve` failed, a suspension): every holder fails waiting. */
|
|
42
|
+
unreachable(error: ChordError): void;
|
|
43
|
+
/** Every holder, for the host's close. */
|
|
44
|
+
holders(): Upstream[];
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/next/remote/path.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,iGAAiG;AACjG,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,GACxD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAMjC;;;;GAIG;AACH,qBAAa,IAAI;;IAOhB,YAAY,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,EAE9C;IAED,0CAA0C;IAC1C,IAAI,IAAI,IAAI,QAAQ,GAAG,SAAS,CAE/B;IAED,sFAAsF;IACtF,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,+CAA+C;IAC/C,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,qFAAqF;IACrF,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAI7B;IAED,8DAA8D;IAC9D,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAG7B;IAED,iEAAiE;IACjE,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAI9B;IAED,0GAA0G;IAC1G,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAMjC;IAED,oHAAoH;IACpH,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAEnC;IAED,0CAA0C;IAC1C,OAAO,IAAI,QAAQ,EAAE,CAEpB;CACD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Paths (§3 recovery): where this host's upstream holds go, the parent link or a route address's link, across links.
|
|
2
|
+
// Each new link of a path holds every holder of the path again; when it drops, every holder is told.
|
|
3
|
+
import { ChordError } from "../data/index.js";
|
|
4
|
+
const RELEASED = { kind: "released" };
|
|
5
|
+
const DROPPED = { kind: "dropped" };
|
|
6
|
+
/**
|
|
7
|
+
* The parent link or one route address: its current link and its holders, held on that link and again on every next
|
|
8
|
+
* one. `changed` runs when it gets a holder without a link, loses its link or its last holder (a route decides whether
|
|
9
|
+
* to resolve), saying which.
|
|
10
|
+
*/
|
|
11
|
+
export class Path {
|
|
12
|
+
#holders = new Set();
|
|
13
|
+
#changed;
|
|
14
|
+
#link;
|
|
15
|
+
/** Whether it ever had a link: a host never connected to a parent has no parent path to wait on. */
|
|
16
|
+
#linked = false;
|
|
17
|
+
constructor(changed) {
|
|
18
|
+
this.#changed = changed;
|
|
19
|
+
}
|
|
20
|
+
/** The current link while one is open. */
|
|
21
|
+
get link() {
|
|
22
|
+
return this.#link;
|
|
23
|
+
}
|
|
24
|
+
/** Whether it had a link once (it may be down now: its holders wait for the next). */
|
|
25
|
+
get linked() {
|
|
26
|
+
return this.#linked;
|
|
27
|
+
}
|
|
28
|
+
/** Whether anything is held over this path. */
|
|
29
|
+
get held() {
|
|
30
|
+
return this.#holders.size > 0;
|
|
31
|
+
}
|
|
32
|
+
/** Holds `holder` over this path: on the current link now, and on every next one. */
|
|
33
|
+
attach(holder) {
|
|
34
|
+
this.#holders.add(holder);
|
|
35
|
+
if (this.#link === undefined)
|
|
36
|
+
this.#changed({ kind: "attached", holder });
|
|
37
|
+
else
|
|
38
|
+
holder.attach(this.#link);
|
|
39
|
+
}
|
|
40
|
+
/** `holder` was released or ended; no later link holds it. */
|
|
41
|
+
detach(holder) {
|
|
42
|
+
this.#holders.delete(holder);
|
|
43
|
+
if (this.#holders.size === 0)
|
|
44
|
+
this.#changed(RELEASED);
|
|
45
|
+
}
|
|
46
|
+
/** `link` is the path's link now: every holder is held on it. */
|
|
47
|
+
connected(link) {
|
|
48
|
+
this.#link = link;
|
|
49
|
+
this.#linked = true;
|
|
50
|
+
for (const holder of this.#holders)
|
|
51
|
+
holder.attach(link);
|
|
52
|
+
}
|
|
53
|
+
/** `link` closed (its sides ended their calls already): every holder goes loading until the next link. */
|
|
54
|
+
disconnected(link) {
|
|
55
|
+
if (this.#link !== link)
|
|
56
|
+
return;
|
|
57
|
+
this.#link = undefined;
|
|
58
|
+
const error = new ChordError({ code: "unavailable", message: "the link closed" });
|
|
59
|
+
for (const holder of this.#holders)
|
|
60
|
+
holder.dropped(error);
|
|
61
|
+
this.#changed(DROPPED);
|
|
62
|
+
}
|
|
63
|
+
/** Its address cannot be reached for now (a route's `resolve` failed, a suspension): every holder fails waiting. */
|
|
64
|
+
unreachable(error) {
|
|
65
|
+
for (const holder of this.#holders)
|
|
66
|
+
holder.unreachable(error);
|
|
67
|
+
}
|
|
68
|
+
/** Every holder, for the host's close. */
|
|
69
|
+
holders() {
|
|
70
|
+
return [...this.#holders];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=path.js.map
|
|
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,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC;YAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED,iEAAiE;IACjE,SAAS,CAAC,IAAc;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,0GAA0G;IAC1G,YAAY,CAAC,IAAc;QAC1B,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;YAAE,OAAO;QAChC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC;QAClF,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;IAED,oHAAoH;IACpH,WAAW,CAAC,KAAiB;QAC5B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED,0CAA0C;IAC1C,OAAO;QACN,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;CACD","sourcesContent":["// Paths (§3 recovery): where this host's upstream holds go, the parent link or a route address's link, across links.\n// Each new link of a path holds every holder of the path again; when it drops, every holder is told.\n\nimport { ChordError } from \"../data/index.ts\";\nimport type { HostLink } from \"./host-link.ts\";\nimport type { RelayedHold } from \"./relay.ts\";\nimport type { RemoteObject } from \"./remote-object.ts\";\n\n/** What a path holds on its links: one of this host's remote references, or a hold it relays. */\nexport type Upstream = RemoteObject | RelayedHold;\n\n/**\n * What changed on a path without a link, for its route: a holder attached, its link dropped (its holders went\n * loading), its last holder left.\n */\nexport type PathEvent =\n\t| { readonly kind: \"attached\"; readonly holder: Upstream }\n\t| { readonly kind: \"dropped\" }\n\t| { readonly kind: \"released\" };\n\nconst RELEASED: PathEvent = { kind: \"released\" };\n\nconst DROPPED: PathEvent = { kind: \"dropped\" };\n\n/**\n * The parent link or one route address: its current link and its holders, held on that link and again on every next\n * one. `changed` runs when it gets a holder without a link, loses its link or its last holder (a route decides whether\n * to resolve), saying which.\n */\nexport class Path {\n\treadonly #holders = new Set<Upstream>();\n\treadonly #changed: (event: PathEvent) => void;\n\t#link: HostLink | undefined;\n\t/** Whether it ever had a link: a host never connected to a parent has no parent path to wait on. */\n\t#linked = false;\n\n\tconstructor(changed: (event: PathEvent) => void) {\n\t\tthis.#changed = changed;\n\t}\n\n\t/** The current link while one is open. */\n\tget link(): HostLink | undefined {\n\t\treturn this.#link;\n\t}\n\n\t/** Whether it had a link once (it may be down now: its holders wait for the next). */\n\tget linked(): boolean {\n\t\treturn this.#linked;\n\t}\n\n\t/** Whether anything is held over this path. */\n\tget held(): boolean {\n\t\treturn this.#holders.size > 0;\n\t}\n\n\t/** Holds `holder` over this path: on the current link now, and on every next one. */\n\tattach(holder: Upstream): void {\n\t\tthis.#holders.add(holder);\n\t\tif (this.#link === undefined) this.#changed({ kind: \"attached\", holder });\n\t\telse holder.attach(this.#link);\n\t}\n\n\t/** `holder` was released or ended; no later link holds it. */\n\tdetach(holder: Upstream): void {\n\t\tthis.#holders.delete(holder);\n\t\tif (this.#holders.size === 0) this.#changed(RELEASED);\n\t}\n\n\t/** `link` is the path's link now: every holder is held on it. */\n\tconnected(link: HostLink): void {\n\t\tthis.#link = link;\n\t\tthis.#linked = true;\n\t\tfor (const holder of this.#holders) holder.attach(link);\n\t}\n\n\t/** `link` closed (its sides ended their calls already): every holder goes loading until the next link. */\n\tdisconnected(link: HostLink): void {\n\t\tif (this.#link !== link) return;\n\t\tthis.#link = undefined;\n\t\tconst error = new ChordError({ code: \"unavailable\", message: \"the link closed\" });\n\t\tfor (const holder of this.#holders) holder.dropped(error);\n\t\tthis.#changed(DROPPED);\n\t}\n\n\t/** Its address cannot be reached for now (a route's `resolve` failed, a suspension): every holder fails waiting. */\n\tunreachable(error: ChordError): void {\n\t\tfor (const holder of this.#holders) holder.unreachable(error);\n\t}\n\n\t/** Every holder, for the host's close. */\n\tholders(): Upstream[] {\n\t\treturn [...this.#holders];\n\t}\n}\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type Context } from "../../context/index.ts";
|
|
2
|
+
import { ChordError, type Principal } from "../data/index.ts";
|
|
3
|
+
import { type ConsumerMessage, type OriginMessage, type ProviderMessage } from "../link/internal.ts";
|
|
4
|
+
import { Hold } from "./hold.ts";
|
|
5
|
+
import type { HostLink } from "./host-link.ts";
|
|
6
|
+
import type { RelayedHold } from "./relay.ts";
|
|
7
|
+
/**
|
|
8
|
+
* The provider side of one origin on a link. Ids are the origin's; a message naming an id this side does not know is
|
|
9
|
+
* ignored (Q1), one reusing a live id is a protocol error, and so are more concurrent calls than this side announced.
|
|
10
|
+
* This host's own `bound` and `state` messages go through the window: locally served holds wait while it is full
|
|
11
|
+
* (their ops in their members' pending queues, their bindings for the next slot). A relay forwards upstream messages
|
|
12
|
+
* at once (each upstream host keeps its own window for the origin it sees), so a slow consumer stalls only its origin.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ProviderSide {
|
|
15
|
+
#private;
|
|
16
|
+
readonly link: HostLink;
|
|
17
|
+
/** Whose work this side serves: 0 for the peer's own, a relay's number for one of its downstream links. */
|
|
18
|
+
readonly origin: number;
|
|
19
|
+
constructor(link: HostLink, origin: number, limit: number);
|
|
20
|
+
/** Handles one message of this origin; a call whose arguments wait for an asynchronous inflate returns its promise. */
|
|
21
|
+
message(message: ProviderMessage): void | Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* The link closed, or the origin did (`closed`): every hold is released (relayed ones by one `closed` to each
|
|
24
|
+
* upstream link) and every call aborted.
|
|
25
|
+
*/
|
|
26
|
+
closed(): void;
|
|
27
|
+
/** Sends `message` on the link with this origin. */
|
|
28
|
+
send(message: OriginMessage): void;
|
|
29
|
+
/**
|
|
30
|
+
* Ends with `error` every hold of this origin that acts for a principal `revoked` names and holds nothing: served
|
|
31
|
+
* here but unbound (before the publication, refused), or relayed and waiting for its route's link.
|
|
32
|
+
*/
|
|
33
|
+
revokeUnbound(revoked: (principal: Principal) => boolean, error: ChordError): void;
|
|
34
|
+
/** A pending hold turned out to be relayed: it takes the hold's place in the table. */
|
|
35
|
+
relayed(hold: RelayedHold): void;
|
|
36
|
+
/** This origin's number on upstream links (one per host, never reused), with `link` as one it relays to. */
|
|
37
|
+
relayTo(link: HostLink): number;
|
|
38
|
+
/**
|
|
39
|
+
* A message from upstream link `from` for this origin's relayed holds, forwarded with this origin: `bound` and
|
|
40
|
+
* `state` join the window's senders (their `ack` goes back to `from`), a reply ends its call, `gone` forgets its
|
|
41
|
+
* hold. A link answers only for what was relayed over it: an entry, a notice or a reply naming a hold (or a call)
|
|
42
|
+
* this origin did not relay over `from` is dropped (Q1); a `bound` or `state` left without entries is acknowledged
|
|
43
|
+
* to `from` at once. Parts travel unchecked and unparsed: the end that parses a part checks it against its own
|
|
44
|
+
* link's limits.
|
|
45
|
+
*/
|
|
46
|
+
forward(message: ConsumerMessage, from: HostLink): void;
|
|
47
|
+
/** An upstream link closed: nothing more is relayed to it, nor accepted from it. */
|
|
48
|
+
unlinked(link: HostLink): void;
|
|
49
|
+
/**
|
|
50
|
+
* The upstream link of relayed hold `hold` dropped with `error`: its calls in flight fail, the hold goes loading
|
|
51
|
+
* downstream, and its path's next link holds it again.
|
|
52
|
+
*/
|
|
53
|
+
upstreamDropped(hold: RelayedHold, error: ChordError): void;
|
|
54
|
+
/**
|
|
55
|
+
* Forgets a hold (released, refused or gone) and every call on it; local calls are aborted with `error` (its
|
|
56
|
+
* object's end for a gone hold, `released` otherwise).
|
|
57
|
+
*/
|
|
58
|
+
forget(hold: Hold | RelayedHold, error?: ChordError): void;
|
|
59
|
+
/** A call ended with `reply` (a result or an error): its slot is free; nothing is sent for one already gone. */
|
|
60
|
+
reply(id: number, reply: Extract<OriginMessage, {
|
|
61
|
+
readonly kind: "result" | "error";
|
|
62
|
+
}>): void;
|
|
63
|
+
/** A hold's object is live: its `bound` goes now when a slot is free, else with the next free slot's bindings. */
|
|
64
|
+
bind(hold: Hold, context: Context): void;
|
|
65
|
+
/** A hold stopped waiting for a slot: it was forgotten. */
|
|
66
|
+
unbind(hold: Hold): void;
|
|
67
|
+
/**
|
|
68
|
+
* A served hold left its object's binding (slice 7b §6, model §5): its unsent pending ops and a queued `bound` are
|
|
69
|
+
* dropped (the ack slots of messages already sent stay until their `ack`), its calls in flight rejected with `error`
|
|
70
|
+
* (each slot freed once).
|
|
71
|
+
*/
|
|
72
|
+
unbound(hold: Hold, error: ChordError): void;
|
|
73
|
+
/** A hold's members changed in the current batch; its flush sends or queues it. */
|
|
74
|
+
touched(hold: Hold): void;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/next/remote/provider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAmB,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAgB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAEN,KAAK,eAAe,EAGpB,KAAK,aAAa,EAElB,KAAK,eAAe,EAKpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM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