@moq/net 0.4.8 → 0.22.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/README.md +7 -1
- package/announce.d.ts +1 -1
- package/announce.d.ts.map +1 -1
- package/announce.js +1 -1
- package/announce.js.map +1 -1
- package/announced.d.ts +51 -47
- package/announced.d.ts.map +1 -1
- package/announced.js +183 -31
- package/announced.js.map +1 -1
- package/announced.test-util.d.ts +2 -0
- package/announced.test-util.d.ts.map +1 -0
- package/announced.test-util.js +27 -0
- package/announced.test-util.js.map +1 -0
- package/auth.d.ts +64 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +20 -0
- package/auth.js.map +1 -0
- package/auth_gate.d.ts +2 -0
- package/auth_gate.d.ts.map +1 -0
- package/auth_gate.js +24 -0
- package/auth_gate.js.map +1 -0
- package/auth_session.d.ts +49 -0
- package/auth_session.d.ts.map +1 -0
- package/auth_session.js +1097 -0
- package/auth_session.js.map +1 -0
- package/bandwidth.d.ts +129 -25
- package/bandwidth.d.ts.map +1 -1
- package/bandwidth.js +410 -138
- package/bandwidth.js.map +1 -1
- package/bandwidth_api.d.ts +1 -1
- package/bandwidth_api.d.ts.map +1 -1
- package/bandwidth_api.js +1 -1
- package/bandwidth_api.js.map +1 -1
- package/broadcast.d.ts +62 -36
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +556 -172
- package/broadcast.js.map +1 -1
- package/cache.d.ts +103 -0
- package/cache.d.ts.map +1 -0
- package/cache.js +254 -0
- package/cache.js.map +1 -0
- package/claim.test-util.d.ts +5 -0
- package/claim.test-util.d.ts.map +1 -0
- package/claim.test-util.js +13 -0
- package/claim.test-util.js.map +1 -0
- package/connection/accept.d.ts +20 -12
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +97 -129
- package/connection/accept.js.map +1 -1
- package/connection/browser.d.ts.map +1 -1
- package/connection/browser.js +28 -19
- package/connection/browser.js.map +1 -1
- package/connection/connect.d.ts +119 -23
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +535 -216
- package/connection/connect.js.map +1 -1
- package/connection/dials.d.ts +45 -0
- package/connection/dials.d.ts.map +1 -0
- package/connection/dials.js +109 -0
- package/connection/dials.js.map +1 -0
- package/connection/endpoint.d.ts +60 -0
- package/connection/endpoint.d.ts.map +1 -0
- package/connection/endpoint.js +114 -0
- package/connection/endpoint.js.map +1 -0
- package/connection/forward.d.ts +7 -1
- package/connection/forward.d.ts.map +1 -1
- package/connection/forward.js +265 -80
- package/connection/forward.js.map +1 -1
- package/connection/goaway.d.ts +16 -9
- package/connection/goaway.d.ts.map +1 -1
- package/connection/goaway.js +22 -108
- package/connection/goaway.js.map +1 -1
- package/connection/handshake.d.ts +32 -6
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +97 -20
- package/connection/handshake.js.map +1 -1
- package/connection/index.d.ts +3 -6
- package/connection/index.d.ts.map +1 -1
- package/connection/index.js +1 -2
- package/connection/index.js.map +1 -1
- package/connection/liveness.d.ts +14 -0
- package/connection/liveness.d.ts.map +1 -0
- package/connection/liveness.js +30 -0
- package/connection/liveness.js.map +1 -0
- package/connection/pool.d.ts +137 -58
- package/connection/pool.d.ts.map +1 -1
- package/connection/pool.js +281 -117
- package/connection/pool.js.map +1 -1
- package/connection/reload.d.ts +60 -12
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +859 -233
- package/connection/reload.js.map +1 -1
- package/connection/session.d.ts +91 -0
- package/connection/session.d.ts.map +1 -0
- package/connection/session.js +2 -0
- package/connection/session.js.map +1 -0
- package/connection/stats.d.ts +20 -11
- package/connection/stats.d.ts.map +1 -1
- package/connection/stats.js +64 -8
- package/connection/stats.js.map +1 -1
- package/connection/ticker.d.ts +4 -0
- package/connection/ticker.d.ts.map +1 -0
- package/connection/ticker.js +66 -0
- package/connection/ticker.js.map +1 -0
- package/connection/tokens.d.ts +2 -0
- package/connection/tokens.d.ts.map +1 -0
- package/connection/tokens.js +404 -0
- package/connection/tokens.js.map +1 -0
- package/connection/transport.d.ts.map +1 -1
- package/connection/transport.js +4 -4
- package/connection/transport.js.map +1 -1
- package/connection/withdrawal.d.ts +2 -0
- package/connection/withdrawal.d.ts.map +1 -0
- package/connection/withdrawal.js +23 -0
- package/connection/withdrawal.js.map +1 -0
- package/consume.js +213 -46
- package/consume.js.map +1 -1
- package/cover.d.ts +59 -0
- package/cover.d.ts.map +1 -0
- package/cover.js +375 -0
- package/cover.js.map +1 -0
- package/datagram.d.ts +70 -11
- package/datagram.d.ts.map +1 -1
- package/datagram.js +317 -1
- package/datagram.js.map +1 -1
- package/datagram_stream.d.ts +18 -0
- package/datagram_stream.d.ts.map +1 -0
- package/datagram_stream.js +67 -0
- package/datagram_stream.js.map +1 -0
- package/defined.test-util.d.ts +2 -0
- package/defined.test-util.d.ts.map +1 -0
- package/defined.test-util.js +7 -0
- package/defined.test-util.js.map +1 -0
- package/delivered.d.ts +75 -0
- package/delivered.d.ts.map +1 -0
- package/delivered.js +228 -0
- package/delivered.js.map +1 -0
- package/demand.d.ts +173 -0
- package/demand.d.ts.map +1 -0
- package/demand.js +582 -0
- package/demand.js.map +1 -0
- package/drops.d.ts +93 -0
- package/drops.d.ts.map +1 -0
- package/drops.js +283 -0
- package/drops.js.map +1 -0
- package/error.d.ts +120 -21
- package/error.d.ts.map +1 -1
- package/error.js +230 -37
- package/error.js.map +1 -1
- package/errors.d.ts +2 -2
- package/errors.d.ts.map +1 -1
- package/errors.js +2 -2
- package/errors.js.map +1 -1
- package/fill.d.ts +174 -0
- package/fill.d.ts.map +1 -0
- package/fill.js +760 -0
- package/fill.js.map +1 -0
- package/flate/decoder.d.ts +2 -0
- package/flate/decoder.d.ts.map +1 -0
- package/flate/decoder.js +63 -0
- package/flate/decoder.js.map +1 -0
- package/flate/encoder.d.ts +2 -0
- package/flate/encoder.d.ts.map +1 -0
- package/flate/encoder.js +64 -0
- package/flate/encoder.js.map +1 -0
- package/flate/group.d.ts +34 -0
- package/flate/group.d.ts.map +1 -0
- package/flate/group.js +140 -0
- package/flate/group.js.map +1 -0
- package/frame.d.ts +80 -0
- package/frame.d.ts.map +1 -0
- package/frame.js +296 -0
- package/frame.js.map +1 -0
- package/frame.test-util.d.ts +5 -0
- package/frame.test-util.d.ts.map +1 -0
- package/frame.test-util.js +9 -0
- package/frame.test-util.js.map +1 -0
- package/group.d.ts +108 -45
- package/group.d.ts.map +1 -1
- package/group.js +1616 -307
- package/group.js.map +1 -1
- package/group_api.d.ts +7 -0
- package/group_api.d.ts.map +1 -0
- package/group_api.js +7 -0
- package/group_api.js.map +1 -0
- package/hop.d.ts +62 -76
- package/hop.d.ts.map +1 -1
- package/hop.js +92 -64
- package/hop.js.map +1 -1
- package/identity.d.ts +39 -0
- package/identity.d.ts.map +1 -0
- package/identity.js +47 -0
- package/identity.js.map +1 -0
- package/ietf/active_count.d.ts +2 -0
- package/ietf/active_count.d.ts.map +1 -0
- package/ietf/active_count.js +30 -0
- package/ietf/active_count.js.map +1 -0
- package/ietf/aliases.js +69 -35
- package/ietf/aliases.js.map +1 -1
- package/ietf/cluster.d.ts +3 -3
- package/ietf/cluster.js +14 -62
- package/ietf/cluster.js.map +1 -1
- package/ietf/connection.d.ts +1 -31
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +305 -143
- package/ietf/connection.js.map +1 -1
- package/ietf/datagram.d.ts +60 -0
- package/ietf/datagram.d.ts.map +1 -0
- package/ietf/datagram.js +152 -0
- package/ietf/datagram.js.map +1 -0
- package/ietf/error.d.ts +3 -3
- package/ietf/error.js +82 -100
- package/ietf/error.js.map +1 -1
- package/ietf/fetch.d.ts +91 -35
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +172 -93
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +20 -30
- package/ietf/filter.d.ts.map +1 -1
- package/ietf/filter.js +140 -171
- package/ietf/filter.js.map +1 -1
- package/ietf/goaway.d.ts +11 -9
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +22 -35
- package/ietf/goaway.js.map +1 -1
- package/ietf/hidden.js +1 -1
- package/ietf/hidden.js.map +1 -1
- package/ietf/index.d.ts +2 -14
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +4 -14
- package/ietf/index.js.map +1 -1
- package/ietf/join.d.ts +7 -0
- package/ietf/join.d.ts.map +1 -0
- package/ietf/join.js +234 -0
- package/ietf/join.js.map +1 -0
- package/ietf/message.d.ts +18 -2
- package/ietf/message.d.ts.map +1 -1
- package/ietf/message.js +60 -40
- package/ietf/message.js.map +1 -1
- package/ietf/message.test-util.d.ts +6 -0
- package/ietf/message.test-util.d.ts.map +1 -0
- package/ietf/message.test-util.js +13 -0
- package/ietf/message.test-util.js.map +1 -0
- package/ietf/namespace.d.ts +17 -3
- package/ietf/namespace.d.ts.map +1 -1
- package/ietf/namespace.js +78 -26
- package/ietf/namespace.js.map +1 -1
- package/ietf/object.d.ts +194 -32
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +405 -178
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +22 -42
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +260 -472
- package/ietf/parameters.js.map +1 -1
- package/ietf/priority.d.ts +17 -2
- package/ietf/priority.d.ts.map +1 -1
- package/ietf/priority.js +19 -4
- package/ietf/priority.js.map +1 -1
- package/ietf/properties.d.ts +5 -4
- package/ietf/properties.d.ts.map +1 -1
- package/ietf/properties.js +78 -48
- package/ietf/properties.js.map +1 -1
- package/ietf/publish.d.ts +22 -30
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +45 -139
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +46 -69
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +66 -184
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.js +1800 -600
- package/ietf/publisher.js.map +1 -1
- package/ietf/range.d.ts +2 -0
- package/ietf/range.d.ts.map +1 -0
- package/ietf/range.js +222 -0
- package/ietf/range.js.map +1 -0
- package/ietf/request.d.ts +3 -27
- package/ietf/request.d.ts.map +1 -1
- package/ietf/request.js +41 -78
- package/ietf/request.js.map +1 -1
- package/ietf/request_stream.d.ts +1 -6
- package/ietf/request_stream.d.ts.map +1 -1
- package/ietf/request_stream.js +306 -16
- package/ietf/request_stream.js.map +1 -1
- package/ietf/session.d.ts +41 -0
- package/ietf/session.d.ts.map +1 -0
- package/ietf/session.js +65 -0
- package/ietf/session.js.map +1 -0
- package/ietf/setup.d.ts +4 -29
- package/ietf/setup.d.ts.map +1 -1
- package/ietf/setup.js +6 -117
- package/ietf/setup.js.map +1 -1
- package/ietf/setup_options.d.ts +31 -0
- package/ietf/setup_options.d.ts.map +1 -0
- package/ietf/setup_options.js +138 -0
- package/ietf/setup_options.js.map +1 -0
- package/ietf/solicit.js +4 -14
- package/ietf/solicit.js.map +1 -1
- package/ietf/subscribe.d.ts +48 -41
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +118 -239
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +13 -76
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +30 -201
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.js +1839 -536
- package/ietf/subscriber.js.map +1 -1
- package/ietf/token.js +105 -27
- package/ietf/token.js.map +1 -1
- package/ietf/track.d.ts +25 -22
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +48 -61
- package/ietf/track.js.map +1 -1
- package/ietf/version.d.ts +13 -42
- package/ietf/version.d.ts.map +1 -1
- package/ietf/version.js +22 -48
- package/ietf/version.js.map +1 -1
- package/implementation.d.ts +2 -0
- package/implementation.d.ts.map +1 -0
- package/implementation.js +5 -0
- package/implementation.js.map +1 -0
- package/index.d.ts +25 -10
- package/index.d.ts.map +1 -1
- package/index.js +19 -6
- package/index.js.map +1 -1
- package/internal.d.ts +1512 -64
- package/internal.d.ts.map +1 -1
- package/internal.js +557 -79
- package/internal.js.map +1 -1
- package/ledger.d.ts +23 -0
- package/ledger.d.ts.map +1 -0
- package/ledger.js +247 -0
- package/ledger.js.map +1 -0
- package/listing.d.ts +132 -0
- package/listing.d.ts.map +1 -0
- package/listing.js +486 -0
- package/listing.js.map +1 -0
- package/lite/announce.d.ts +124 -63
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +384 -158
- package/lite/announce.js.map +1 -1
- package/lite/announce_stream.d.ts +2 -0
- package/lite/announce_stream.d.ts.map +1 -0
- package/lite/announce_stream.js +92 -0
- package/lite/announce_stream.js.map +1 -0
- package/lite/answer.d.ts +22 -0
- package/lite/answer.d.ts.map +1 -0
- package/lite/answer.js +301 -0
- package/lite/answer.js.map +1 -0
- package/lite/auth.d.ts +45 -0
- package/lite/auth.d.ts.map +1 -0
- package/lite/auth.js +204 -0
- package/lite/auth.js.map +1 -0
- package/lite/compat.d.ts +31 -0
- package/lite/compat.d.ts.map +1 -0
- package/lite/compat.js +86 -0
- package/lite/compat.js.map +1 -0
- package/lite/connection.d.ts +1 -45
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +360 -77
- package/lite/connection.js.map +1 -1
- package/lite/datagram-end.d.ts +26 -0
- package/lite/datagram-end.d.ts.map +1 -0
- package/lite/datagram-end.js +30 -0
- package/lite/datagram-end.js.map +1 -0
- package/lite/datagram.d.ts +73 -8
- package/lite/datagram.d.ts.map +1 -1
- package/lite/datagram.js +144 -9
- package/lite/datagram.js.map +1 -1
- package/lite/duration.d.ts +6 -0
- package/lite/duration.d.ts.map +1 -0
- package/lite/duration.js +14 -0
- package/lite/duration.js.map +1 -0
- package/lite/error.d.ts +9 -0
- package/lite/error.d.ts.map +1 -0
- package/lite/error.js +24 -0
- package/lite/error.js.map +1 -0
- package/lite/fills.d.ts +162 -0
- package/lite/fills.d.ts.map +1 -0
- package/lite/fills.js +486 -0
- package/lite/fills.js.map +1 -0
- package/lite/fit.d.ts +49 -0
- package/lite/fit.d.ts.map +1 -0
- package/lite/fit.js +305 -0
- package/lite/fit.js.map +1 -0
- package/lite/goaway.d.ts +1 -1
- package/lite/goaway.d.ts.map +1 -1
- package/lite/goaway.js +5 -13
- package/lite/goaway.js.map +1 -1
- package/lite/group.d.ts +64 -13
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +108 -30
- package/lite/group.js.map +1 -1
- package/lite/identity.d.ts +25 -0
- package/lite/identity.d.ts.map +1 -0
- package/lite/identity.js +79 -0
- package/lite/identity.js.map +1 -0
- package/lite/index.d.ts +2 -1
- package/lite/index.d.ts.map +1 -1
- package/lite/index.js +2 -1
- package/lite/index.js.map +1 -1
- package/lite/message.d.ts +9 -1
- package/lite/message.d.ts.map +1 -1
- package/lite/message.js +28 -44
- package/lite/message.js.map +1 -1
- package/lite/priority.d.ts +9 -2
- package/lite/priority.d.ts.map +1 -1
- package/lite/priority.js +11 -105
- package/lite/priority.js.map +1 -1
- package/lite/probe.d.ts.map +1 -1
- package/lite/probe.js +9 -0
- package/lite/probe.js.map +1 -1
- package/lite/publisher.d.ts +10 -1
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +2548 -437
- package/lite/publisher.js.map +1 -1
- package/lite/routed.d.ts +59 -0
- package/lite/routed.d.ts.map +1 -0
- package/lite/routed.js +564 -0
- package/lite/routed.js.map +1 -0
- package/lite/session.d.ts +1 -27
- package/lite/session.d.ts.map +1 -1
- package/lite/session.js +0 -99
- package/lite/session.js.map +1 -1
- package/lite/setup.d.ts +29 -2
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +95 -21
- package/lite/setup.js.map +1 -1
- package/lite/stream.d.ts +5 -11
- package/lite/stream.d.ts.map +1 -1
- package/lite/stream.js +5 -1
- package/lite/stream.js.map +1 -1
- package/lite/subscribe.d.ts +475 -75
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +1373 -142
- package/lite/subscribe.js.map +1 -1
- package/lite/subscriber.d.ts +7 -44
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +3290 -515
- package/lite/subscriber.js.map +1 -1
- package/lite/track.d.ts +24 -9
- package/lite/track.d.ts.map +1 -1
- package/lite/track.js +116 -37
- package/lite/track.js.map +1 -1
- package/lite/tracks.d.ts +55 -0
- package/lite/tracks.d.ts.map +1 -0
- package/lite/tracks.js +114 -0
- package/lite/tracks.js.map +1 -0
- package/lite/version.d.ts +132 -24
- package/lite/version.d.ts.map +1 -1
- package/lite/version.js +378 -33
- package/lite/version.js.map +1 -1
- package/meta.d.ts +77 -0
- package/meta.d.ts.map +1 -0
- package/meta.js +130 -0
- package/meta.js.map +1 -0
- package/meta_api.d.ts +7 -0
- package/meta_api.d.ts.map +1 -0
- package/meta_api.js +7 -0
- package/meta_api.js.map +1 -0
- package/mint.d.ts +28 -0
- package/mint.d.ts.map +1 -0
- package/mint.js +66 -0
- package/mint.js.map +1 -0
- package/open.d.ts +63 -0
- package/open.d.ts.map +1 -0
- package/open.js +250 -0
- package/open.js.map +1 -0
- package/origin.d.ts +392 -140
- package/origin.d.ts.map +1 -1
- package/origin.js +2533 -686
- package/origin.js.map +1 -1
- package/package.json +8 -13
- package/path.d.ts +51 -51
- package/path.d.ts.map +1 -1
- package/path.js +210 -57
- package/path.js.map +1 -1
- package/payload.d.ts +33 -0
- package/payload.d.ts.map +1 -0
- package/payload.js +65 -0
- package/payload.js.map +1 -0
- package/prefix.d.ts +152 -0
- package/prefix.d.ts.map +1 -0
- package/prefix.js +349 -0
- package/prefix.js.map +1 -0
- package/priority.d.ts +8 -0
- package/priority.d.ts.map +1 -0
- package/priority.js +185 -0
- package/priority.js.map +1 -0
- package/queue.d.ts +2 -0
- package/queue.d.ts.map +1 -0
- package/queue.js +46 -0
- package/queue.js.map +1 -0
- package/ranges.d.ts +36 -0
- package/ranges.d.ts.map +1 -0
- package/ranges.js +312 -0
- package/ranges.js.map +1 -0
- package/rescale.d.ts +24 -0
- package/rescale.d.ts.map +1 -0
- package/rescale.js +39 -0
- package/rescale.js.map +1 -0
- package/resume.d.ts +55 -0
- package/resume.d.ts.map +1 -0
- package/resume.js +4173 -0
- package/resume.js.map +1 -0
- package/resume.test-util.d.ts +2 -0
- package/resume.test-util.d.ts.map +1 -0
- package/resume.test-util.js +25 -0
- package/resume.test-util.js.map +1 -0
- package/skips.d.ts +48 -0
- package/skips.d.ts.map +1 -0
- package/skips.js +182 -0
- package/skips.js.map +1 -0
- package/stream.d.ts +75 -37
- package/stream.d.ts.map +1 -1
- package/stream.js +236 -92
- package/stream.js.map +1 -1
- package/subscription.test-util.d.ts +2 -0
- package/subscription.test-util.d.ts.map +1 -0
- package/subscription.test-util.js +49 -0
- package/subscription.test-util.js.map +1 -0
- package/tail.d.ts +23 -14
- package/tail.d.ts.map +1 -1
- package/tail.js +224 -97
- package/tail.js.map +1 -1
- package/time.d.ts +41 -102
- package/time.d.ts.map +1 -1
- package/time.js +129 -91
- package/time.js.map +1 -1
- package/timed.d.ts +21 -0
- package/timed.d.ts.map +1 -0
- package/timed.js +2 -0
- package/timed.js.map +1 -0
- package/track.d.ts +577 -245
- package/track.d.ts.map +1 -1
- package/track.js +7306 -771
- package/track.js.map +1 -1
- package/track_api.d.ts +7 -0
- package/track_api.d.ts.map +1 -0
- package/track_api.js +7 -0
- package/track_api.js.map +1 -0
- package/util/abort.d.ts +1 -0
- package/util/abort.d.ts.map +1 -1
- package/util/abort.js +23 -1
- package/util/abort.js.map +1 -1
- package/util/announce.d.ts +4 -0
- package/util/announce.d.ts.map +1 -0
- package/util/announce.js +11 -0
- package/util/announce.js.map +1 -0
- package/util/bigint.d.ts +3 -0
- package/util/bigint.d.ts.map +1 -0
- package/util/bigint.js +8 -0
- package/util/bigint.js.map +1 -0
- package/util/change.d.ts +12 -0
- package/util/change.d.ts.map +1 -0
- package/util/change.js +18 -0
- package/util/change.js.map +1 -0
- package/util/deadline.d.ts +2 -0
- package/util/deadline.d.ts.map +1 -0
- package/util/deadline.js +108 -0
- package/util/deadline.js.map +1 -0
- package/util/decode_error.d.ts +3 -0
- package/util/decode_error.d.ts.map +1 -0
- package/util/decode_error.js +11 -0
- package/util/decode_error.js.map +1 -0
- package/util/demand.d.ts +8 -0
- package/util/demand.d.ts.map +1 -0
- package/util/demand.js +24 -0
- package/util/demand.js.map +1 -0
- package/util/given_up.d.ts +2 -0
- package/util/given_up.d.ts.map +1 -0
- package/util/given_up.js +101 -0
- package/util/given_up.js.map +1 -0
- package/util/hex.d.ts +6 -0
- package/util/hex.d.ts.map +1 -1
- package/util/hex.js +19 -4
- package/util/hex.js.map +1 -1
- package/util/key.d.ts +15 -0
- package/util/key.d.ts.map +1 -0
- package/util/key.js +38 -0
- package/util/key.js.map +1 -0
- package/util/limits.d.ts +2 -0
- package/util/limits.d.ts.map +1 -0
- package/util/limits.js +76 -0
- package/util/limits.js.map +1 -0
- package/util/observed.d.ts +23 -0
- package/util/observed.d.ts.map +1 -0
- package/util/observed.js +122 -0
- package/util/observed.js.map +1 -0
- package/util/sorted.d.ts +2 -0
- package/util/sorted.d.ts.map +1 -0
- package/util/sorted.js +149 -0
- package/util/sorted.js.map +1 -0
- package/util/timeout.d.ts +2 -1
- package/util/timeout.d.ts.map +1 -1
- package/util/timeout.js +13 -9
- package/util/timeout.js.map +1 -1
- package/util/timer.d.ts +2 -0
- package/util/timer.d.ts.map +1 -0
- package/util/timer.js +19 -0
- package/util/timer.js.map +1 -0
- package/util/utf8.d.ts +2 -0
- package/util/utf8.d.ts.map +1 -1
- package/util/utf8.js +7 -1
- package/util/utf8.js.map +1 -1
- package/util/varint.d.ts.map +1 -1
- package/util/varint.js +8 -1
- package/util/varint.js.map +1 -1
- package/util/watch.d.ts +8 -0
- package/util/watch.d.ts.map +1 -0
- package/util/watch.js +38 -0
- package/util/watch.js.map +1 -0
- package/util/yield.d.ts +2 -0
- package/util/yield.d.ts.map +1 -0
- package/util/yield.js +31 -0
- package/util/yield.js.map +1 -0
- package/varint.d.ts +0 -29
- package/varint.d.ts.map +1 -1
- package/varint.js +7 -28
- package/varint.js.map +1 -1
- package/varint_api.d.ts +7 -0
- package/varint_api.d.ts.map +1 -0
- package/varint_api.js +7 -0
- package/varint_api.js.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +4 -0
- package/version.js.map +1 -0
- package/window.d.ts +570 -0
- package/window.d.ts.map +1 -0
- package/window.js +1677 -0
- package/window.js.map +1 -0
- package/wire.d.ts +145 -30
- package/wire.d.ts.map +1 -1
- package/wire.js +27 -0
- package/wire.js.map +1 -1
- package/connection/established.d.ts +0 -53
- package/connection/established.d.ts.map +0 -1
- package/connection/established.js +0 -2
- package/connection/established.js.map +0 -1
- package/ietf/adapter.d.ts +0 -75
- package/ietf/adapter.d.ts.map +0 -1
- package/ietf/adapter.js +0 -699
- package/ietf/adapter.js.map +0 -1
- package/lite/datagram_stream.d.ts +0 -8
- package/lite/datagram_stream.d.ts.map +0 -1
- package/lite/datagram_stream.js +0 -43
- package/lite/datagram_stream.js.map +0 -1
- package/lite/fetch.d.ts +0 -28
- package/lite/fetch.d.ts.map +0 -1
- package/lite/fetch.js +0 -78
- package/lite/fetch.js.map +0 -1
- package/util/log.d.ts +0 -5
- package/util/log.d.ts.map +0 -1
- package/util/log.js +0 -16
- package/util/log.js.map +0 -1
- package/zod.d.ts +0 -13
- package/zod.d.ts.map +0 -1
- package/zod.js +0 -18
- package/zod.js.map +0 -1
package/fill.js
ADDED
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serving the groups a track's readers miss: the on-demand request surface. Mirrors the Rust
|
|
3
|
+
* `track::Requests` and `track::FillGroups` (`rs/moq-net/src/model/track/fill.rs`).
|
|
4
|
+
*
|
|
5
|
+
* A reader misses a group its ranges name that the track no longer caches, or never did, below
|
|
6
|
+
* the newest group the producer wrote: nothing above it is a miss, since it arrives live. While a
|
|
7
|
+
* {@link Requests} handle is open, each run of misses queues a {@link FillGroups} for it to serve, and
|
|
8
|
+
* readers missing the same groups join the one fill rather than asking twice. With none open, a
|
|
9
|
+
* miss is given up as it always was. A handle is also the only writer of a group below the newest
|
|
10
|
+
* one, so the last one closing skips what the track's own publisher left unproduced there.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { Signal } from "@moq/signals";
|
|
15
|
+
import { cutRun, hooks, insertRun, runGaps, runsFrom } from "./internal.js";
|
|
16
|
+
import { checkEnd, checkKey, max, min } from "./util/key.js";
|
|
17
|
+
// The fill operations a handle runs against the state it came from; assigned in its static block.
|
|
18
|
+
let fillOps;
|
|
19
|
+
// One fill: a run of groups some readers miss, until each is answered or nobody wants it.
|
|
20
|
+
class Pending {
|
|
21
|
+
start;
|
|
22
|
+
end;
|
|
23
|
+
// The oldest key the first group may start at: below `start` for a time start, whose group is
|
|
24
|
+
// the newest one starting at or before it.
|
|
25
|
+
floor;
|
|
26
|
+
// A time start's, which no other reader joins: it owes its key while its reader waits on it,
|
|
27
|
+
// whatever the reader's window reads, as the Rust `Join` holds its key.
|
|
28
|
+
exclusive;
|
|
29
|
+
askers = new Set();
|
|
30
|
+
// The groups answered: accepted, delivered live, dropped, or refused.
|
|
31
|
+
resolved = [];
|
|
32
|
+
// The groups no reader read any more at some point: withdrawn for good, so a handler that
|
|
33
|
+
// stopped serving one is never asked for it again. A reader widening back asks a new fill.
|
|
34
|
+
withdrawn = [];
|
|
35
|
+
// Still in the queue, not yet handed to a handler.
|
|
36
|
+
queued = true;
|
|
37
|
+
// Withdrawn or settled: owes nothing more.
|
|
38
|
+
done = false;
|
|
39
|
+
// Bumped on every change to what the fill owes, for its handler to wake on.
|
|
40
|
+
revision = new Signal(0);
|
|
41
|
+
// What a time start's handler answered.
|
|
42
|
+
answer;
|
|
43
|
+
constructor(start, end, floor = start, exclusive = false) {
|
|
44
|
+
this.start = start;
|
|
45
|
+
this.end = end;
|
|
46
|
+
this.floor = floor;
|
|
47
|
+
this.exclusive = exclusive;
|
|
48
|
+
}
|
|
49
|
+
bump() {
|
|
50
|
+
this.revision.update((revision) => revision + 1);
|
|
51
|
+
}
|
|
52
|
+
// The parts of `[start, end)` within the fill still unanswered and not withdrawn.
|
|
53
|
+
unresolved(start = this.start, end = this.end) {
|
|
54
|
+
if (this.done)
|
|
55
|
+
return [];
|
|
56
|
+
return runGaps(this.resolved, max(start, this.start), min(end, this.end)).flatMap((gap) => runGaps(this.withdrawn, gap.start, gap.end));
|
|
57
|
+
}
|
|
58
|
+
// The parts of `[start, end)` still unanswered that a reader still reads.
|
|
59
|
+
owed(start = this.start, end = this.end) {
|
|
60
|
+
if (this.exclusive)
|
|
61
|
+
return this.askers.size > 0 ? this.unresolved(start, end) : [];
|
|
62
|
+
const owed = [];
|
|
63
|
+
for (const gap of this.unresolved(start, end)) {
|
|
64
|
+
for (const asker of this.askers) {
|
|
65
|
+
for (const run of asker.wants(gap.start, gap.end))
|
|
66
|
+
insertRun(owed, run.start, run.end);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return owed;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The fills of one track: what its readers miss, queued for its {@link Requests} handles. A
|
|
74
|
+
* producer owns one.
|
|
75
|
+
*
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
export class FillState {
|
|
79
|
+
#track;
|
|
80
|
+
#handlers = 0;
|
|
81
|
+
#queue = [];
|
|
82
|
+
#queued = new Signal(0);
|
|
83
|
+
#pending = new Set();
|
|
84
|
+
// What each fill still owes, by key: its unanswered, unwithdrawn parts, which no two fills
|
|
85
|
+
// share, so a reader's ask or an arrival costs the fills it touches, never every fill out.
|
|
86
|
+
#live = [];
|
|
87
|
+
// The time starts' fills out, by their key, which no live part holds: a group landing there
|
|
88
|
+
// answers each, as the Rust `FillGroups::wanted` finds it cached.
|
|
89
|
+
#starts = new Map();
|
|
90
|
+
// Bumped as each handler opens, so readers parked on a miss nobody could take ask again.
|
|
91
|
+
#opened = new Signal(0);
|
|
92
|
+
constructor(track) {
|
|
93
|
+
this.#track = track;
|
|
94
|
+
void track.released.then(() => this.#release());
|
|
95
|
+
}
|
|
96
|
+
/** Whether a handler is open to serve a miss now. */
|
|
97
|
+
get serving() {
|
|
98
|
+
return this.#handlers > 0 && !this.#track.closed();
|
|
99
|
+
}
|
|
100
|
+
/** Whether a fill is out that a reader could join, handler or not. */
|
|
101
|
+
get active() {
|
|
102
|
+
return this.#pending.size > 0;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Ask for `[start, end)` for `asker`: join the fills already bringing part of it, and queue the
|
|
106
|
+
* rest while a handler is open, as the Rust `FillState::join` does. Returns the parts now
|
|
107
|
+
* asked, in order.
|
|
108
|
+
*/
|
|
109
|
+
ask(start, end, asker) {
|
|
110
|
+
if (start >= end || this.#track.closed())
|
|
111
|
+
return [];
|
|
112
|
+
const asked = [];
|
|
113
|
+
for (const live of this.#overlapping(start, end)) {
|
|
114
|
+
if (!live.pending.askers.has(asker)) {
|
|
115
|
+
live.pending.askers.add(asker);
|
|
116
|
+
live.pending.bump();
|
|
117
|
+
}
|
|
118
|
+
insertRun(asked, max(live.start, start), min(live.end, end));
|
|
119
|
+
}
|
|
120
|
+
if (this.#handlers === 0)
|
|
121
|
+
return asked;
|
|
122
|
+
const missing = runGaps(asked, start, end);
|
|
123
|
+
for (const gap of missing) {
|
|
124
|
+
const pending = new Pending(gap.start, gap.end);
|
|
125
|
+
pending.askers.add(asker);
|
|
126
|
+
this.#pending.add(pending);
|
|
127
|
+
this.#queue.push(pending);
|
|
128
|
+
this.#live.splice(runsFrom(this.#live, gap.start), 0, { start: gap.start, end: gap.end, pending });
|
|
129
|
+
insertRun(asked, gap.start, gap.end);
|
|
130
|
+
}
|
|
131
|
+
if (missing.length > 0)
|
|
132
|
+
this.#queued.update((revision) => revision + 1);
|
|
133
|
+
return asked;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Queue a fill of the group containing `time` for `asker`: the group starting at it, or else the
|
|
137
|
+
* newest one before it, starting at or after `floor`, as the Rust `FillState::time_start` does.
|
|
138
|
+
* No other reader joins it. Undefined while no handler is open to answer it.
|
|
139
|
+
*/
|
|
140
|
+
timeStart(time, floor, asker) {
|
|
141
|
+
if (this.#handlers === 0 || this.#track.closed())
|
|
142
|
+
return undefined;
|
|
143
|
+
const pending = new Pending(time, time + 1n, min(floor, time), true);
|
|
144
|
+
pending.askers.add(asker);
|
|
145
|
+
this.#pending.add(pending);
|
|
146
|
+
const starts = this.#starts.get(time) ?? new Set();
|
|
147
|
+
starts.add(pending);
|
|
148
|
+
this.#starts.set(time, starts);
|
|
149
|
+
this.#queue.push(pending);
|
|
150
|
+
this.#queued.update((revision) => revision + 1);
|
|
151
|
+
return {
|
|
152
|
+
answer: () => pending.answer,
|
|
153
|
+
done: () => pending.done,
|
|
154
|
+
changed: pending.revision,
|
|
155
|
+
leave: () => this.leave(asker, pending),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The parts of `[start, end)` a fill `asker` joined still owes it, merged and in order: only what it still
|
|
160
|
+
* reads, as the Rust `Join::held` holds, so a wider fill shared with other readers owes it
|
|
161
|
+
* nothing outside its own ranges.
|
|
162
|
+
*/
|
|
163
|
+
*covered(start, end, asker) {
|
|
164
|
+
// Walked lazily, so a caller wanting only the first run costs only the fills up to it.
|
|
165
|
+
let run;
|
|
166
|
+
for (let i = runsFrom(this.#live, start); i < this.#live.length && this.#live[i].start < end; i++) {
|
|
167
|
+
const live = this.#live[i];
|
|
168
|
+
if (!live.pending.askers.has(asker))
|
|
169
|
+
continue;
|
|
170
|
+
for (const part of asker.wants(max(live.start, start), min(live.end, end))) {
|
|
171
|
+
if (run && run.end === part.start)
|
|
172
|
+
run.end = part.end;
|
|
173
|
+
else {
|
|
174
|
+
if (run)
|
|
175
|
+
yield run;
|
|
176
|
+
run = { ...part };
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (run)
|
|
181
|
+
yield run;
|
|
182
|
+
}
|
|
183
|
+
/** The parts of `[start, end)` a fill out, queued or taken, still owes, in order. */
|
|
184
|
+
owing(start, end) {
|
|
185
|
+
return this.#overlapping(start, end).map((live) => ({
|
|
186
|
+
start: max(live.start, start),
|
|
187
|
+
end: min(live.end, end),
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
/** `asker` left `only`, or every fill: the fills it alone waited on are withdrawn. */
|
|
191
|
+
leave(asker, only) {
|
|
192
|
+
for (const pending of only ? [only] : this.#pending) {
|
|
193
|
+
if (!pending.askers.delete(asker))
|
|
194
|
+
continue;
|
|
195
|
+
this.#judge(pending);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* What `asker` reads in `[start, end)` changed: a fill nobody reads any more is withdrawn. Only
|
|
200
|
+
* the fills still owing a group there are judged again, so a change costs what it touches.
|
|
201
|
+
*/
|
|
202
|
+
moved(asker, start = 0n, end) {
|
|
203
|
+
const judged = new Set();
|
|
204
|
+
for (const live of end === undefined
|
|
205
|
+
? this.#live.slice(runsFrom(this.#live, start))
|
|
206
|
+
: this.#overlapping(start, end)) {
|
|
207
|
+
if (live.pending.askers.has(asker))
|
|
208
|
+
judged.add(live.pending);
|
|
209
|
+
}
|
|
210
|
+
for (const pending of judged)
|
|
211
|
+
this.#judge(pending);
|
|
212
|
+
}
|
|
213
|
+
/** Group `key` landed in the cache, through a fill or live: it is answered. */
|
|
214
|
+
arrived(key) {
|
|
215
|
+
const [live] = this.#overlapping(key, key + 1n);
|
|
216
|
+
if (live)
|
|
217
|
+
this.#resolve(live.pending, key, key + 1n);
|
|
218
|
+
for (const pending of this.#starts.get(key) ?? []) {
|
|
219
|
+
pending.answer = { kind: "group", group: key };
|
|
220
|
+
this.#resolve(pending, key, key + 1n);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* `[start, end)` was given up, by a fill or otherwise: nobody waits for it from a fill. A head
|
|
225
|
+
* of a group the cache holds is left to its own fill, as the Rust `drop_groups` touches no
|
|
226
|
+
* fill: a drop of that group, such as an earlier SUBSCRIBE_DROP arriving late, says nothing of
|
|
227
|
+
* whether its source can still bring frame 0.
|
|
228
|
+
*/
|
|
229
|
+
dropped(start, end) {
|
|
230
|
+
const owing = new Set();
|
|
231
|
+
for (const live of this.#overlapping(start, end)) {
|
|
232
|
+
// A held group is no miss, so the only fill owing it is its head's, one group wide.
|
|
233
|
+
if (live.end - live.start === 1n && this.#track.holds(live.start) === "headless")
|
|
234
|
+
continue;
|
|
235
|
+
owing.add(live.pending);
|
|
236
|
+
}
|
|
237
|
+
for (const pending of owing)
|
|
238
|
+
this.#resolve(pending, start, end);
|
|
239
|
+
}
|
|
240
|
+
// The keys a fill a handler already took still answers, but `ending`'s. A time start covers no
|
|
241
|
+
// key, but until answered may answer any from its floor through its time.
|
|
242
|
+
#taken(ending) {
|
|
243
|
+
const taken = [];
|
|
244
|
+
for (const live of this.#live) {
|
|
245
|
+
if (!live.pending.queued && live.pending !== ending)
|
|
246
|
+
insertRun(taken, live.start, live.end);
|
|
247
|
+
}
|
|
248
|
+
for (const pending of this.#pending) {
|
|
249
|
+
const open = !pending.queued && !pending.done && pending.answer === undefined;
|
|
250
|
+
if (pending.exclusive && open && pending !== ending)
|
|
251
|
+
insertRun(taken, pending.floor, pending.end);
|
|
252
|
+
}
|
|
253
|
+
return taken;
|
|
254
|
+
}
|
|
255
|
+
// The live parts overlapping `[start, end)`, lowest first.
|
|
256
|
+
#overlapping(start, end) {
|
|
257
|
+
const found = [];
|
|
258
|
+
for (let i = runsFrom(this.#live, start); i < this.#live.length && this.#live[i].start < end; i++)
|
|
259
|
+
found.push(this.#live[i]);
|
|
260
|
+
return found;
|
|
261
|
+
}
|
|
262
|
+
// Take `runs` of `pending` out of the live parts, once it no longer owes them. A time start's
|
|
263
|
+
// fill was never among them.
|
|
264
|
+
#settled(pending, runs) {
|
|
265
|
+
if (pending.exclusive)
|
|
266
|
+
return;
|
|
267
|
+
for (const run of runs)
|
|
268
|
+
cutRun(this.#live, run.start, run.end);
|
|
269
|
+
}
|
|
270
|
+
/** Bumped as each handler opens: a reader parked on a miss watches it to ask again. */
|
|
271
|
+
get opened() {
|
|
272
|
+
return this.#opened;
|
|
273
|
+
}
|
|
274
|
+
/** Open a handler, waking the readers parked on a miss to ask it. */
|
|
275
|
+
addHandler() {
|
|
276
|
+
this.#handlers++;
|
|
277
|
+
this.#opened.update((opened) => opened + 1);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Close a handler. The last one leaving was the only writer that could create a key below the
|
|
281
|
+
* newest group, so what the track's own publisher left unproduced there is skipped first, then
|
|
282
|
+
* every queued miss is named dropped, as with none open: a reader waiting on a skipped key sees
|
|
283
|
+
* the skip, not the dropped fill. A key a fill already handed out still answers stays with it.
|
|
284
|
+
*/
|
|
285
|
+
removeHandler() {
|
|
286
|
+
this.#handlers--;
|
|
287
|
+
if (this.#handlers > 0)
|
|
288
|
+
return;
|
|
289
|
+
this.#track.skipUnclaimed(this.#taken());
|
|
290
|
+
// A time start nobody took is left unanswered, as the Rust `release_queued` ends it.
|
|
291
|
+
for (const pending of this.#queue.splice(0)) {
|
|
292
|
+
if (pending.exclusive)
|
|
293
|
+
this.#finish(pending);
|
|
294
|
+
else
|
|
295
|
+
this.#settle(pending);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The next queued fill, or `undefined` once the track closes with none queued or `closed`, the
|
|
300
|
+
* asking handle's, is set.
|
|
301
|
+
*/
|
|
302
|
+
async next(closed) {
|
|
303
|
+
for (;;) {
|
|
304
|
+
if (closed.peek())
|
|
305
|
+
return undefined;
|
|
306
|
+
const pending = this.#queue.shift();
|
|
307
|
+
if (pending) {
|
|
308
|
+
pending.queued = false;
|
|
309
|
+
return pending;
|
|
310
|
+
}
|
|
311
|
+
if (this.#track.closed())
|
|
312
|
+
return undefined;
|
|
313
|
+
await Signal.race(this.#queued, this.#track.released, closed);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// Withdraw what no reader reads any more for good, and `pending` once that is all of it.
|
|
317
|
+
#judge(pending) {
|
|
318
|
+
if (pending.done)
|
|
319
|
+
return;
|
|
320
|
+
const owed = pending.owed();
|
|
321
|
+
const withdrawn = [];
|
|
322
|
+
for (const gap of pending.unresolved()) {
|
|
323
|
+
for (const run of runGaps(owed, gap.start, gap.end)) {
|
|
324
|
+
insertRun(pending.withdrawn, run.start, run.end);
|
|
325
|
+
withdrawn.push(run);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
this.#settled(pending, withdrawn);
|
|
329
|
+
if (owed.length > 0) {
|
|
330
|
+
pending.bump();
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
this.#finish(pending);
|
|
334
|
+
}
|
|
335
|
+
// Record `[start, end)` of `pending` answered.
|
|
336
|
+
#resolve(pending, start, end) {
|
|
337
|
+
const unresolved = pending.unresolved(start, end);
|
|
338
|
+
if (unresolved.length === 0)
|
|
339
|
+
return;
|
|
340
|
+
for (const run of unresolved)
|
|
341
|
+
insertRun(pending.resolved, run.start, run.end);
|
|
342
|
+
this.#settled(pending, unresolved);
|
|
343
|
+
if (pending.unresolved().length === 0)
|
|
344
|
+
this.#finish(pending);
|
|
345
|
+
else
|
|
346
|
+
pending.bump();
|
|
347
|
+
}
|
|
348
|
+
// Answer what `pending` still owes as dropped, then forget it.
|
|
349
|
+
#settle(pending) {
|
|
350
|
+
const owed = pending.owed();
|
|
351
|
+
if (pending.exclusive && owed.length > 0)
|
|
352
|
+
pending.answer ??= { kind: "dropped" };
|
|
353
|
+
for (const run of owed)
|
|
354
|
+
this.#track.drop(run.start, run.end);
|
|
355
|
+
this.#finish(pending);
|
|
356
|
+
}
|
|
357
|
+
// Forget `pending`: it owes nothing more.
|
|
358
|
+
#finish(pending) {
|
|
359
|
+
if (pending.done)
|
|
360
|
+
return;
|
|
361
|
+
this.#settled(pending, pending.unresolved());
|
|
362
|
+
pending.done = true;
|
|
363
|
+
this.#pending.delete(pending);
|
|
364
|
+
const starts = pending.exclusive ? this.#starts.get(pending.start) : undefined;
|
|
365
|
+
if (starts?.delete(pending) && starts.size === 0)
|
|
366
|
+
this.#starts.delete(pending.start);
|
|
367
|
+
if (pending.queued)
|
|
368
|
+
this.#queue.splice(this.#queue.indexOf(pending), 1);
|
|
369
|
+
pending.bump();
|
|
370
|
+
}
|
|
371
|
+
#release() {
|
|
372
|
+
this.#queue = [];
|
|
373
|
+
for (const pending of this.#pending)
|
|
374
|
+
this.#finish(pending);
|
|
375
|
+
this.#live = [];
|
|
376
|
+
this.#queued.update((revision) => revision + 1);
|
|
377
|
+
}
|
|
378
|
+
static {
|
|
379
|
+
fillOps = {
|
|
380
|
+
accept: (state, pending, key, info) => {
|
|
381
|
+
if (key < pending.floor || key >= pending.end) {
|
|
382
|
+
throw new RangeError(`group ${key} is outside the fill ${pending.floor}..${pending.end}`);
|
|
383
|
+
}
|
|
384
|
+
// A key below the start answers the start, so no other group starts from it through the
|
|
385
|
+
// start.
|
|
386
|
+
let answers = key;
|
|
387
|
+
if (answers < pending.start)
|
|
388
|
+
answers = pending.start;
|
|
389
|
+
if (pending.resolved.some((run) => run.start <= answers && answers < run.end))
|
|
390
|
+
return undefined;
|
|
391
|
+
// A copy missing its head is replaced from frame 0, as a bounded reader asked. Landing in
|
|
392
|
+
// the cache answers it, as `arrived` records.
|
|
393
|
+
const group = state.#track.holds(key) === true ? undefined : state.#track.accept(key, info);
|
|
394
|
+
// A time start's fill is no live part, and a group below its key lands nowhere it owes.
|
|
395
|
+
if (pending.exclusive && !pending.done) {
|
|
396
|
+
// Below the time, it holds the group it names, created or cached, so its End stays known
|
|
397
|
+
// once the cache lets it go.
|
|
398
|
+
const answer = key < pending.start ? (group ?? state.#track.cached(key)) : undefined;
|
|
399
|
+
pending.answer = { kind: "group", group: key, answer };
|
|
400
|
+
state.#resolve(pending, pending.start, pending.end);
|
|
401
|
+
}
|
|
402
|
+
return group;
|
|
403
|
+
},
|
|
404
|
+
// Answer owed `key` from the cache if the track holds it whole, as an arrival would. Returns
|
|
405
|
+
// whether it did.
|
|
406
|
+
answerCached: (state, pending, key) => {
|
|
407
|
+
if (state.#track.holds(key) !== true)
|
|
408
|
+
return false;
|
|
409
|
+
if (pending.exclusive) {
|
|
410
|
+
pending.answer = { kind: "group", group: key };
|
|
411
|
+
state.#resolve(pending, pending.start, pending.end);
|
|
412
|
+
}
|
|
413
|
+
else
|
|
414
|
+
state.#resolve(pending, key, key + 1n);
|
|
415
|
+
return true;
|
|
416
|
+
},
|
|
417
|
+
drop: (state, pending, start, end) => {
|
|
418
|
+
const owed = pending.owed(start, end);
|
|
419
|
+
if (pending.exclusive && owed.length > 0)
|
|
420
|
+
pending.answer ??= { kind: "dropped" };
|
|
421
|
+
for (const run of owed) {
|
|
422
|
+
state.#track.drop(run.start, run.end);
|
|
423
|
+
}
|
|
424
|
+
state.#resolve(pending, start, end);
|
|
425
|
+
},
|
|
426
|
+
refuse: (state, pending, start, end, error) => {
|
|
427
|
+
// A time start's refusal reaches its reader through the lookup, as the error its
|
|
428
|
+
// reads fail with, not as a group given up.
|
|
429
|
+
if (pending.exclusive) {
|
|
430
|
+
if (pending.unresolved(start, end).length > 0)
|
|
431
|
+
pending.answer ??= { kind: "refused", error };
|
|
432
|
+
state.#resolve(pending, start, end);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
for (const gap of pending.unresolved(start, end)) {
|
|
436
|
+
for (const asker of pending.askers) {
|
|
437
|
+
for (const run of asker.wants(gap.start, gap.end))
|
|
438
|
+
asker.refuse(run.start, run.end, error);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
state.#resolve(pending, start, end);
|
|
442
|
+
},
|
|
443
|
+
settle: (state, pending) => {
|
|
444
|
+
// The last handler may have left while this fill was out, leaving no one to create what
|
|
445
|
+
// it still owes: that is skipped with the rest left unproduced below the newest group,
|
|
446
|
+
// as the handler's close would have, before the fill names what remains dropped.
|
|
447
|
+
if (state.#handlers === 0)
|
|
448
|
+
state.#track.skipUnclaimed(state.#taken(pending));
|
|
449
|
+
state.#settle(pending);
|
|
450
|
+
},
|
|
451
|
+
name: (state) => state.#track.name,
|
|
452
|
+
track: (state) => state.#track,
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
/** The still-wanted runs of a fill, in ascending order. @internal */
|
|
457
|
+
export let wantedRuns;
|
|
458
|
+
/**
|
|
459
|
+
* Wait for a change to the groups or readers of a fill, which a lost {@link race} releases.
|
|
460
|
+
* @internal
|
|
461
|
+
*/
|
|
462
|
+
export let fillChanged;
|
|
463
|
+
// Constructs the public handles from within this module; assigned in their static blocks.
|
|
464
|
+
let makeGroups;
|
|
465
|
+
let makeRequests;
|
|
466
|
+
// The most urgent delivery priority among the readers waiting on `pending` now.
|
|
467
|
+
function priorityOf(pending) {
|
|
468
|
+
let priority;
|
|
469
|
+
for (const asker of pending.askers)
|
|
470
|
+
priority = Math.max(priority ?? asker.priority(), asker.priority());
|
|
471
|
+
return priority ?? 0;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* A {@link Requests} handle on `state`, for a producer's `requests()`.
|
|
475
|
+
*
|
|
476
|
+
* @internal
|
|
477
|
+
*/
|
|
478
|
+
export function requestsOf(state) {
|
|
479
|
+
return makeRequests(state);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Serves the groups a track's readers miss: from {@link Producer.requests}. Mirrors the Rust
|
|
483
|
+
* `track::Requests`.
|
|
484
|
+
*
|
|
485
|
+
* Most tracks never serve old content, so this lives on its own handle rather than the producer:
|
|
486
|
+
* a publisher backed by storage opens one to serve groups its live cache no longer holds, or
|
|
487
|
+
* never held. While at least one is open, a reader missing a run of groups queues a
|
|
488
|
+
* {@link FillGroups} here; with none open, the miss is given up. {@link close} it once done, and keep
|
|
489
|
+
* taking fills until then: a reader waits on its fill until it is answered or closed, so a handle
|
|
490
|
+
* left open but unread stalls that reader.
|
|
491
|
+
*
|
|
492
|
+
* It is also the only way to create a group below the newest one, with {@link createGroup}, as a
|
|
493
|
+
* store replaying history or an end-to-end copy does: the producer itself only appends.
|
|
494
|
+
*
|
|
495
|
+
* @public
|
|
496
|
+
*/
|
|
497
|
+
export class Requests {
|
|
498
|
+
#state;
|
|
499
|
+
#closed = new Signal(false);
|
|
500
|
+
constructor(state) {
|
|
501
|
+
this.#state = state;
|
|
502
|
+
state.addHandler();
|
|
503
|
+
}
|
|
504
|
+
static {
|
|
505
|
+
makeRequests = (state) => new Requests(state);
|
|
506
|
+
}
|
|
507
|
+
/** The track's name, unique within its broadcast. */
|
|
508
|
+
// fallow-ignore-next-line unused-class-member
|
|
509
|
+
get name() {
|
|
510
|
+
return fillOps.name(this.#state);
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Wait until readers miss a run of groups, returning the {@link FillGroups} to serve, including
|
|
514
|
+
* the group containing a reader's time start that no cached group places (see
|
|
515
|
+
* {@link FillGroups.floor}). Resolves `undefined` once the track closes with nothing queued, or
|
|
516
|
+
* this handle closes, even while it waits.
|
|
517
|
+
*/
|
|
518
|
+
async requestedFill() {
|
|
519
|
+
const pending = await this.#state.next(this.#closed);
|
|
520
|
+
if (!pending)
|
|
521
|
+
return undefined;
|
|
522
|
+
return makeGroups(this.#state, pending);
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Create a group whose first frame is `frame`: the group starts at its timestamp, its key on the
|
|
526
|
+
* track, converted as {@link Producer.appendGroup} converts it. Unlike that, it may start below
|
|
527
|
+
* the newest group. Mirrors the Rust `Requests::create_group`.
|
|
528
|
+
*
|
|
529
|
+
* It says nothing about the keys around it. A key below it the track's own publisher never
|
|
530
|
+
* produced stays owed while a handle lives, since that handle may still create it: an ordered
|
|
531
|
+
* reader waits on it, locally or through a relay. Once the last handle closes, every such key is
|
|
532
|
+
* skipped, except those a fill already handed out still answers. A key already skipped throws
|
|
533
|
+
* {@link Skipped}, a timestamp that doesn't match the track {@link TimestampMismatch}, and the
|
|
534
|
+
* reserved key 2^64-1 a `RangeError`.
|
|
535
|
+
*
|
|
536
|
+
* A key another group holds is replaced: the new group takes the slot, and readers already
|
|
537
|
+
* draining the old one keep it. The same broadcast, track, and group key always name the same
|
|
538
|
+
* content, and nothing checks it, as with {@link Producer.appendGroup}.
|
|
539
|
+
*/
|
|
540
|
+
createGroup(frame) {
|
|
541
|
+
this.#open();
|
|
542
|
+
return fillOps.track(this.#state).createGroup(frame);
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* {@link createGroup} with its first frame streamed: the group exists once this returns, and
|
|
546
|
+
* {@link FrameProducer.finish} hands it back to write the rest. Mirrors the Rust `create_frame`.
|
|
547
|
+
*/
|
|
548
|
+
createFrame(info) {
|
|
549
|
+
this.#open();
|
|
550
|
+
return fillOps.track(this.#state).createFrame(info);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Record that the publisher does not have `[start, end)`, at any key: a reader waiting on one
|
|
554
|
+
* moves past it as not found, the declared end does not wait for them, and a relay serving this
|
|
555
|
+
* track forwards the drop. Unlike a skip it is not permanent: a group created there later is
|
|
556
|
+
* served, but only to a reader that has not yet moved past it. A reader the drop already
|
|
557
|
+
* settled, here or through a relay, never sees it: the same broadcast, track, and group key
|
|
558
|
+
* always name the same content, so a publisher that re-creates a group it dropped breaks that
|
|
559
|
+
* for its own broadcast alone. For a producer that knows a group existed but cannot produce it,
|
|
560
|
+
* such as a replay whose copy was pruned; one that never will produce it says so with
|
|
561
|
+
* {@link skipGroups}. Once the track declared its end, naming any key at or past it throws and
|
|
562
|
+
* records nothing. Mirrors the Rust
|
|
563
|
+
* `Requests::drop_groups`.
|
|
564
|
+
*/
|
|
565
|
+
dropGroups(start, end) {
|
|
566
|
+
checkKey(start);
|
|
567
|
+
checkEnd(end);
|
|
568
|
+
this.#open();
|
|
569
|
+
fillOps.track(this.#state).dropGroups(start, end);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Declare that the track will never hold `[start, end)`, at any key. A skip is final: creating a group there throws
|
|
573
|
+
* {@link Skipped}. A group that finished here keeps what it is, since it was produced after all;
|
|
574
|
+
* one still arriving, or aborted, ends for good, as `GroupProducer.skip` ends one. Mirrors the
|
|
575
|
+
* Rust `Requests::skip_groups`.
|
|
576
|
+
*/
|
|
577
|
+
skipGroups(start, end) {
|
|
578
|
+
checkKey(start);
|
|
579
|
+
checkEnd(end);
|
|
580
|
+
this.#open();
|
|
581
|
+
fillOps.track(this.#state).skipGroups(start, end);
|
|
582
|
+
}
|
|
583
|
+
// Refuse a write through a closed handle: the close already skipped what it left unproduced.
|
|
584
|
+
#open() {
|
|
585
|
+
if (this.#closed.peek())
|
|
586
|
+
throw new Error("requests handle is closed");
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Stop serving. The last handle closing skips every key below the newest group the track's own
|
|
590
|
+
* publisher never produced, since no handle is left to create it, except those a fill already
|
|
591
|
+
* handed out still answers; then it names every miss still queued dropped, so its readers stop
|
|
592
|
+
* waiting. A fill already handed out keeps its own handle. Idempotent.
|
|
593
|
+
*/
|
|
594
|
+
close() {
|
|
595
|
+
if (this.#closed.peek())
|
|
596
|
+
return;
|
|
597
|
+
this.#closed.set(true);
|
|
598
|
+
this.#state.removeHandler();
|
|
599
|
+
}
|
|
600
|
+
[Symbol.dispose]() {
|
|
601
|
+
this.close();
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* A run of groups readers miss, from {@link Requests.requestedFill}: `start` up to the exclusive
|
|
606
|
+
* `end`. Mirrors the Rust `track::FillGroups`. A reader's time start that no cached group places
|
|
607
|
+
* asks for the group containing that time as a fill one key wide, from the time, whose first group
|
|
608
|
+
* may start below it: see {@link floor}.
|
|
609
|
+
*
|
|
610
|
+
* Its {@link priority} and {@link order} follow its readers as they change, so
|
|
611
|
+
* read them as each group is served. Call {@link accept} for each group the source has, writing
|
|
612
|
+
* its frames into the returned producer, and {@link dropGroups} for those it does not. Readers
|
|
613
|
+
* that leave, or narrow their ranges past a group, stop wanting it: serve {@link wanted} until it
|
|
614
|
+
* is `undefined`, which {@link wantedChanged} waits on. {@link close} the fill once done; closing
|
|
615
|
+
* names whatever is still wanted dropped rather than leaving its readers waiting.
|
|
616
|
+
*
|
|
617
|
+
* Groups keep their key, so an accepted group should hold the frames, payloads, and
|
|
618
|
+
* boundaries it had when it was first published: a fill replays the track, never a new version.
|
|
619
|
+
*
|
|
620
|
+
* @public
|
|
621
|
+
*/
|
|
622
|
+
export class FillGroups {
|
|
623
|
+
/** The first group to fill. */
|
|
624
|
+
start;
|
|
625
|
+
/** The exclusive end group. */
|
|
626
|
+
end;
|
|
627
|
+
/**
|
|
628
|
+
* The oldest group the first group may start at: {@link start}, unless that is a reader's time
|
|
629
|
+
* start no cached group places. Then the first group is the one containing that time: the group
|
|
630
|
+
* starting at it, or else the newest one starting before it, at or after the floor; once that
|
|
631
|
+
* group ends whole at or before the time, the reader starts past it, at its End. A handler
|
|
632
|
+
* knowing its groups only by key serves that key as any other; one that can tell which group
|
|
633
|
+
* holds the time, as from an index, may {@link accept} that group instead, or
|
|
634
|
+
* {@link dropGroups} the key when none does. The reader starts where the answer says, never
|
|
635
|
+
* where the cached groups happen to say: a drop, or the fill closed unanswered, says no group
|
|
636
|
+
* starts from the floor through the time, so it starts at the group just below the floor (at its
|
|
637
|
+
* End once the time is past that group's span), or past the time when the floor is 0. A
|
|
638
|
+
* {@link refuseGroups refusal} fails the reader with its error until its ranges change.
|
|
639
|
+
*/
|
|
640
|
+
floor;
|
|
641
|
+
#state;
|
|
642
|
+
#pending;
|
|
643
|
+
// The value `wantedChanged` last returned, or unset before it returned any.
|
|
644
|
+
#prev;
|
|
645
|
+
constructor(state, pending) {
|
|
646
|
+
this.#state = state;
|
|
647
|
+
this.#pending = pending;
|
|
648
|
+
this.start = pending.start;
|
|
649
|
+
this.end = pending.end;
|
|
650
|
+
this.floor = pending.floor;
|
|
651
|
+
}
|
|
652
|
+
static {
|
|
653
|
+
makeGroups = (state, pending) => new FillGroups(state, pending);
|
|
654
|
+
wantedRuns = (fill) => fill.#pending.owed();
|
|
655
|
+
fillChanged = (fill) => Signal.race(fill.#pending.revision);
|
|
656
|
+
}
|
|
657
|
+
/** The most urgent delivery priority among the readers waiting on it now. */
|
|
658
|
+
get priority() {
|
|
659
|
+
return priorityOf(this.#pending);
|
|
660
|
+
}
|
|
661
|
+
/** Which end to fill first now: `"descending"`, newest first, if any reader asks it. */
|
|
662
|
+
get order() {
|
|
663
|
+
for (const asker of this.#pending.askers)
|
|
664
|
+
if (asker.order() === "descending")
|
|
665
|
+
return "descending";
|
|
666
|
+
return this.#pending.askers.size > 0 ? "ascending" : "descending";
|
|
667
|
+
}
|
|
668
|
+
/** Whether a reader still waits for group `key` from this fill. Once false, it stays false. */
|
|
669
|
+
isWanted(key) {
|
|
670
|
+
checkKey(key);
|
|
671
|
+
return this.#pending.owed(key, key + 1n).length > 0;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* The next group still owed in the fill's {@link order}: a reader still reads it, it was
|
|
675
|
+
* neither answered nor delivered live since it was asked, and the track does not hold it whole.
|
|
676
|
+
* `undefined` once none is, so stop serving the fill.
|
|
677
|
+
*/
|
|
678
|
+
wanted() {
|
|
679
|
+
for (;;) {
|
|
680
|
+
const owed = this.#pending.owed();
|
|
681
|
+
if (owed.length === 0)
|
|
682
|
+
return undefined;
|
|
683
|
+
const key = this.order === "ascending" ? owed[0].start : owed.at(-1).end - 1n;
|
|
684
|
+
// A time start asked once its group already landed, which no arrival answers, is answered by
|
|
685
|
+
// the cache, not the source, as the Rust `FillGroups::wanted` does.
|
|
686
|
+
if (!fillOps.answerCached(this.#state, this.#pending, key))
|
|
687
|
+
return key;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* {@link wanted} once it differs from what this handle last returned: at once on the first
|
|
692
|
+
* call, then on each change. So `for (let at = await fill.wantedChanged(); at !== undefined;
|
|
693
|
+
* at = await fill.wantedChanged())` serves each group as it becomes owed, and ends once the
|
|
694
|
+
* fill is answered or withdrawn.
|
|
695
|
+
*/
|
|
696
|
+
async wantedChanged() {
|
|
697
|
+
for (;;) {
|
|
698
|
+
const wanted = this.wanted();
|
|
699
|
+
if (!this.#prev || this.#prev.wanted !== wanted) {
|
|
700
|
+
this.#prev = { wanted };
|
|
701
|
+
return wanted;
|
|
702
|
+
}
|
|
703
|
+
await this.#pending.revision.changed();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
/** Resolves once no reader waits for group `key` from this fill, so stop serving it. */
|
|
707
|
+
async unwanted(key) {
|
|
708
|
+
checkKey(key);
|
|
709
|
+
while (this.isWanted(key))
|
|
710
|
+
await this.#pending.revision.changed();
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Insert group `key` into the track's cache, handing it to the readers waiting on it,
|
|
714
|
+
* and return the producer to write its frames into. A live subscription covering it receives
|
|
715
|
+
* it too. `info` commits the track's {@link Info} if it has none yet. A key from the
|
|
716
|
+
* {@link floor} up to the start answers the start with that group. A cached copy missing its
|
|
717
|
+
* first frames, which a reader asked whole, is replaced. Returns `undefined` if the group was
|
|
718
|
+
* already answered or cached whole. Throws a `RangeError` outside the fill, and an error if the
|
|
719
|
+
* track is closed.
|
|
720
|
+
*
|
|
721
|
+
* A group is named by its frame 0's timestamp, so on a timed track writing frame 0 at any other
|
|
722
|
+
* time throws `TimestampMismatch`.
|
|
723
|
+
*/
|
|
724
|
+
accept(start, info) {
|
|
725
|
+
checkKey(start);
|
|
726
|
+
const group = fillOps.accept(this.#state, this.#pending, start, info);
|
|
727
|
+
if (group)
|
|
728
|
+
hooks.keyGroup(group);
|
|
729
|
+
return group;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Name `[start, end)` as never to be delivered: the source does not have them. Readers stop
|
|
733
|
+
* waiting for them, and the track records them so nobody asks again. Only the groups a reader
|
|
734
|
+
* still reads count; the rest of the fill was never owed.
|
|
735
|
+
*/
|
|
736
|
+
dropGroups(start, end) {
|
|
737
|
+
checkKey(start);
|
|
738
|
+
checkEnd(end);
|
|
739
|
+
fillOps.drop(this.#state, this.#pending, start, end);
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Refuse `[start, end)` with `error` without saying the source lost them, as when serving them
|
|
743
|
+
* failed for now. The readers waiting now stop waiting and get `error`; a later reader asks
|
|
744
|
+
* again.
|
|
745
|
+
*/
|
|
746
|
+
refuseGroups(start, end, error) {
|
|
747
|
+
checkKey(start);
|
|
748
|
+
checkEnd(end);
|
|
749
|
+
fillOps.refuse(this.#state, this.#pending, start, end, error);
|
|
750
|
+
}
|
|
751
|
+
/** Done serving: whatever a reader still wants is named dropped. Idempotent. */
|
|
752
|
+
close() {
|
|
753
|
+
fillOps.settle(this.#state, this.#pending);
|
|
754
|
+
}
|
|
755
|
+
/** Closes the fill; see {@link close}. */
|
|
756
|
+
[Symbol.dispose]() {
|
|
757
|
+
this.close();
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
//# sourceMappingURL=fill.js.map
|