@ref0/git 0.14.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/private-refs.mjs +1 -1
- package/dist/auth/access-jwt.mjs +4 -4
- package/dist/auth/auth-namespace.d.mts +3 -3
- package/dist/auth/auth-namespace.mjs +3 -2
- package/dist/auth/auth.d.mts +3 -3
- package/dist/auth/auth.mjs +9 -8
- package/dist/auth/authorize.mjs +4 -4
- package/dist/auth/fences.d.mts +1 -2
- package/dist/auth/fences.mjs +3 -3
- package/dist/auth/grants.mjs +4 -4
- package/dist/auth/host-function.mjs +19 -2
- package/dist/auth/host-services.mjs +4 -6
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +9 -3
- package/dist/auth/token-cleanup.mjs +67 -0
- package/dist/auth/token-rows.mjs +7 -2
- package/dist/auth/token-text.mjs +9 -1
- package/dist/auth/tokens-base.d.mts +35 -0
- package/dist/auth/tokens-base.mjs +13 -0
- package/dist/auth/tokens-layer.d.mts +2 -27
- package/dist/auth/tokens-layer.mjs +6 -11
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +7 -10
- package/dist/auth/tokens.mjs +10 -81
- package/dist/client/answer.mjs +21 -42
- package/dist/client/client.d.mts +17 -11
- package/dist/client/client.mjs +21 -12
- package/dist/client/git-http.mjs +18 -8
- package/dist/client/local.mjs +74 -37
- package/dist/client/negotiate.mjs +3 -3
- package/dist/client/push-upload.mjs +34 -17
- package/dist/client/remote.mjs +12 -13
- package/dist/client/run-remote-helper.d.mts +2 -1
- package/dist/client/run-remote-helper.mjs +61 -27
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +105 -46
- package/dist/contracts/blobs.d.mts +58 -11
- package/dist/contracts/blobs.mjs +17 -3
- package/dist/contracts/call-allowance.d.mts +13 -0
- package/dist/contracts/call-allowance.mjs +44 -0
- package/dist/contracts/calls-spent.mjs +12 -35
- package/dist/contracts/client.d.mts +18 -18
- package/dist/contracts/commits.d.mts +28 -28
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +8 -3
- package/dist/contracts/engine.mjs +10 -1
- package/dist/contracts/events.d.mts +1 -1
- package/dist/contracts/events.mjs +1 -1
- package/dist/contracts/files.d.mts +14 -14
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +21 -21
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-events.d.mts +29 -1
- package/dist/contracts/git-hooks.d.mts +2 -2
- package/dist/contracts/git.d.mts +30 -5
- package/dist/contracts/grants.d.mts +24 -4
- package/dist/contracts/handlers.d.mts +1 -1
- package/dist/contracts/lfs.d.mts +28 -2
- package/dist/contracts/merges.d.mts +3 -2
- package/dist/contracts/object-values.d.mts +1 -0
- package/dist/contracts/object-values.mjs +16 -1
- package/dist/contracts/objects.d.mts +42 -41
- package/dist/contracts/opaque.mjs +1 -1
- package/dist/contracts/operations.mjs +1 -1
- package/dist/contracts/queue.d.mts +247 -55
- package/dist/contracts/queue.mjs +8 -9
- package/dist/contracts/refs.d.mts +30 -27
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +8 -12
- package/dist/contracts/remote.mjs +4 -1
- package/dist/contracts/repos.d.mts +32 -141
- package/dist/contracts/repos.mjs +6 -4
- package/dist/contracts/result.d.mts +40 -18
- package/dist/contracts/result.mjs +42 -9
- package/dist/contracts/rules.d.mts +2 -2
- package/dist/contracts/server.d.mts +25 -52
- package/dist/contracts/services.d.mts +6 -9
- package/dist/contracts/services.mjs +1 -2
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/store.d.mts +7 -6
- package/dist/contracts/sync.d.mts +73 -12
- package/dist/contracts/sync.mjs +14 -3
- package/dist/contracts/tags.d.mts +13 -13
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/time.d.mts +3 -0
- package/dist/contracts/{promises.mjs → time.mjs} +1 -1
- package/dist/contracts/tokens.d.mts +17 -19
- package/dist/contracts/tokens.mjs +4 -3
- package/dist/contracts/topics.d.mts +10 -10
- package/dist/contracts/trees.d.mts +16 -16
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +28 -17
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +1 -2
- package/dist/core/access.mjs +20 -9
- package/dist/core/ancestry.d.mts +1 -0
- package/dist/core/ancestry.mjs +30 -34
- package/dist/core/asked.mjs +1 -1
- package/dist/core/call-groups.mjs +48 -0
- package/dist/core/call-names.mjs +6 -1
- package/dist/core/call-services.mjs +11 -3
- package/dist/core/events/deliver.d.mts +2 -3
- package/dist/core/events/deliver.mjs +45 -38
- package/dist/core/events/retired.mjs +119 -0
- package/dist/core/forks.mjs +929 -433
- package/dist/core/hooks/groups.mjs +3 -3
- package/dist/core/imports.mjs +127 -41
- package/dist/core/index-job.mjs +131 -38
- package/dist/core/index-lost.d.mts +1 -2
- package/dist/core/index-lost.mjs +2 -2
- package/dist/core/loose-tally.mjs +38 -15
- package/dist/core/merge-parts.d.mts +17 -4
- package/dist/core/merge-parts.mjs +7 -2
- package/dist/core/mirror-rows.mjs +31 -1
- package/dist/core/objects/blobs.mjs +127 -3
- package/dist/core/objects/files.mjs +20 -17
- package/dist/core/objects/lines.mjs +2 -2
- package/dist/core/objects/merges.mjs +4 -1
- package/dist/core/objects/objects-layer.d.mts +1 -1
- package/dist/core/objects/objects-layer.mjs +4 -4
- package/dist/core/objects/peel.mjs +1 -7
- package/dist/core/objects/reading.mjs +41 -29
- package/dist/core/objects/tags.mjs +4 -1
- package/dist/core/objects/tree-edits.mjs +1 -1
- package/dist/core/objects/trees.mjs +257 -58
- package/dist/core/objects/writing.mjs +4 -10
- package/dist/core/own-writes.mjs +2 -2
- package/dist/core/parts.d.mts +11 -5
- package/dist/core/parts.mjs +9 -10
- package/dist/core/purge.mjs +310 -93
- package/dist/core/push-decide.mjs +2 -0
- package/dist/core/push-files.d.mts +1 -1
- package/dist/core/push.d.mts +2 -2
- package/dist/core/push.mjs +170 -128
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +17 -5
- package/dist/core/ref-index-job.mjs +7 -7
- package/dist/core/ref-view.mjs +75 -32
- package/dist/core/refs.mjs +7 -7
- package/dist/core/registered-rows.mjs +2 -2
- package/dist/core/repack.mjs +58 -48
- package/dist/core/repo-info.mjs +3 -3
- package/dist/core/repos.mjs +21 -9
- package/dist/core/rules/changes.mjs +18 -40
- package/dist/core/rules/check.mjs +6 -5
- package/dist/core/rules/commit-changes.mjs +3 -15
- package/dist/core/rules/context.d.mts +3 -3
- package/dist/core/rules/context.mjs +18 -14
- package/dist/core/rules/fetch.mjs +1 -1
- package/dist/core/rules/protect.mjs +30 -17
- package/dist/core/saved-caller-views.d.mts +8 -3
- package/dist/core/saved-caller-views.mjs +4 -4
- package/dist/core/saved-callers.d.mts +19 -2
- package/dist/core/saved-callers.mjs +1 -1
- package/dist/core/seam.d.mts +17 -28
- package/dist/core/seam.mjs +7 -28
- package/dist/core/tokens.mjs +1 -1
- package/dist/core/view.d.mts +6 -3
- package/dist/core/view.mjs +18 -25
- package/dist/core/work.mjs +60 -15
- package/dist/engine/allotted-xdiff.mjs +3 -16
- package/dist/engine/combined.d.mts +3 -0
- package/dist/engine/combined.mjs +200 -185
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/failures.mjs +2 -1
- package/dist/engine/merge.mjs +7 -9
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +25 -17
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +1 -1
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +3 -3
- package/dist/event-streams/stream.mjs +39 -16
- package/dist/extend.d.mts +2 -7
- package/dist/extend.mjs +1 -4
- package/dist/http/answers.mjs +8 -5
- package/dist/http/core-parts.mjs +169 -96
- package/dist/http/handler.mjs +82 -10
- package/dist/http/node.d.mts +14 -1
- package/dist/http/node.mjs +56 -27
- package/dist/http/parts.d.mts +2 -0
- package/dist/http/push-upload-job.mjs +165 -47
- package/dist/http/push-uploads.mjs +37 -22
- package/dist/http/receive-pack.mjs +14 -53
- package/dist/http/request-snapshot.mjs +258 -0
- package/dist/http/upload-pack.mjs +25 -20
- package/dist/index.d.mts +36 -28
- package/dist/index.mjs +12 -3
- package/dist/lfs/answer.mjs +37 -0
- package/dist/lfs/base.d.mts +3 -1
- package/dist/lfs/base.mjs +25 -1
- package/dist/lfs/copy.d.mts +70 -8
- package/dist/lfs/copy.mjs +217 -21
- package/dist/lfs/layer.d.mts +19 -4
- package/dist/lfs/layer.mjs +25 -13
- package/dist/lfs/locks.mjs +3 -3
- package/dist/lfs/objects.d.mts +2 -1
- package/dist/lfs/objects.mjs +89 -19
- package/dist/lfs/pointers.mjs +2 -2
- package/dist/lfs/rows.d.mts +1 -1
- package/dist/lfs/rows.mjs +50 -9
- package/dist/lfs/upkeep.mjs +82 -17
- package/dist/lfs/uploaded.mjs +1 -1
- package/dist/lfs/wire.mjs +7 -32
- package/dist/merges/merges.mjs +19 -4
- package/dist/node.d.mts +2 -2
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +14 -6
- package/dist/protocol/bytes/deflate.d.mts +1 -1
- package/dist/protocol/bytes/deflate.mjs +1 -1
- package/dist/protocol/bytes/inflate.d.mts +1 -1
- package/dist/protocol/bytes/inflate.mjs +1 -1
- package/dist/protocol/bytes/reader.mjs +6 -1
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +1 -1
- package/dist/protocol/bytes/streams.mjs +27 -1
- package/dist/protocol/diff/read.d.mts +6 -4
- package/dist/protocol/diff/read.mjs +110 -11
- package/dist/protocol/objects/lfs-pointer.d.mts +14 -2
- package/dist/protocol/objects/lfs-pointer.mjs +1 -3
- package/dist/protocol/objects/links-raw.mjs +24 -10
- package/dist/protocol/objects/tag.d.mts +1 -1
- package/dist/protocol/objects/tree.mjs +23 -6
- package/dist/protocol/packs/delta.d.mts +6 -3
- package/dist/protocol/packs/delta.mjs +96 -32
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +3 -2
- package/dist/protocol/packs/idx.mjs +23 -4
- package/dist/protocol/packs/parts.d.mts +4 -1
- package/dist/protocol/packs/parts.mjs +10 -7
- package/dist/protocol/packs/reader.d.mts +6 -1
- package/dist/protocol/packs/reader.mjs +4 -3
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +1 -1
- package/dist/protocol/packs/writer.mjs +26 -8
- package/dist/protocol/wire/advertisement.d.mts +1 -1
- package/dist/protocol/wire/advertisement.mjs +3 -2
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +9 -1
- package/dist/protocol/wire/lines.mjs +28 -1
- package/dist/protocol/wire/push-uploads.mjs +10 -7
- package/dist/protocol/wire/receive-pack.d.mts +1 -1
- package/dist/protocol/wire/receive-pack.mjs +1 -1
- package/dist/protocol/wire/report-status.d.mts +1 -1
- package/dist/protocol/wire/report-status.mjs +1 -1
- package/dist/protocol/wire/v2.d.mts +1 -1
- package/dist/protocol/wire/v2.mjs +1 -1
- package/dist/queue/advance.mjs +48 -44
- package/dist/queue/base.d.mts +57 -0
- package/dist/queue/base.mjs +44 -0
- package/dist/queue/calls.mjs +54 -57
- package/dist/queue/commit.mjs +2 -2
- package/dist/queue/host.d.mts +2 -16
- package/dist/queue/host.mjs +2 -7
- package/dist/queue/layer.d.mts +2 -2
- package/dist/queue/layer.mjs +19 -8
- package/dist/queue/limits.mjs +2 -0
- package/dist/queue/push-option.mjs +9 -24
- package/dist/queue/schedule.mjs +2 -2
- package/dist/queue/search.mjs +1 -1
- package/dist/queue/state.mjs +3 -11
- package/dist/queue/trim.mjs +6 -4
- package/dist/rest/blobs.mjs +29 -5
- package/dist/rest/caller.d.mts +4 -4271
- package/dist/rest/caller.mjs +4 -0
- package/dist/rest/client.d.mts +9 -6
- package/dist/rest/client.mjs +25 -8
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/handler.mjs +2 -2
- package/dist/rest/handlers.mjs +66 -11
- package/dist/rest/layer.d.mts +2 -2
- package/dist/rest/layer.mjs +6 -13
- package/dist/rest/listen.mjs +2 -2
- package/dist/rest/me.d.mts +3 -432
- package/dist/rest/refs.mjs +1 -1
- package/dist/server/check-fetch.mjs +3 -3
- package/dist/server/edge-node.d.mts +11 -8
- package/dist/server/edge-node.mjs +9 -6
- package/dist/server/edge.d.mts +21 -7
- package/dist/server/edge.mjs +56 -11
- package/dist/server/extension.mjs +1 -1
- package/dist/server/git-layer.d.mts +5 -6
- package/dist/server/git-layer.mjs +28 -23
- package/dist/server/git-namespace.d.mts +4 -3
- package/dist/server/git-namespace.mjs +3 -2
- package/dist/server/lifecycle.mjs +19 -107
- package/dist/server/registry.mjs +24 -13
- package/dist/server/server.mjs +249 -371
- package/dist/signin/context.d.mts +1 -2
- package/dist/signin/context.mjs +1 -1
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -2
- package/dist/signin/grants.mjs +1 -1
- package/dist/signin/layer.d.mts +1 -1
- package/dist/signin/layer.mjs +1 -1
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/allotted.mjs +22 -12
- package/dist/storage/batch-upkeep.mjs +293 -0
- package/dist/storage/batches.d.mts +7 -0
- package/dist/storage/batches.mjs +347 -0
- package/dist/storage/budget.mjs +23 -1
- package/dist/storage/calls.d.mts +2 -3
- package/dist/storage/calls.mjs +166 -182
- package/dist/storage/charged-cache.mjs +180 -0
- package/dist/storage/chunks.d.mts +9 -0
- package/dist/storage/chunks.mjs +410 -0
- package/dist/storage/clean-up.mjs +72 -9
- package/dist/storage/counted-bucket.mjs +35 -13
- package/dist/storage/fetch-row-cache.d.mts +6 -0
- package/dist/storage/fetch-row-cache.mjs +211 -0
- package/dist/storage/fetch.d.mts +2 -0
- package/dist/storage/fetch.mjs +339 -450
- package/dist/storage/held-types.d.mts +0 -1
- package/dist/storage/host-bucket.mjs +10 -6
- package/dist/storage/id-mix.mjs +19 -5
- package/dist/storage/index-bitmaps.mjs +86 -51
- package/dist/storage/index-build.d.mts +2 -4
- package/dist/storage/index-build.mjs +324 -67
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +163 -83
- package/dist/storage/index-files.d.mts +3 -0
- package/dist/storage/index-files.mjs +10 -5
- package/dist/storage/index-graph.mjs +73 -23
- package/dist/storage/index-layers.mjs +55 -25
- package/dist/storage/index-reach.mjs +15 -22
- package/dist/storage/index-remap.mjs +200 -64
- package/dist/storage/index-whole.d.mts +7 -0
- package/dist/storage/index-whole.mjs +235 -0
- package/dist/storage/largest-files.mjs +1 -7
- package/dist/storage/layout.mjs +40 -1
- package/dist/storage/lfs-pointers.mjs +1 -6
- package/dist/storage/link-join.mjs +55 -16
- package/dist/storage/list-source.d.mts +7 -0
- package/dist/storage/list-source.mjs +288 -0
- package/dist/storage/loose.d.mts +10 -7
- package/dist/storage/loose.mjs +293 -82
- package/dist/storage/memory-budget.mjs +242 -26
- package/dist/storage/merge-cut.mjs +9 -6
- package/dist/storage/merge-fence.mjs +1 -1
- package/dist/storage/merge-plan.mjs +3 -2
- package/dist/storage/merge-row.mjs +8 -2
- package/dist/storage/merge-stream.mjs +164 -25
- package/dist/storage/merge-walk.mjs +8 -4
- package/dist/storage/merge-write.mjs +1 -1
- package/dist/storage/merge.d.mts +3 -4
- package/dist/storage/merge.mjs +3 -3
- package/dist/storage/object-rows.d.mts +4 -3
- package/dist/storage/object-rows.mjs +545 -84
- package/dist/storage/oid-table.mjs +171 -0
- package/dist/storage/pack-order.mjs +104 -47
- package/dist/storage/pack-ranges.d.mts +1 -2
- package/dist/storage/pack-ranges.mjs +48 -21
- package/dist/storage/pack-reads.d.mts +6 -3
- package/dist/storage/pack-reads.mjs +378 -98
- package/dist/storage/pack-receive.d.mts +2 -3
- package/dist/storage/pack-receive.mjs +22 -18
- package/dist/storage/packs.d.mts +2 -2
- package/dist/storage/packs.mjs +587 -156
- package/dist/storage/placed-reads.mjs +34 -17
- package/dist/storage/plan-columns.d.mts +4 -0
- package/dist/storage/plan-columns.mjs +238 -0
- package/dist/storage/prune-keep.mjs +134 -41
- package/dist/storage/prune-seen.mjs +1 -1
- package/dist/storage/prune-walk.mjs +203 -63
- package/dist/storage/prune.mjs +197 -121
- package/dist/storage/push-allotment.mjs +116 -25
- package/dist/storage/push-uploads.mjs +196 -58
- package/dist/storage/pushed-commits.mjs +24 -3
- package/dist/storage/quarantine.d.mts +3 -4
- package/dist/storage/range-cache.mjs +293 -41
- package/dist/storage/raw-ids.mjs +39 -10
- package/dist/storage/ready.d.mts +3 -4
- package/dist/storage/ready.mjs +121 -43
- package/dist/storage/receive-bounds.mjs +50 -13
- package/dist/storage/receive-cache.d.mts +7 -0
- package/dist/storage/receive-cache.mjs +147 -0
- package/dist/storage/receive-files.mjs +1 -1
- package/dist/storage/receive-links.mjs +1 -1
- package/dist/storage/receive-state.d.mts +2 -2
- package/dist/storage/receive-state.mjs +6 -8
- package/dist/storage/receive-steps.d.mts +20 -0
- package/dist/storage/receive-steps.mjs +298 -13
- package/dist/storage/repack-backlog.mjs +1 -3
- package/dist/storage/repack-contained.mjs +2 -2
- package/dist/storage/repack-job.mjs +1 -1
- package/dist/storage/repack.d.mts +3 -4
- package/dist/storage/repack.mjs +54 -9
- package/dist/storage/request-cache.mjs +57 -0
- package/dist/storage/roots.mjs +1 -24
- package/dist/storage/rows.d.mts +3 -3
- package/dist/storage/rows.mjs +2 -2
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +196 -44
- package/dist/storage/send-list.d.mts +1 -0
- package/dist/storage/send-list.mjs +112 -31
- package/dist/storage/single-flight.mjs +13 -7
- package/dist/storage/stream-whole.mjs +188 -66
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +919 -199
- package/dist/storage/visible.mjs +112 -34
- package/dist/storage/walk.mjs +193 -38
- package/dist/storage/wants.mjs +27 -63
- package/dist/store/bodies.mjs +38 -0
- package/dist/store/call-count.d.mts +10 -14
- package/dist/store/call-count.mjs +58 -57
- package/dist/store/catalogue.d.mts +2 -2
- package/dist/store/catalogue.mjs +158 -36
- package/dist/store/crossing.mjs +1 -9
- package/dist/store/cursor-seal.d.mts +1 -2
- package/dist/store/cursor-seal.mjs +17 -7
- package/dist/store/door.mjs +188 -0
- package/dist/store/errors.d.mts +4 -5
- package/dist/store/errors.mjs +119 -49
- package/dist/store/git-store.mjs +30 -7
- package/dist/store/job-try.mjs +98 -40
- package/dist/store/list-job.mjs +32 -20
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +2 -2
- package/dist/store/queue-jobs.mjs +6 -12
- package/dist/store/records.d.mts +5 -2
- package/dist/store/records.mjs +5 -2
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +2 -2
- package/dist/store/repo-record.d.mts +2 -3
- package/dist/store/repo-record.mjs +34 -22
- package/dist/store/request-snapshot.mjs +5 -0
- package/dist/store/reservations.mjs +3 -3
- package/dist/store/scopes.mjs +11 -0
- package/dist/store/settle.mjs +4 -4
- package/dist/store/topic-jobs.mjs +5 -11
- package/dist/sync/bound.d.mts +3 -3
- package/dist/sync/bound.mjs +10 -7
- package/dist/sync/github.mjs +67 -69
- package/dist/sync/http.mjs +1 -1
- package/dist/sync/import.mjs +205 -57
- package/dist/sync/layer.d.mts +1 -1
- package/dist/sync/layer.mjs +6 -6
- package/dist/sync/lfs-batch.mjs +5 -6
- package/dist/sync/lfs-copy.mjs +191 -20
- package/dist/sync/mirror.mjs +34 -36
- package/dist/sync/said.mjs +17 -38
- package/dist/sync/step.mjs +292 -102
- package/dist/sync/tries.mjs +34 -15
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +12 -13
- package/dist/topics/base.d.mts +15 -0
- package/dist/topics/base.mjs +8 -0
- package/dist/topics/calls.mjs +1 -1
- package/dist/topics/host.mjs +1 -1
- package/dist/topics/layer.d.mts +17 -21
- package/dist/topics/layer.mjs +2 -3
- package/dist/topics/members.mjs +4 -4
- package/dist/topics/public.d.mts +2 -1
- package/dist/topics/topic.mjs +2 -2
- package/package.json +5 -14
- package/dist/auth/helpers.mjs +0 -17
- package/dist/auth.d.mts +0 -5
- package/dist/auth.mjs +0 -5
- package/dist/contracts/promises.d.mts +0 -39
- package/dist/core/call-names.d.mts +0 -3
- package/dist/core/clock.mjs +0 -18
- package/dist/core/promise.mjs +0 -74
- package/dist/core/rules/commit-changes.d.mts +0 -13
- package/dist/effect.d.mts +0 -18
- package/dist/effect.mjs +0 -16
- package/dist/lfs/calls.mjs +0 -26
- package/dist/rest/api.d.mts +0 -23
- package/dist/rest/blobs.d.mts +0 -833
- package/dist/rest/commits.d.mts +0 -3543
- package/dist/rest/errors.d.mts +0 -2124
- package/dist/rest/events.d.mts +0 -426
- package/dist/rest/files.d.mts +0 -1342
- package/dist/rest/forks.d.mts +0 -2160
- package/dist/rest/handlers.d.mts +0 -8
- package/dist/rest/merges.d.mts +0 -477
- package/dist/rest/queue.d.mts +0 -5917
- package/dist/rest/refs.d.mts +0 -2988
- package/dist/rest/repos.d.mts +0 -2567
- package/dist/rest/tags.d.mts +0 -1316
- package/dist/rest/tokens.d.mts +0 -2614
- package/dist/rest/topics.d.mts +0 -2224
- package/dist/rest/trees.d.mts +0 -1709
- package/dist/rest/work.d.mts +0 -1695
- package/dist/server/joined.d.mts +0 -82
- package/dist/server/joined.mjs +0 -68
- package/dist/server/lifecycle.d.mts +0 -2
- package/dist/store/promises.d.mts +0 -11
- package/dist/store/promises.mjs +0 -327
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { fail } from "../contracts/result.mjs";
|
|
2
2
|
import { streamOf } from "../protocol/bytes/streams.mjs";
|
|
3
3
|
import { emptyTree, objectId, objectTypes } from "../protocol/objects/object.mjs";
|
|
4
|
+
import { decodeRow } from "../store/errors.mjs";
|
|
5
|
+
import { RequestSnapshot } from "../store/request-snapshot.mjs";
|
|
4
6
|
import { repoScope } from "../store/scopes.mjs";
|
|
7
|
+
import { SizeMarker, batchesOf, batchesRead, isBatchId, stagedKey, stagedOid, stagedPrefix, stagedSizeKey } from "./batches.mjs";
|
|
8
|
+
import { ChunkReader, chunkCount, chunkedOf } from "./chunks.mjs";
|
|
5
9
|
import { objectCollections } from "./layout.mjs";
|
|
10
|
+
import { limits } from "@ref0/infra";
|
|
11
|
+
import * as Schema from "effect/Schema";
|
|
6
12
|
import * as Effect from "effect/Effect";
|
|
7
13
|
import * as Option from "effect/Option";
|
|
8
|
-
import * as Schema from "effect/Schema";
|
|
9
14
|
import * as Result from "effect/Result";
|
|
10
|
-
import { limits } from "@ref0/infra";
|
|
11
15
|
import * as Base64 from "effect/encoding/Base64";
|
|
12
16
|
// src/storage/object-rows.ts
|
|
13
17
|
/** One object as a row, by its ID: its type and its body as base64, the header left out. */
|
|
@@ -54,6 +58,7 @@ const objectRow = (object) => ({
|
|
|
54
58
|
*/
|
|
55
59
|
const objectOfRow = /* @__PURE__ */ Effect.fnUntraced(function* (row) {
|
|
56
60
|
const what = `Object ${row.id}`;
|
|
61
|
+
if (chunkedOf(row.value) !== void 0) return yield* fail("DATA_LOSS", `${what} is stored as chunks, which this read can't take whole`);
|
|
57
62
|
const stored = decodeObjectRow(row.value);
|
|
58
63
|
if (Option.isNone(stored)) return yield* fail("DATA_LOSS", `${what} is unreadable`);
|
|
59
64
|
const decoded = Base64.decode(stored.value.data);
|
|
@@ -78,6 +83,11 @@ const objectOfRow = /* @__PURE__ */ Effect.fnUntraced(function* (row) {
|
|
|
78
83
|
*/
|
|
79
84
|
const headerOfRow = /* @__PURE__ */ Effect.fnUntraced(function* (row) {
|
|
80
85
|
const what = `Object ${row.id}`;
|
|
86
|
+
const chunked = chunkedOf(row.value);
|
|
87
|
+
if (chunked !== void 0) return {
|
|
88
|
+
type: chunked.type,
|
|
89
|
+
size: chunked.size
|
|
90
|
+
};
|
|
81
91
|
const stored = decodeObjectRow(row.value);
|
|
82
92
|
if (Option.isNone(stored)) return yield* fail("DATA_LOSS", `${what} is unreadable`);
|
|
83
93
|
const { data } = stored.value;
|
|
@@ -88,6 +98,22 @@ const headerOfRow = /* @__PURE__ */ Effect.fnUntraced(function* (row) {
|
|
|
88
98
|
size: data.length / 4 * 3 - padding
|
|
89
99
|
};
|
|
90
100
|
});
|
|
101
|
+
/**
|
|
102
|
+
* A stored object row's inflated body bytes from its base64 length or chunked manifest, without
|
|
103
|
+
* decoding or allocating the body. Returns 0 for an unreadable row.
|
|
104
|
+
*/
|
|
105
|
+
const rowInflatedBytes = (row) => {
|
|
106
|
+
const chunked = chunkedOf(row.value);
|
|
107
|
+
if (chunked !== void 0) return chunked.size;
|
|
108
|
+
const stored = decodeObjectRow(row.value);
|
|
109
|
+
if (Option.isNone(stored)) return 0;
|
|
110
|
+
const { data } = stored.value;
|
|
111
|
+
if (data.length === 0 || data.length % 4 !== 0) return 0;
|
|
112
|
+
const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
|
|
113
|
+
return data.length / 4 * 3 - padding;
|
|
114
|
+
};
|
|
115
|
+
/** Total inflated body bytes of `rows`, as `rowInflatedBytes` counts each. */
|
|
116
|
+
const rowsInflatedBytes = (rows) => rows.reduce((sum, row) => sum + rowInflatedBytes(row), 0);
|
|
91
117
|
/** A whole object as the contract's, its bytes one piece of a stream. */
|
|
92
118
|
const gitObjectOf = (object) => ({
|
|
93
119
|
oid: object.oid,
|
|
@@ -96,11 +122,31 @@ const gitObjectOf = (object) => ({
|
|
|
96
122
|
bytes: streamOf(object.bytes.slice())
|
|
97
123
|
});
|
|
98
124
|
/**
|
|
99
|
-
* The object rows a receive's change puts, by ID, readable before the commit that writes
|
|
100
|
-
*
|
|
125
|
+
* The inline object rows a receive's change puts, by ID, readable before the commit that writes
|
|
126
|
+
* them; staged receives expose their pre-commit rows through `stagedOwnOf`.
|
|
101
127
|
*/
|
|
102
128
|
const receivedRows = (change) => new Map((change?.put ?? []).flatMap((row) => row.collection === objectCollections.objects ? [[row.id, row]] : []));
|
|
103
129
|
/**
|
|
130
|
+
* How a staged push's own chunked rows are read before its commit, by the change it answered:
|
|
131
|
+
* its batch isn't published, so no reader of the repo finds them.
|
|
132
|
+
*/
|
|
133
|
+
const ownChunks = /* @__PURE__ */ new WeakMap();
|
|
134
|
+
/** `change`'s own chunked rows read through `reader`, as its push's walk reads them. */
|
|
135
|
+
const readsOwnChunks = (change, reader) => ownChunks.set(change, reader);
|
|
136
|
+
/** One of the rows `receivedRows` answers, read whole: one chunked, through its chunks. */
|
|
137
|
+
const receivedObject = (change, row) => {
|
|
138
|
+
const chunked = chunkedOf(row.value);
|
|
139
|
+
const reader = change === void 0 ? void 0 : ownChunks.get(change);
|
|
140
|
+
return chunked === void 0 || reader === void 0 ? objectOfRow(row) : reader(row.id, chunked).whole();
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Object rows one `wholePlan` clone page asks for: matches `wholeRowsMost` (1,000) so a rows-only
|
|
144
|
+
* whole clone reads its remaining rows past the preloaded first page in one store read instead of
|
|
145
|
+
* paging `rowReadBatch` (100) at a time. Past one answer's 16 MiB (`limits.answerBytes`),
|
|
146
|
+
* `eachPageAt` falls back to `rowReadBatch` and then `largeBatch`.
|
|
147
|
+
*/
|
|
148
|
+
const wholePageRows = 1e3;
|
|
149
|
+
/**
|
|
104
150
|
* Object rows a store read refused as too large is cut into: as many of the largest as one answer
|
|
105
151
|
* holds, each row's key and version aside, so no read of them passes its 16 MiB.
|
|
106
152
|
*/
|
|
@@ -112,18 +158,21 @@ const emptyTreeObject = {
|
|
|
112
158
|
bytes: /* @__PURE__ */ new Uint8Array(0)
|
|
113
159
|
};
|
|
114
160
|
const tooLargeRead = (error) => error.code === "RESOURCE_EXHAUSTED" && error.context?.["reason"] === "too-large";
|
|
161
|
+
const orTooLarge = (effect) => effect.pipe(Effect.catchIf(tooLargeRead, () => Effect.succeed(void 0)));
|
|
162
|
+
const listedBatches = (rows) => Effect.map(batchesOf(rows ?? []), (listed) => listed.map(({ batch }) => batch));
|
|
115
163
|
/**
|
|
116
|
-
* Each of `ids`'
|
|
117
|
-
* read at: `rowReadBatch` to a read, or `largeBatch` where those rows passed one answer's 16
|
|
118
|
-
* one read's rows are held, and the reads end once `each` answers `false`.
|
|
164
|
+
* Each of `ids`' `objects` rows the repo holds, a store read's answer at a time, with the version
|
|
165
|
+
* it's read at: `rowReadBatch` to a read, or `largeBatch` where those rows passed one answer's 16
|
|
166
|
+
* MiB. Only one read's rows are held, and the reads end once `each` answers `false`. Its staged
|
|
167
|
+
* batches are left out, so it answers only what `objects` holds.
|
|
119
168
|
*/
|
|
120
|
-
const
|
|
169
|
+
const eachObjectsRead = (store, repo, ids, each) => {
|
|
121
170
|
const read = (keys) => store.read({
|
|
122
171
|
scope: repoScope(repo),
|
|
123
172
|
reads: keys
|
|
124
173
|
});
|
|
125
174
|
const readAll = Effect.fnUntraced(function* (keys) {
|
|
126
|
-
const answer = yield* read(keys).pipe(
|
|
175
|
+
const answer = yield* read(keys).pipe(orTooLarge);
|
|
127
176
|
if (answer !== void 0) return yield* each(answer.results.flat(), answer.version);
|
|
128
177
|
for (let at = 0; at < keys.length; at += largeBatch) {
|
|
129
178
|
const cut = yield* read(keys.slice(at, at + largeBatch));
|
|
@@ -133,13 +182,198 @@ const eachRead = (store, repo, ids, each) => {
|
|
|
133
182
|
});
|
|
134
183
|
return Effect.gen(function* () {
|
|
135
184
|
const asked = [...new Set(ids)].filter((id) => id !== emptyTree);
|
|
136
|
-
for (let at = 0; at < asked.length; at += 100)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
185
|
+
for (let at = 0; at < asked.length; at += 100) if (!(yield* readAll(asked.slice(at, at + 100).map(objectKey)))) return;
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
/** A staged row as the `objects` row it stands for: its object's ID, its value as stored. */
|
|
189
|
+
const asObjectRow = (row) => ({
|
|
190
|
+
...objectKey(stagedOid(row.id)),
|
|
191
|
+
value: row.value
|
|
192
|
+
});
|
|
193
|
+
/**
|
|
194
|
+
* Reads already-flushed rows from `stagedObjects` or `stagedDeltas` in key order, normalizing
|
|
195
|
+
* `stagedObjects/<batch>/<oid>` through `asObjectRow` so callers decode object rows with bare OIDs.
|
|
196
|
+
*/
|
|
197
|
+
const readStagedRows = (store, repo) => (keys) => keys.length === 0 ? Effect.succeed([]) : Effect.map(store.read({
|
|
198
|
+
scope: repoScope(repo),
|
|
199
|
+
reads: [...keys]
|
|
200
|
+
}), (snapshot) => keys.map((key, index) => {
|
|
201
|
+
const row = snapshot.results[index]?.[0];
|
|
202
|
+
if (row === void 0) return void 0;
|
|
203
|
+
return key.collection === objectCollections.stagedObjects ? asObjectRow(row) : row;
|
|
204
|
+
}));
|
|
205
|
+
/**
|
|
206
|
+
* The value bytes packed into one staged body read at most (#2521): each row is at most 1 MiB, so
|
|
207
|
+
* every closed read holds > 13 MiB of values and stays under 16 MiB with its keys and envelope.
|
|
208
|
+
*/
|
|
209
|
+
const bodyPackBytes = 14680064;
|
|
210
|
+
/** The byte size a `stagedSizes` marker records: `DATA_LOSS` if unreadable or negative. */
|
|
211
|
+
const markerBytes = (row) => Effect.map(decodeRow(SizeMarker, row, `The size marker '${row.id}'`), ({ bytes }) => bytes);
|
|
212
|
+
/**
|
|
213
|
+
* Packs `hits` largest first into reads of at most `bodyPackBytes` of value bytes (always at least
|
|
214
|
+
* one key per read). Each closed read holds > 13 MiB of values, never two copies of one object.
|
|
215
|
+
*/
|
|
216
|
+
const packBodies = (hits) => {
|
|
217
|
+
const ordered = hits.toSorted((a, b) => b.bytes - a.bytes);
|
|
218
|
+
const packs = [];
|
|
219
|
+
let current = [];
|
|
220
|
+
let bytes = 0;
|
|
221
|
+
for (const hit of ordered) {
|
|
222
|
+
if (current.length > 0 && bytes + hit.bytes > 14680064) {
|
|
223
|
+
packs.push(current);
|
|
224
|
+
current = [];
|
|
225
|
+
bytes = 0;
|
|
142
226
|
}
|
|
227
|
+
current.push(hit);
|
|
228
|
+
bytes += hit.bytes;
|
|
229
|
+
}
|
|
230
|
+
if (current.length > 0) packs.push(current);
|
|
231
|
+
return packs;
|
|
232
|
+
};
|
|
233
|
+
/** The refusal of a read that discovered more than `newBatchReadsMost` new batches across its groups. */
|
|
234
|
+
const batchesMoved = () => fail("UNAVAILABLE", "Other pushes kept publishing large pushes during the read", {
|
|
235
|
+
hint: "Try again",
|
|
236
|
+
context: { reason: "too-many-writes" }
|
|
237
|
+
});
|
|
238
|
+
/**
|
|
239
|
+
* Each of `ids`' object rows the repo holds, in `objects` or in a published staged batch, handed to
|
|
240
|
+
* `each` a store read at a time: `rowReadBatch` IDs to a group, and the reads end once `each`
|
|
241
|
+
* answers `false`. An ID is missing only when its last read of `objects` missed and every batch
|
|
242
|
+
* that read listed was checked for it in a read that already listed that batch: a published
|
|
243
|
+
* batch's rows and size markers are fixed at its publication and leave it only into `objects`,
|
|
244
|
+
* which keeps them while any batch is listed, so the answer holds at that last read. Answers for
|
|
245
|
+
* different IDs may come from different reads. An ID in `objects` is answered from there, and one
|
|
246
|
+
* in several batches from the oldest.
|
|
247
|
+
*
|
|
248
|
+
* Each group runs:
|
|
249
|
+
* - A: `objects/<U>`, markers `stagedSizes/<k>/<u>` for batches `K` this reader already knows, and
|
|
250
|
+
* `batches`, in one snapshot (cut to `largeBatch` if `objects` overflows 16 MiB).
|
|
251
|
+
* - B: only when A or B lists batches `N` not yet checked for this group, `objects/<V>` for the
|
|
252
|
+
* still-open IDs, `N`'s markers, and `batches` in one snapshot, capped at `newBatchReadsMost`
|
|
253
|
+
* discoveries per reader before refusing `too-many-writes`.
|
|
254
|
+
* - Bodies: selected `stagedObjects/<b>/<oid>` keys packed by marker size into reads of at most
|
|
255
|
+
* `bodyPackBytes` (14 MiB), never two copies of one object.
|
|
256
|
+
* - Recovery: any body key gone (promoted or removed as a duplicate after the marker hit) is read
|
|
257
|
+
* in one call from `objects/<gone>` with `batches`.
|
|
258
|
+
*/
|
|
259
|
+
const eachRead = (store, repo, ids, each) => {
|
|
260
|
+
const scope = repoScope(repo);
|
|
261
|
+
const read = (reads) => store.read({
|
|
262
|
+
scope,
|
|
263
|
+
reads: [...reads]
|
|
264
|
+
});
|
|
265
|
+
const hand = (rows) => rows.length === 0 ? Effect.succeed(true) : each(rows);
|
|
266
|
+
const readSnapshot = Effect.fnUntraced(function* (oids, markerBatches) {
|
|
267
|
+
const markers = markerBatches.flatMap((batch) => oids.map((oid) => stagedSizeKey(batch, oid)));
|
|
268
|
+
const snapshot = yield* read([
|
|
269
|
+
...oids.map(objectKey),
|
|
270
|
+
batchesRead,
|
|
271
|
+
...markers
|
|
272
|
+
]);
|
|
273
|
+
const objectRows = snapshot.results.slice(0, oids.length).flat();
|
|
274
|
+
const listed = yield* listedBatches(snapshot.results[oids.length]);
|
|
275
|
+
const hit = new Set(objectRows.map(({ id }) => id));
|
|
276
|
+
const listedRank = new Map(listed.map((batch, rank) => [batch, rank]));
|
|
277
|
+
const selected = /* @__PURE__ */ new Map();
|
|
278
|
+
for (const [b, batch] of markerBatches.entries()) {
|
|
279
|
+
const rank = listedRank.get(batch);
|
|
280
|
+
if (rank === void 0) continue;
|
|
281
|
+
const offset = oids.length + 1 + b * oids.length;
|
|
282
|
+
for (const [i, oid] of oids.entries()) {
|
|
283
|
+
const row = snapshot.results[offset + i]?.[0];
|
|
284
|
+
if (row === void 0 || hit.has(oid)) continue;
|
|
285
|
+
const bytes = yield* markerBytes(row);
|
|
286
|
+
const current = selected.get(oid);
|
|
287
|
+
if (current === void 0 || rank < current.rank) selected.set(oid, {
|
|
288
|
+
oid,
|
|
289
|
+
batch,
|
|
290
|
+
bytes,
|
|
291
|
+
rank
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const misses = oids.filter((oid) => !hit.has(oid) && !selected.has(oid));
|
|
296
|
+
return {
|
|
297
|
+
objectRows,
|
|
298
|
+
listed,
|
|
299
|
+
selected: [...selected.values()],
|
|
300
|
+
misses
|
|
301
|
+
};
|
|
302
|
+
});
|
|
303
|
+
return Effect.gen(function* () {
|
|
304
|
+
const asked = [...new Set(ids)].filter((id) => id !== emptyTree);
|
|
305
|
+
let known = [];
|
|
306
|
+
let discoveries = 0;
|
|
307
|
+
const resolveCut = Effect.fnUntraced(function* (first, checkedInA, stagedHits) {
|
|
308
|
+
const take = Effect.fnUntraced(function* (snap) {
|
|
309
|
+
if (!(yield* hand(snap.objectRows))) return false;
|
|
310
|
+
for (const hit of snap.selected) if (!stagedHits.has(hit.oid)) stagedHits.set(hit.oid, hit);
|
|
311
|
+
return true;
|
|
312
|
+
});
|
|
313
|
+
if (!(yield* take(first))) return false;
|
|
314
|
+
const checked = new Set(checkedInA);
|
|
315
|
+
let open = first.misses;
|
|
316
|
+
let listed = first.listed;
|
|
317
|
+
known = listed;
|
|
318
|
+
while (open.length > 0) {
|
|
319
|
+
const fresh = listed.filter((batch) => !checked.has(batch));
|
|
320
|
+
if (fresh.length === 0) break;
|
|
321
|
+
if (discoveries >= 32) return yield* batchesMoved();
|
|
322
|
+
discoveries += 1;
|
|
323
|
+
const stepB = yield* readSnapshot(open, fresh).pipe(orTooLarge);
|
|
324
|
+
if (stepB !== void 0) {
|
|
325
|
+
if (!(yield* take(stepB))) return false;
|
|
326
|
+
open = stepB.misses;
|
|
327
|
+
listed = stepB.listed;
|
|
328
|
+
known = listed;
|
|
329
|
+
} else {
|
|
330
|
+
const nextOpen = [];
|
|
331
|
+
const nextListed = /* @__PURE__ */ new Set();
|
|
332
|
+
for (let at = 0; at < open.length; at += largeBatch) {
|
|
333
|
+
const cut = yield* readSnapshot(open.slice(at, at + largeBatch), fresh);
|
|
334
|
+
if (!(yield* take(cut))) return false;
|
|
335
|
+
nextOpen.push(...cut.misses);
|
|
336
|
+
for (const batch of cut.listed) nextListed.add(batch);
|
|
337
|
+
known = cut.listed;
|
|
338
|
+
}
|
|
339
|
+
open = nextOpen;
|
|
340
|
+
listed = [...nextListed];
|
|
341
|
+
}
|
|
342
|
+
for (const batch of fresh) checked.add(batch);
|
|
343
|
+
}
|
|
344
|
+
return true;
|
|
345
|
+
});
|
|
346
|
+
const resolveGroup = Effect.fnUntraced(function* (oids) {
|
|
347
|
+
const stagedHits = /* @__PURE__ */ new Map();
|
|
348
|
+
const checkedInA = known;
|
|
349
|
+
const whole = yield* readSnapshot(oids, checkedInA).pipe(orTooLarge);
|
|
350
|
+
if (whole !== void 0) {
|
|
351
|
+
if (!(yield* resolveCut(whole, checkedInA, stagedHits))) return false;
|
|
352
|
+
} else for (let at = 0; at < oids.length; at += largeBatch) {
|
|
353
|
+
const cutChecked = known;
|
|
354
|
+
const cut = yield* readSnapshot(oids.slice(at, at + largeBatch), cutChecked);
|
|
355
|
+
if (!(yield* resolveCut(cut, cutChecked, stagedHits))) return false;
|
|
356
|
+
}
|
|
357
|
+
for (const pack of packBodies([...stagedHits.values()])) {
|
|
358
|
+
const bodies = yield* read(pack.map(({ batch, oid }) => stagedKey(batch, oid)));
|
|
359
|
+
const found = [];
|
|
360
|
+
const gone = [];
|
|
361
|
+
for (const [index, hit] of pack.entries()) {
|
|
362
|
+
const row = bodies.results[index]?.[0];
|
|
363
|
+
if (row === void 0) gone.push(hit.oid);
|
|
364
|
+
else found.push(asObjectRow(row));
|
|
365
|
+
}
|
|
366
|
+
if (!(yield* hand(found))) return false;
|
|
367
|
+
if (gone.length > 0) {
|
|
368
|
+
const recovered = yield* read([...gone.map(objectKey), batchesRead]);
|
|
369
|
+
const recoveredRows = recovered.results.slice(0, gone.length).flat();
|
|
370
|
+
known = yield* listedBatches(recovered.results[gone.length]);
|
|
371
|
+
if (!(yield* hand(recoveredRows))) return false;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return true;
|
|
375
|
+
});
|
|
376
|
+
for (let at = 0; at < asked.length; at += 100) if (!(yield* resolveGroup(asked.slice(at, at + 100)))) return;
|
|
143
377
|
});
|
|
144
378
|
};
|
|
145
379
|
/** Each of `oids`' rows the repo holds, handed to `each` a store read at a time, as `eachRead` reads. */
|
|
@@ -155,75 +389,145 @@ const eachRow = (store, listed, oids, each) => eachRead(store, listed.repo, oids
|
|
|
155
389
|
const heldIdsAt = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, version, ids) {
|
|
156
390
|
const held = /* @__PURE__ */ new Set();
|
|
157
391
|
let moved = false;
|
|
158
|
-
yield*
|
|
392
|
+
yield* eachObjectsRead(store, repo, ids, (rows, at) => Effect.sync(() => {
|
|
159
393
|
moved = at !== version;
|
|
160
394
|
if (!moved) for (const { id } of rows) held.add(id);
|
|
161
395
|
return !moved;
|
|
162
396
|
}));
|
|
163
397
|
return moved ? void 0 : held;
|
|
164
398
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
* answer's 16 MiB. `true` once every row is read; `false` once a page answers at another version,
|
|
169
|
-
* since the repo moved after the read it joins, or once `each` answers `false`.
|
|
170
|
-
*/
|
|
171
|
-
const eachPageAt = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, version, each) {
|
|
172
|
-
const page = (after, limit) => {
|
|
399
|
+
const eachPageAt = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, version, each, also, pageSize = 100) {
|
|
400
|
+
const scope = repoScope(repo);
|
|
401
|
+
const page = (after, limit, withAlso) => {
|
|
173
402
|
const read = {
|
|
174
403
|
collection: objectCollections.objects,
|
|
175
404
|
limit
|
|
176
405
|
};
|
|
177
406
|
if (after !== void 0) read.after = after;
|
|
407
|
+
const reads = withAlso && also !== void 0 ? [
|
|
408
|
+
read,
|
|
409
|
+
batchesRead,
|
|
410
|
+
...also.reads
|
|
411
|
+
] : [read, batchesRead];
|
|
178
412
|
return Effect.map(store.read({
|
|
179
|
-
scope
|
|
180
|
-
reads
|
|
413
|
+
scope,
|
|
414
|
+
reads
|
|
181
415
|
}), ({ version: at, results }) => ({
|
|
182
416
|
at,
|
|
183
417
|
rows: results[0] ?? [],
|
|
184
|
-
limit
|
|
418
|
+
limit,
|
|
419
|
+
batched: (results[1] ?? []).length > 0,
|
|
420
|
+
extra: withAlso && also !== void 0 ? results.slice(2) : void 0
|
|
185
421
|
}));
|
|
186
422
|
};
|
|
187
423
|
let after;
|
|
424
|
+
let needAlso = also !== void 0 && also.reads.length > 0;
|
|
425
|
+
const snapshot = yield* RequestSnapshot;
|
|
426
|
+
if (snapshot !== void 0) {
|
|
427
|
+
const preloadReads = needAlso && also !== void 0 ? [
|
|
428
|
+
{
|
|
429
|
+
collection: objectCollections.objects,
|
|
430
|
+
limit: 100
|
|
431
|
+
},
|
|
432
|
+
batchesRead,
|
|
433
|
+
...also.reads
|
|
434
|
+
] : [{
|
|
435
|
+
collection: objectCollections.objects,
|
|
436
|
+
limit: 100
|
|
437
|
+
}, batchesRead];
|
|
438
|
+
const preloaded = snapshot.answer(scope, preloadReads);
|
|
439
|
+
if (preloaded !== void 0 && preloaded.version === version) {
|
|
440
|
+
if ((preloaded.results[1] ?? []).length > 0) return "batched";
|
|
441
|
+
const rows = preloaded.results[0] ?? [];
|
|
442
|
+
if (!(yield* each(rows))) return "moved";
|
|
443
|
+
if (needAlso && also !== void 0) {
|
|
444
|
+
also.take(preloaded.results.slice(2));
|
|
445
|
+
needAlso = false;
|
|
446
|
+
}
|
|
447
|
+
const last = rows.at(-1);
|
|
448
|
+
if (last === void 0 || rows.length < 100) return "done";
|
|
449
|
+
after = last.id;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
188
452
|
for (;;) {
|
|
189
|
-
const
|
|
190
|
-
|
|
453
|
+
const first = needAlso;
|
|
454
|
+
const { at, rows, limit, batched, extra } = yield* page(after, pageSize, first).pipe(Effect.catchIf(tooLargeRead, () => pageSize > 100 ? page(after, 100, first).pipe(Effect.catchIf(tooLargeRead, () => page(after, largeBatch, first))) : page(after, largeBatch, first)));
|
|
455
|
+
if (batched) return "batched";
|
|
456
|
+
if (at !== version || !(yield* each(rows))) return "moved";
|
|
457
|
+
if (first && extra !== void 0 && also !== void 0) {
|
|
458
|
+
also.take(extra);
|
|
459
|
+
needAlso = false;
|
|
460
|
+
}
|
|
191
461
|
const last = rows.at(-1);
|
|
192
|
-
if (last === void 0 || rows.length < limit) return
|
|
462
|
+
if (last === void 0 || rows.length < limit) return "done";
|
|
193
463
|
after = last.id;
|
|
194
464
|
}
|
|
195
465
|
});
|
|
466
|
+
/** A copy's cursor into `objects` from its first row, after every published batch's rows. */
|
|
467
|
+
const objectsFromStart = "-";
|
|
196
468
|
/**
|
|
197
469
|
* One page of `listed`'s object rows at its version, after `input.after`, read as `eachPageAt`
|
|
198
470
|
* reads each, and of those the rows `input.lacking` doesn't hold, read by the page's IDs as
|
|
199
|
-
* `heldIdsAt` reads them: `moved` once either repo answers at another version.
|
|
200
|
-
*
|
|
471
|
+
* `heldIdsAt` reads them: `moved` once either repo answers at another version. Each published
|
|
472
|
+
* staged batch's rows come first, oldest batch first, each as the `objects` row it stands for, then
|
|
473
|
+
* `objects`' own: every page is read at the copy's one version, so no row moves between them. An
|
|
474
|
+
* object held twice is copied twice, as one row. Its `next` is the page's last ID while the page
|
|
475
|
+
* is full, the next batch's or `objects`' start once a batch is read, and none once `objects` is.
|
|
201
476
|
*/
|
|
202
477
|
const copyRowsPage = /* @__PURE__ */ Effect.fnUntraced(function* (store, listed, input) {
|
|
203
|
-
const
|
|
478
|
+
const batchOf = (after) => {
|
|
479
|
+
const slash = after?.indexOf("/") ?? -1;
|
|
480
|
+
const named = after === void 0 || slash < 0 ? void 0 : after.slice(0, slash);
|
|
481
|
+
return named !== void 0 && isBatchId(named) ? named : void 0;
|
|
482
|
+
};
|
|
483
|
+
const inBatch = batchOf(input.after);
|
|
484
|
+
const readOf = (limit) => {
|
|
485
|
+
if (inBatch !== void 0) return {
|
|
486
|
+
collection: objectCollections.stagedObjects,
|
|
487
|
+
prefix: stagedPrefix(inBatch),
|
|
488
|
+
after: input.after ?? "",
|
|
489
|
+
limit
|
|
490
|
+
};
|
|
204
491
|
const read = {
|
|
205
492
|
collection: objectCollections.objects,
|
|
206
493
|
limit
|
|
207
494
|
};
|
|
208
|
-
if (input.after !== void 0) read.after = input.after;
|
|
209
|
-
return
|
|
210
|
-
scope: repoScope(listed.repo),
|
|
211
|
-
reads: [read]
|
|
212
|
-
}), ({ version: at, results }) => ({
|
|
213
|
-
at,
|
|
214
|
-
rows: results[0] ?? [],
|
|
215
|
-
limit
|
|
216
|
-
}));
|
|
495
|
+
if (input.after !== void 0 && input.after !== objectsFromStart) read.after = input.after;
|
|
496
|
+
return read;
|
|
217
497
|
};
|
|
498
|
+
const page = (limit) => Effect.map(store.read({
|
|
499
|
+
scope: repoScope(listed.repo),
|
|
500
|
+
reads: [readOf(limit), batchesRead]
|
|
501
|
+
}), ({ version: at, results }) => ({
|
|
502
|
+
at,
|
|
503
|
+
rows: results[0] ?? [],
|
|
504
|
+
batches: results[1] ?? [],
|
|
505
|
+
limit
|
|
506
|
+
}));
|
|
218
507
|
const read = yield* page(100).pipe(Effect.catchIf(tooLargeRead, () => page(largeBatch)));
|
|
219
508
|
if (read.at !== listed.version) return { moved: true };
|
|
220
|
-
const
|
|
221
|
-
|
|
509
|
+
const batches = (yield* batchesOf(read.batches)).map(({ batch }) => batch);
|
|
510
|
+
if (input.after === void 0 && batches[0] !== void 0) return yield* copyRowsPage(store, listed, {
|
|
511
|
+
...input,
|
|
512
|
+
after: stagedPrefix(batches[0])
|
|
513
|
+
});
|
|
514
|
+
const rows = read.rows.map(({ id, value }) => inBatch === void 0 ? {
|
|
515
|
+
collection: objectCollections.objects,
|
|
222
516
|
id,
|
|
223
517
|
value
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
518
|
+
} : {
|
|
519
|
+
collection: objectCollections.objects,
|
|
520
|
+
id: stagedOid(id),
|
|
521
|
+
value
|
|
522
|
+
});
|
|
523
|
+
const last = read.rows.at(-1);
|
|
524
|
+
const after = (() => {
|
|
525
|
+
if (last !== void 0 && read.rows.length === read.limit) return last.id;
|
|
526
|
+
if (inBatch === void 0) return void 0;
|
|
527
|
+
const following = batches[batches.indexOf(inBatch) + 1];
|
|
528
|
+
return following === void 0 ? objectsFromStart : stagedPrefix(following);
|
|
529
|
+
})();
|
|
530
|
+
const next = after === void 0 ? {} : { next: after };
|
|
227
531
|
const { lacking } = input;
|
|
228
532
|
if (lacking === void 0) return {
|
|
229
533
|
rows,
|
|
@@ -236,10 +540,85 @@ const copyRowsPage = /* @__PURE__ */ Effect.fnUntraced(function* (store, listed,
|
|
|
236
540
|
...next
|
|
237
541
|
};
|
|
238
542
|
});
|
|
239
|
-
/**
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
543
|
+
/**
|
|
544
|
+
* A chunked object's row found again in `objects`: a copy's chunks go only through duplicate
|
|
545
|
+
* removal, so `objects/<oid>` already holds the surviving manifest in one read (#2521).
|
|
546
|
+
*/
|
|
547
|
+
const chunkedAgain = (store, listed) => Effect.fnUntraced(function* (oid) {
|
|
548
|
+
const row = (yield* store.read({
|
|
549
|
+
scope: repoScope(listed.repo),
|
|
550
|
+
reads: [objectKey(oid)]
|
|
551
|
+
})).results[0]?.[0];
|
|
552
|
+
return row === void 0 ? void 0 : chunkedOf(row.value);
|
|
553
|
+
});
|
|
554
|
+
/** A reader of `oid`'s chunks, the repo's row naming them `chunked`. */
|
|
555
|
+
const chunkReaderOf = (store, listed, oid, chunked) => new ChunkReader(store, listed.repo, oid, chunked, chunkedAgain(store, listed));
|
|
556
|
+
/**
|
|
557
|
+
* One object's row, `emptyTree` included: an inline row decoded and hashed whole, or a chunked
|
|
558
|
+
* row's `ChunkReader` with no chunks read yet, validated against its size and chunk count (#2522).
|
|
559
|
+
*/
|
|
560
|
+
const rowAt = /* @__PURE__ */ Effect.fnUntraced(function* (store, listed, oid) {
|
|
561
|
+
if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") return {
|
|
562
|
+
kind: "whole",
|
|
563
|
+
object: emptyTreeObject
|
|
564
|
+
};
|
|
565
|
+
let found;
|
|
566
|
+
yield* eachRow(store, listed, [oid], Effect.fnUntraced(function* (row) {
|
|
567
|
+
const chunked = chunkedOf(row.value);
|
|
568
|
+
if (chunked === void 0) {
|
|
569
|
+
found = {
|
|
570
|
+
kind: "whole",
|
|
571
|
+
object: yield* objectOfRow(row)
|
|
572
|
+
};
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
if (chunked.size < 1 || chunked.chunks !== chunkCount(chunked.size)) return yield* fail("DATA_LOSS", `Object ${row.id}'s chunked row has invalid size or chunk count`);
|
|
576
|
+
found = {
|
|
577
|
+
kind: "chunked",
|
|
578
|
+
reader: chunkReaderOf(store, listed, row.id, chunked)
|
|
579
|
+
};
|
|
580
|
+
}));
|
|
581
|
+
return found;
|
|
582
|
+
});
|
|
583
|
+
/**
|
|
584
|
+
* A repo's object rows `oids` names, each handed on as it's read: the empty tree among them. One
|
|
585
|
+
* kept as chunks is read whole, `chunkReadMost` chunks a read, once `before` lets it. When `cache`
|
|
586
|
+
* is provided for a fetch request, inline rows already cached are served (and verified on first
|
|
587
|
+
* decode from raw) without re-reading the store, and newly read inline rows are stored within the
|
|
588
|
+
* cache's bounds (#2899).
|
|
589
|
+
*/
|
|
590
|
+
const eachHeldRow = (store, listed, before, cache) => Effect.fnUntraced(function* (oids, each) {
|
|
591
|
+
const unique = [...new Set(oids)];
|
|
592
|
+
const missed = [];
|
|
593
|
+
for (const oid of unique) {
|
|
594
|
+
if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") {
|
|
595
|
+
yield* each(emptyTreeObject);
|
|
596
|
+
continue;
|
|
597
|
+
}
|
|
598
|
+
const cached = cache?.get(oid);
|
|
599
|
+
if (cached === void 0) {
|
|
600
|
+
missed.push(oid);
|
|
601
|
+
continue;
|
|
602
|
+
}
|
|
603
|
+
if (cached.kind === "whole") {
|
|
604
|
+
yield* each(cached.object);
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
const object = yield* objectOfRow(cached.row);
|
|
608
|
+
cache?.putWhole(object);
|
|
609
|
+
yield* each(object);
|
|
610
|
+
}
|
|
611
|
+
if (missed.length === 0) return;
|
|
612
|
+
yield* eachRow(store, listed, missed, Effect.fnUntraced(function* (row) {
|
|
613
|
+
const chunked = chunkedOf(row.value);
|
|
614
|
+
if (chunked === void 0) {
|
|
615
|
+
const object = yield* objectOfRow(row);
|
|
616
|
+
cache?.putWhole(object);
|
|
617
|
+
return yield* each(object);
|
|
618
|
+
}
|
|
619
|
+
if (before !== void 0 && !(yield* before(row.id, chunked.size))) return;
|
|
620
|
+
yield* each(yield* chunkReaderOf(store, listed, row.id, chunked).whole());
|
|
621
|
+
}));
|
|
243
622
|
});
|
|
244
623
|
/** A repo's object rows by ID, read whole: those it holds, the empty tree among them. */
|
|
245
624
|
const heldRows = (store, listed) => Effect.fnUntraced(function* (oids) {
|
|
@@ -250,55 +629,137 @@ const heldRows = (store, listed) => Effect.fnUntraced(function* (oids) {
|
|
|
250
629
|
/**
|
|
251
630
|
* The type and size of each of `oids`' rows the repo holds, the empty tree's among them, the size
|
|
252
631
|
* from each row's base64: no body decoded or hashed, though each row is read whole, as the store
|
|
253
|
-
* has no part read.
|
|
632
|
+
* has no part read. When `cache` is provided, cached headers are returned without a store read and
|
|
633
|
+
* newly read inline rows are stored raw within the cache's bounds (#2899).
|
|
254
634
|
*/
|
|
255
|
-
const rowHeaders = (store, listed) => Effect.fnUntraced(function* (oids) {
|
|
635
|
+
const rowHeaders = (store, listed, onRow, cache) => Effect.fnUntraced(function* (oids) {
|
|
256
636
|
const headers = /* @__PURE__ */ new Map();
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
637
|
+
const missed = [];
|
|
638
|
+
for (const oid of new Set(oids)) {
|
|
639
|
+
if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") {
|
|
640
|
+
headers.set(emptyTree, {
|
|
641
|
+
type: "tree",
|
|
642
|
+
size: 0
|
|
643
|
+
});
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
const cached = cache?.headerOf(oid);
|
|
647
|
+
if (cached !== void 0) {
|
|
648
|
+
headers.set(oid, cached);
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
missed.push(oid);
|
|
652
|
+
}
|
|
653
|
+
if (missed.length === 0) return headers;
|
|
654
|
+
yield* eachRow(store, listed, missed, Effect.fnUntraced(function* (row) {
|
|
655
|
+
const header = yield* headerOfRow(row);
|
|
656
|
+
if (cache !== void 0 && chunkedOf(row.value) === void 0) cache.putRaw(row, header);
|
|
657
|
+
headers.set(row.id, header);
|
|
658
|
+
onRow?.(row, header);
|
|
659
|
+
}));
|
|
262
660
|
return headers;
|
|
263
661
|
});
|
|
264
662
|
/** The size of each of `oids`' rows the repo holds, as `rowHeaders` reads it. */
|
|
265
|
-
const rowSizes = (store, listed) => (oids) => Effect.map(rowHeaders(store, listed)(oids), (headers) => new Map([...headers].map(([oid, { size }]) => [oid, size])));
|
|
663
|
+
const rowSizes = (store, listed, cache) => (oids) => Effect.map(rowHeaders(store, listed, void 0, cache)(oids), (headers) => new Map([...headers].map(([oid, { size }]) => [oid, size])));
|
|
266
664
|
/**
|
|
267
|
-
* The IDs of `repo`'s object rows that start with `prefix`, at most `count
|
|
268
|
-
* version they're read at:
|
|
269
|
-
*
|
|
665
|
+
* The IDs of `repo`'s object rows that start with `prefix`, at most `count` from each place it
|
|
666
|
+
* reads, lowest first, deduplicated, and the version they're read at: `objects` and every published
|
|
667
|
+
* staged batch's size markers, under `eachRead`'s rule. With no batch listed it's one store read,
|
|
668
|
+
* or pages of `largeBatch` where `objects` rows pass one answer's 16 MiB. With batches, each new
|
|
669
|
+
* batch is checked by its `stagedSizes` prefix beside `objects` and `batches`, capped at
|
|
670
|
+
* `newBatchReadsMost` discoveries. `version` is `undefined` once the answer took more than one
|
|
671
|
+
* snapshot.
|
|
270
672
|
*/
|
|
271
673
|
const rowsStartingWith = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, prefix, count) {
|
|
272
|
-
const
|
|
674
|
+
const scope = repoScope(repo);
|
|
675
|
+
const read = (reads) => store.read({
|
|
676
|
+
scope,
|
|
677
|
+
reads: [...reads]
|
|
678
|
+
});
|
|
679
|
+
const objectsRead = (limit, after) => {
|
|
273
680
|
const asked = {
|
|
274
681
|
collection: objectCollections.objects,
|
|
275
682
|
prefix,
|
|
276
683
|
limit
|
|
277
684
|
};
|
|
278
685
|
if (after !== void 0) asked.after = after;
|
|
279
|
-
return
|
|
280
|
-
scope: repoScope(repo),
|
|
281
|
-
reads: [asked]
|
|
282
|
-
});
|
|
686
|
+
return asked;
|
|
283
687
|
};
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
688
|
+
const markerRead = (batch) => ({
|
|
689
|
+
collection: objectCollections.stagedSizes,
|
|
690
|
+
prefix: `${stagedPrefix(batch)}${prefix}`,
|
|
691
|
+
limit: count
|
|
692
|
+
});
|
|
693
|
+
const inObjects = Effect.fnUntraced(function* () {
|
|
694
|
+
const whole = yield* read([objectsRead(count), batchesRead]).pipe(orTooLarge);
|
|
695
|
+
if (whole !== void 0) return {
|
|
696
|
+
oids: (whole.results[0] ?? []).map((row) => row.id),
|
|
697
|
+
listed: yield* listedBatches(whole.results[1]),
|
|
698
|
+
version: whole.version
|
|
699
|
+
};
|
|
700
|
+
const oids = [];
|
|
701
|
+
const listed = /* @__PURE__ */ new Set();
|
|
702
|
+
let after;
|
|
703
|
+
while (oids.length < count) {
|
|
704
|
+
const limit = Math.min(largeBatch, count - oids.length);
|
|
705
|
+
const page = yield* read([objectsRead(limit, after), batchesRead]);
|
|
706
|
+
const rows = page.results[0] ?? [];
|
|
707
|
+
oids.push(...rows.map((row) => row.id));
|
|
708
|
+
for (const batch of yield* listedBatches(page.results[1])) listed.add(batch);
|
|
709
|
+
if (rows.length < limit) break;
|
|
710
|
+
after = rows.at(-1)?.id;
|
|
711
|
+
}
|
|
712
|
+
return {
|
|
713
|
+
oids,
|
|
714
|
+
listed: [...listed],
|
|
715
|
+
version: void 0
|
|
716
|
+
};
|
|
717
|
+
});
|
|
718
|
+
const first = yield* inObjects();
|
|
719
|
+
if (first.listed.length === 0) return {
|
|
720
|
+
oids: first.oids,
|
|
721
|
+
version: first.version
|
|
288
722
|
};
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
723
|
+
const found = new Set(first.oids);
|
|
724
|
+
const checked = /* @__PURE__ */ new Set();
|
|
725
|
+
const answer = (version) => ({
|
|
726
|
+
oids: [...found].toSorted(),
|
|
727
|
+
version
|
|
728
|
+
});
|
|
729
|
+
let listed = first.listed;
|
|
730
|
+
let discoveries = 0;
|
|
731
|
+
for (;;) {
|
|
732
|
+
const fresh = listed.filter((batch) => !checked.has(batch));
|
|
733
|
+
if (fresh.length === 0) return answer(void 0);
|
|
734
|
+
if (discoveries >= 32) return yield* batchesMoved();
|
|
735
|
+
discoveries += 1;
|
|
736
|
+
const snapshot = yield* read([
|
|
737
|
+
objectsRead(count),
|
|
738
|
+
batchesRead,
|
|
739
|
+
...fresh.map(markerRead)
|
|
740
|
+
]).pipe(orTooLarge);
|
|
741
|
+
let now;
|
|
742
|
+
let version;
|
|
743
|
+
if (snapshot !== void 0) {
|
|
744
|
+
for (const row of snapshot.results[0] ?? []) found.add(row.id);
|
|
745
|
+
now = yield* listedBatches(snapshot.results[1]);
|
|
746
|
+
const nowSet = new Set(now);
|
|
747
|
+
for (const [i, batch] of fresh.entries()) {
|
|
748
|
+
if (!nowSet.has(batch)) continue;
|
|
749
|
+
for (const row of snapshot.results[i + 2] ?? []) found.add(stagedOid(row.id));
|
|
750
|
+
}
|
|
751
|
+
version = discoveries === 1 ? snapshot.version : void 0;
|
|
752
|
+
} else {
|
|
753
|
+
const markers = yield* read(fresh.map(markerRead));
|
|
754
|
+
for (const row of markers.results.flat()) found.add(stagedOid(row.id));
|
|
755
|
+
const paged = yield* inObjects();
|
|
756
|
+
for (const oid of paged.oids) found.add(oid);
|
|
757
|
+
now = paged.listed;
|
|
758
|
+
}
|
|
759
|
+
for (const batch of fresh) checked.add(batch);
|
|
760
|
+
if (now.every((batch) => checked.has(batch))) return answer(version);
|
|
761
|
+
listed = now;
|
|
297
762
|
}
|
|
298
|
-
return {
|
|
299
|
-
oids,
|
|
300
|
-
version: void 0
|
|
301
|
-
};
|
|
302
763
|
});
|
|
303
764
|
/** What `ObjectReader.startingWith` answers from the IDs each place found: each once, lowest first. */
|
|
304
765
|
const startingOf = (found, most) => {
|
|
@@ -308,4 +769,4 @@ const startingOf = (found, most) => {
|
|
|
308
769
|
more: all.length > most
|
|
309
770
|
};
|
|
310
771
|
};
|
|
311
|
-
export { ObjectRow, copyRowsPage, eachHeldRow, eachPageAt, emptyTreeObject, gitObjectOf, heldIdsAt, heldRows, largeBatch, noRows, objectKey, objectOfRow, objectRow, receivedRows, rowHeaders, rowSizes, rowValueBytes, rowsMoved, rowsStartingWith, startingOf, tooLargeRead };
|
|
772
|
+
export { ObjectRow, bodyPackBytes, copyRowsPage, eachHeldRow, eachPageAt, emptyTreeObject, gitObjectOf, headerOfRow, heldIdsAt, heldRows, largeBatch, noRows, objectKey, objectOfRow, objectRow, readStagedRows, readsOwnChunks, receivedObject, receivedRows, rowAt, rowHeaders, rowInflatedBytes, rowSizes, rowValueBytes, rowsInflatedBytes, rowsMoved, rowsStartingWith, startingOf, tooLargeRead, wholePageRows };
|