@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
package/dist/storage/packs.mjs
CHANGED
|
@@ -1,102 +1,142 @@
|
|
|
1
|
-
import { fail
|
|
1
|
+
import { fail } from "../contracts/result.mjs";
|
|
2
2
|
import { PackTransportError } from "../protocol/packs/reader.mjs";
|
|
3
|
+
import { stepEffect } from "../protocol/packs/step.mjs";
|
|
3
4
|
import { decodeRecord } from "../store/catalogue.mjs";
|
|
4
5
|
import { decodePacks } from "../store/git-store.mjs";
|
|
5
6
|
import { tryUnlessSpent } from "../contracts/calls-spent.mjs";
|
|
6
|
-
import { resultCall } from "../store/errors.mjs";
|
|
7
7
|
import { decodeStats, repoStats } from "../store/repo-record.mjs";
|
|
8
8
|
import { collections, newChangeId, repoScope, selfKey } from "../store/scopes.mjs";
|
|
9
|
-
import { CallBudget, RequestCalls, callScope, checkedLimits, countInto, countedAs, heldCall, noScope, readScope, requestCount, stepBudget, withBound } from "../store/call-count.mjs";
|
|
10
|
-
import { forkIn, noCall
|
|
11
|
-
import {
|
|
9
|
+
import { CallBudget, RequestCalls, callScope, checkedLimits, countInto, countedAs, heldCall, inCallScope, noScope, readScope, requestCount, stepBudget, withBound } from "../store/call-count.mjs";
|
|
10
|
+
import { forkIn, noCall } from "../store/crossing.mjs";
|
|
11
|
+
import { jobCallLimitsOf } from "../store/job-try.mjs";
|
|
12
|
+
import { RequestSnapshot } from "../store/request-snapshot.mjs";
|
|
13
|
+
import { bestEffort } from "../store/errors.mjs";
|
|
14
|
+
import { bucketDo, cancelsBody, madeOwned, objectReader } from "./calls.mjs";
|
|
12
15
|
import { budgetCalls, countedBucket } from "./counted-bucket.mjs";
|
|
13
16
|
import { hostFailures } from "./host-bucket.mjs";
|
|
14
17
|
import { cleanUp } from "./clean-up.mjs";
|
|
15
18
|
import { awaitingIndex, fetchPack, fetchTooLarge, pastLimits, planTooSlow, refusedWhenSpent, timeLeft } from "./fetch.mjs";
|
|
16
19
|
import { graphMostOf, indexRowOf, indexSaves, indexStatus, indexTry } from "./index-build.mjs";
|
|
17
|
-
import { indexEligible } from "./index-fetch.mjs";
|
|
20
|
+
import { indexEligible, indexPath } from "./index-fetch.mjs";
|
|
18
21
|
import { listedIds } from "./listed-ids.mjs";
|
|
19
|
-
import { indexHolds } from "./index-remap.mjs";
|
|
20
|
-
import { indexRowKey, isPackId } from "./layout.mjs";
|
|
21
|
-
import { ReachCache, indexReach, reachedRoots } from "./index-reach.mjs";
|
|
22
|
+
import { defaultRemapCpuMost, indexHolds } from "./index-remap.mjs";
|
|
23
|
+
import { indexRowKey, isPackId, packFiles, prunePassKey } from "./layout.mjs";
|
|
24
|
+
import { ReachCache, indexReach, reachCacheBytes, reachedRoots } from "./index-reach.mjs";
|
|
22
25
|
import { indexedVisible, setReachOf } from "./index-visible.mjs";
|
|
23
|
-
import { pointersOfObjects } from "./lfs-pointers.mjs";
|
|
24
|
-
import { largestOf } from "./largest-files.mjs";
|
|
25
26
|
import { PackIndexes, packReader, seedBytes } from "./pack-reads.mjs";
|
|
26
|
-
import {
|
|
27
|
+
import { maintainBatches, withBatchesDue } from "./batch-upkeep.mjs";
|
|
28
|
+
import { abandonBatch, batchStager, deltaPartBytes, openBatch, stageBytes, streamedChange } from "./batches.mjs";
|
|
29
|
+
import { copyRowsPage, gitObjectOf, noRows, readStagedRows } from "./object-rows.mjs";
|
|
30
|
+
import { createReceiveCache, wholeOfCached } from "./receive-cache.mjs";
|
|
27
31
|
import { pushedCommitsPage } from "./pushed-commits.mjs";
|
|
28
32
|
import { segmentTooLarge } from "./links.mjs";
|
|
29
33
|
import { walkWithin } from "./swap-walk.mjs";
|
|
30
34
|
import { receivePack, tooMany } from "./pack-receive.mjs";
|
|
31
|
-
import { mergesAlone, passDue, passScratch, pruneStartedKey, pruneStep, readPrune } from "./prune.mjs";
|
|
35
|
+
import { mergesAlone, passAlone, passDue, passScratch, pruneStartedKey, pruneStep, readPrune } from "./prune.mjs";
|
|
32
36
|
import { rebuildStep } from "./graph-rebuild.mjs";
|
|
33
37
|
import { liftedFences, unfenced } from "./merge-fence.mjs";
|
|
34
38
|
import { freshCalls, geometricStep, groupedPacks, membersOf, opensWithin, resumeMerge, streamHeld } from "./merge-stream.mjs";
|
|
35
39
|
import { droppedStep, mergeKey } from "./merge-row.mjs";
|
|
36
|
-
import { parksPass } from "./repack-job.mjs";
|
|
37
|
-
import { sharePacks } from "./quarantine.mjs";
|
|
38
|
-
import { burstOptions, defaultRepack, optionFor, readObjectRows } from "./repack.mjs";
|
|
40
|
+
import { parksPass, repackJobRow } from "./repack-job.mjs";
|
|
41
|
+
import { dropRefused, sharePacks } from "./quarantine.mjs";
|
|
42
|
+
import { burstOptions, defaultRepack, foldStep, optionFor, readObjectRows, rowsPastInflated } from "./repack.mjs";
|
|
39
43
|
import { containedPlan, containedWalk, countedMerge } from "./repack-contained.mjs";
|
|
40
44
|
import { refuseBacklog } from "./repack-backlog.mjs";
|
|
41
|
-
import { defaultShallow,
|
|
45
|
+
import { defaultShallow, readyAskMs, readyAskRoomMs, readyBytesOf, readyKey, readyLookup, readyStep, untilEnded, wantedRow } from "./ready.mjs";
|
|
42
46
|
import { defaultPrune, deletedLeaveAt, pruneWait, quarantineKey } from "./rows.mjs";
|
|
43
|
-
import { readAnswer, receiveStep, stageReceive } from "./receive-steps.mjs";
|
|
47
|
+
import { openStageReceive, readAnswer, receiveStep, stageReceive, stageReceiveStep, stageStepKey } from "./receive-steps.mjs";
|
|
44
48
|
import { memoryOf, openBudget } from "./packs-memory.mjs";
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
+
import { receiveRoomAdmitted } from "./receive-admission.mjs";
|
|
50
|
+
import { fetchFloorBytes, fetchRowCacheBytes, headroomBytes, idleHeapBytes, pushAdmissionOf, pushFloorsOf, pushPartBytes, pushRulesOf, readReserveBytes, readerFloorBytes, readerMost, unpackInflatedMost } from "./budget.mjs";
|
|
51
|
+
import { chargedCache } from "./charged-cache.mjs";
|
|
52
|
+
import { serverRequestBudget } from "./request-cache.mjs";
|
|
53
|
+
import { AllottedPointers, allotmentCacheCharge, allottedWithin, cacheRoomCharge, fetchBusy, growWaitMs, instanceRoomOf, pushMemoryOf, pushObjectsMostOf, pushTooLarge, readBusy, readerMemoryOf, requestBudgetOf, rowCacheRoomOf, upkeepMemoryOf, upkeepTooLarge, withMemoryBudget } from "./memory-budget.mjs";
|
|
54
|
+
import { PacksAllotment, catchPack, treesBusy } from "./push-allotment.mjs";
|
|
55
|
+
import { adoptFetchRowCache, fetchIndexRowOf, fetchRowCacheOf } from "./fetch-row-cache.mjs";
|
|
49
56
|
import { wholeAnswer, wholePlan, wholeStream } from "./stream-whole.mjs";
|
|
50
|
-
import {
|
|
57
|
+
import { pastDeclared, readFailure, unpackObjects } from "./unpack.mjs";
|
|
51
58
|
import { seenFetch, visibleOf, walkedVisible } from "./visible.mjs";
|
|
52
|
-
import
|
|
59
|
+
import { limits } from "@ref0/infra";
|
|
53
60
|
import * as Effect from "effect/Effect";
|
|
54
|
-
import * as Exit from "effect/Exit";
|
|
55
61
|
import * as Predicate from "effect/Predicate";
|
|
56
62
|
import * as Context from "effect/Context";
|
|
57
|
-
import * as
|
|
63
|
+
import * as Exit from "effect/Exit";
|
|
64
|
+
import * as Scope$1 from "effect/Scope";
|
|
65
|
+
import * as Clock from "effect/Clock";
|
|
58
66
|
// src/storage/packs.ts
|
|
59
|
-
/** A push at or under
|
|
67
|
+
/** A push at or under 500 objects and 4 MiB is kept as rows (#2518). */
|
|
60
68
|
const defaultUnpack = {
|
|
61
|
-
maxObjects:
|
|
62
|
-
maxBytes:
|
|
69
|
+
maxObjects: 500,
|
|
70
|
+
maxBytes: 4194304
|
|
63
71
|
};
|
|
64
72
|
/**
|
|
65
|
-
* The pack's first chunks, read until they pass `most` bytes
|
|
66
|
-
*
|
|
67
|
-
*
|
|
73
|
+
* The pack's first chunks, read until they pass `most` bytes, the allotment has no room to hold
|
|
74
|
+
* more, or the pack ends. Every chunk buffered here is charged to `allotment` via `tryGrow` and
|
|
75
|
+
* returned via `release()` on completion, fallback, failure, or interrupt. A chunked push says no
|
|
76
|
+
* size, so its bytes are counted as they come. A pack that ends is let go of at once, each chunk a
|
|
77
|
+
* view of a larger buffer copied, so the small pack holds no more than its own bytes. One that
|
|
68
78
|
* doesn't hands on its reader, which `rejoined` lets go of. A read that fails or is interrupted
|
|
69
79
|
* cancels the pack, not waiting on the cancel, and lets go.
|
|
70
80
|
*/
|
|
71
|
-
const readPast = (pack, most) => Effect.suspend(() => {
|
|
81
|
+
const readPast = (pack, most, allotment, covered = 0) => Effect.suspend(() => {
|
|
72
82
|
const reader = pack.getReader();
|
|
83
|
+
let seen = 0;
|
|
84
|
+
let charged = 0;
|
|
85
|
+
const shrink = (bytes) => {
|
|
86
|
+
const give = Math.min(bytes, charged);
|
|
87
|
+
if (give <= 0) return;
|
|
88
|
+
charged -= give;
|
|
89
|
+
allotment.shrink(give);
|
|
90
|
+
};
|
|
91
|
+
const release = () => shrink(charged);
|
|
92
|
+
const charge = (bytes) => {
|
|
93
|
+
if (bytes <= 0) return true;
|
|
94
|
+
const next = seen + bytes;
|
|
95
|
+
const extra = Math.max(0, next - Math.max(seen, covered));
|
|
96
|
+
if (extra > 0 && !allotment.tryGrow(extra)) return false;
|
|
97
|
+
seen = next;
|
|
98
|
+
charged += extra;
|
|
99
|
+
return true;
|
|
100
|
+
};
|
|
73
101
|
const stop = Effect.sync(() => {
|
|
74
102
|
reader.cancel().catch(() => void 0);
|
|
75
103
|
reader.releaseLock();
|
|
104
|
+
release();
|
|
76
105
|
});
|
|
77
|
-
return readChunks(reader, most).pipe(Effect.onError(() => stop));
|
|
106
|
+
return readChunks(reader, most, charge, shrink, release).pipe(Effect.onError(() => stop));
|
|
78
107
|
});
|
|
79
|
-
const readChunks = (reader, most
|
|
108
|
+
const readChunks = /* @__PURE__ */ Effect.fnUntraced(function* (reader, most, charge, shrink, release) {
|
|
80
109
|
const chunks = [];
|
|
81
110
|
let bytes = 0;
|
|
82
111
|
while (bytes <= most) {
|
|
83
|
-
const read =
|
|
112
|
+
const read = yield* tryUnlessSpent(() => reader.read(), (cause) => readFailure(new PackTransportError({ cause })));
|
|
84
113
|
if (read.done) {
|
|
85
114
|
reader.releaseLock();
|
|
86
115
|
return {
|
|
87
116
|
ended: true,
|
|
88
|
-
chunks: chunks.map(owned)
|
|
117
|
+
chunks: chunks.map(owned),
|
|
118
|
+
shrink,
|
|
119
|
+
release
|
|
89
120
|
};
|
|
90
121
|
}
|
|
91
122
|
chunks.push(read.value);
|
|
92
123
|
bytes += read.value.byteLength;
|
|
124
|
+
if (!charge(read.value.byteLength)) return {
|
|
125
|
+
ended: false,
|
|
126
|
+
chunks,
|
|
127
|
+
reader,
|
|
128
|
+
shrink,
|
|
129
|
+
release
|
|
130
|
+
};
|
|
93
131
|
}
|
|
94
132
|
return {
|
|
95
133
|
ended: false,
|
|
96
134
|
chunks,
|
|
97
|
-
reader
|
|
135
|
+
reader,
|
|
136
|
+
shrink,
|
|
137
|
+
release
|
|
98
138
|
};
|
|
99
|
-
}
|
|
139
|
+
});
|
|
100
140
|
/** `chunk`, copied when it's a view of a larger buffer, which it would otherwise keep. */
|
|
101
141
|
const owned = (chunk) => chunk.byteOffset === 0 && chunk.byteLength === chunk.buffer.byteLength ? chunk : chunk.slice();
|
|
102
142
|
/** What a replayed chunk's place holds, so the chunk itself can go. */
|
|
@@ -106,7 +146,7 @@ const empty = /* @__PURE__ */ new Uint8Array(0);
|
|
|
106
146
|
* `reader`, and lets go of it once the pack ends, its read fails, or it's cancelled, after the
|
|
107
147
|
* cancel starts.
|
|
108
148
|
*/
|
|
109
|
-
const rejoined = (chunks, reader) => {
|
|
149
|
+
const rejoined = (chunks, reader, onChunk) => {
|
|
110
150
|
let next = 0;
|
|
111
151
|
return new ReadableStream({
|
|
112
152
|
pull: async (controller) => {
|
|
@@ -114,6 +154,7 @@ const rejoined = (chunks, reader) => {
|
|
|
114
154
|
if (chunk !== void 0) {
|
|
115
155
|
chunks[next] = empty;
|
|
116
156
|
next += 1;
|
|
157
|
+
onChunk?.(chunk.byteLength);
|
|
117
158
|
return controller.enqueue(chunk);
|
|
118
159
|
}
|
|
119
160
|
if (reader === void 0) return controller.close();
|
|
@@ -137,7 +178,6 @@ const rejoined = (chunks, reader) => {
|
|
|
137
178
|
};
|
|
138
179
|
/** A step whose record another try of it committed first: the next try goes on from there. */
|
|
139
180
|
const stepLost = fail("UNAVAILABLE", "Another try of this receive's step committed first", { hint: "Try the step again" });
|
|
140
|
-
const tooManyToUnpack = (count) => gitError("INVALID_ARGUMENT", `The pack's header counts ${count} objects, past what its push said`, { hint: "Push again" });
|
|
141
181
|
/**
|
|
142
182
|
* A repo's stats, read for an option given as a function: its record, refs, `stats` times, listed
|
|
143
183
|
* packs and ready shallow pack, all at one version, so the bytes are a total some version held.
|
|
@@ -216,39 +256,238 @@ const linkedPacks = /* @__PURE__ */ Effect.fnUntraced(function* (reader, oids) {
|
|
|
216
256
|
};
|
|
217
257
|
});
|
|
218
258
|
/**
|
|
259
|
+
* Push-allotment hooks for `batchStager`: reserves each prepared entry's size (flushing buffered
|
|
260
|
+
* entries on memory pressure) and releases the stager's charge whenever `batchStager` flushes.
|
|
261
|
+
*/
|
|
262
|
+
const stagerHooks = (charge) => {
|
|
263
|
+
let charged = 0;
|
|
264
|
+
const releaseCharge = () => {
|
|
265
|
+
if (charged <= 0) return;
|
|
266
|
+
const held = charged;
|
|
267
|
+
charged = 0;
|
|
268
|
+
charge.shrink(held);
|
|
269
|
+
};
|
|
270
|
+
return {
|
|
271
|
+
reserve: Effect.fnUntraced(function* (bytes, hasBuffered, flush) {
|
|
272
|
+
if (bytes <= 0) return;
|
|
273
|
+
if (hasBuffered) {
|
|
274
|
+
if (charge.tryGrow(bytes)) {
|
|
275
|
+
charged += bytes;
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
yield* flush();
|
|
279
|
+
}
|
|
280
|
+
yield* charge.grow(bytes, () => {
|
|
281
|
+
charged += bytes;
|
|
282
|
+
});
|
|
283
|
+
}),
|
|
284
|
+
flush: (send) => Effect.ensuring(send, Effect.sync(releaseCharge)),
|
|
285
|
+
clear: releaseCharge
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Fallback split for speculative `receiveRows`: decides in one place when a rows refusal may retry
|
|
290
|
+
* through `asPack` and when the rows path's memory refusal must be preserved.
|
|
291
|
+
*
|
|
292
|
+
* Whole-push admission (`budget.admit(pushAdmissionOf(input))`, before `receiveWithin`) and shared
|
|
293
|
+
* LFS pointer charging (`pointers.carrying`, after `receiveRows` succeeds) apply to both paths and
|
|
294
|
+
* never enter this split. Every `pushTooLarge` inside `receiveRows` comes from rows-only working
|
|
295
|
+
* buffers, so a self-contained pack can still succeed in `asPack`.
|
|
296
|
+
*/
|
|
297
|
+
const canFallbackFromRows = (error) => error.code === "RESOURCE_EXHAUSTED" && (error.context?.["reason"] === "object-too-large" || error.context?.["reason"] === "too-large" || error.context?.["reason"] === "delta-chain-too-deep");
|
|
298
|
+
const isNoThinPackRefusal = (error) => error.code === "INVALID_ARGUMENT" && error.context?.["reason"] === "base-not-before";
|
|
299
|
+
const rowsFallbackError = (rowsError, packError) => {
|
|
300
|
+
const rowsTooLarge = rowsError === pushTooLarge || rowsError.code === "RESOURCE_EXHAUSTED" && rowsError.context?.["reason"] === "too-large";
|
|
301
|
+
const packTooLarge = packError.code === "RESOURCE_EXHAUSTED" && packError.context?.["reason"] === "too-large";
|
|
302
|
+
if (rowsError === pushTooLarge && (isNoThinPackRefusal(packError) || packTooLarge)) return rowsError;
|
|
303
|
+
if (rowsTooLarge && isNoThinPackRefusal(packError)) return rowsError;
|
|
304
|
+
return packError;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
219
307
|
* A small push as rows: it refuses an `OFS_DELTA` as a stored pack does, so one push answers alike
|
|
220
|
-
* at any size.
|
|
308
|
+
* at any size. Streams external thin bases via `eachHeld` on the shared `memory.outside` high-water
|
|
309
|
+
* (reusing `PackIndexer`'s reservation for packed bases and `ReceiveCache` for cached hits, while
|
|
310
|
+
* charging uncached row bases once), reclaims pending instructions before growing for an external
|
|
311
|
+
* base, and charges working-set buffers to `memory.allotment` (#2518).
|
|
221
312
|
*/
|
|
222
|
-
const receiveRows = /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
313
|
+
const receiveRows = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, makeReader, unpack, receive, memory, cache) {
|
|
314
|
+
const { allotment } = memory;
|
|
223
315
|
const objects = unpack === false ? 0 : unpack.maxObjects;
|
|
316
|
+
const bytes = unpack === false ? 0 : unpack.maxBytes;
|
|
317
|
+
const lru = chargedCache(cacheRoomCharge(memory.cache), {
|
|
318
|
+
maxBytes: pushFloorsOf(receive).cache,
|
|
319
|
+
entryOverhead: 96,
|
|
320
|
+
weight: (object) => object.bytes.byteLength,
|
|
321
|
+
evict: "lru"
|
|
322
|
+
});
|
|
323
|
+
let opened;
|
|
324
|
+
let stager;
|
|
325
|
+
let clearStager;
|
|
326
|
+
const covered = receiveRoomAdmitted(receive.objects, receive.needs?.length ?? 0);
|
|
327
|
+
let used = 0;
|
|
328
|
+
let grown = 0;
|
|
329
|
+
let outsideHigh = 0;
|
|
330
|
+
let reclaimState;
|
|
331
|
+
let reclaiming = false;
|
|
332
|
+
const extraFor = (amount) => Math.max(0, used + amount - Math.max(used, covered));
|
|
333
|
+
const runReclaim = Effect.fnUntraced(function* (need) {
|
|
334
|
+
if (reclaiming || reclaimState === void 0 || need <= allotment.growable) return;
|
|
335
|
+
const { ensureStager, waiting, dropPending, hasInline } = reclaimState;
|
|
336
|
+
reclaiming = true;
|
|
337
|
+
yield* Effect.gen(function* () {
|
|
338
|
+
if (hasInline()) yield* ensureStager();
|
|
339
|
+
if (stager !== void 0) yield* stager.flush();
|
|
340
|
+
for (const map of waiting) for (const list of map.values()) for (const delta of list) {
|
|
341
|
+
if (need <= allotment.growable) return;
|
|
342
|
+
const data = delta.data;
|
|
343
|
+
if (data === void 0) continue;
|
|
344
|
+
const active = yield* ensureStager();
|
|
345
|
+
const parts = [];
|
|
346
|
+
for (let at = 0; at < data.byteLength; at += deltaPartBytes) {
|
|
347
|
+
const take = Math.min(deltaPartBytes, data.byteLength - at);
|
|
348
|
+
stagerCharge.shrink(take);
|
|
349
|
+
yield* active.pushDelta(delta.seq, parts.length, data.subarray(at, at + take));
|
|
350
|
+
parts.push(take);
|
|
351
|
+
}
|
|
352
|
+
delta.data = void 0;
|
|
353
|
+
delta.parts = parts;
|
|
354
|
+
dropPending(data.byteLength);
|
|
355
|
+
yield* active.flush();
|
|
356
|
+
}
|
|
357
|
+
}).pipe(Effect.ensuring(Effect.sync(() => {
|
|
358
|
+
reclaiming = false;
|
|
359
|
+
})));
|
|
360
|
+
});
|
|
361
|
+
const reserveOutside = (need) => {
|
|
362
|
+
if (need <= outsideHigh) return void 0;
|
|
363
|
+
const delta = need - outsideHigh;
|
|
364
|
+
const grow = () => Effect.tap(stepEffect(memory.outside(need)), () => Effect.sync(() => {
|
|
365
|
+
outsideHigh = Math.max(outsideHigh, need);
|
|
366
|
+
}));
|
|
367
|
+
return delta <= allotment.growable || reclaimState === void 0 ? grow() : Effect.flatMap(runReclaim(delta), grow);
|
|
368
|
+
};
|
|
369
|
+
const reader = makeReader({
|
|
370
|
+
...memory.reader,
|
|
371
|
+
outside: reserveOutside
|
|
372
|
+
});
|
|
373
|
+
const cachedReader = cache === void 0 ? reader : cache.wrap(reader);
|
|
374
|
+
const stagerCharge = {
|
|
375
|
+
tryGrow: (amount) => {
|
|
376
|
+
if (amount <= 0) return true;
|
|
377
|
+
const extra = extraFor(amount);
|
|
378
|
+
if (extra > 0 && !allotment.tryGrow(extra)) return false;
|
|
379
|
+
used += amount;
|
|
380
|
+
grown += extra;
|
|
381
|
+
return true;
|
|
382
|
+
},
|
|
383
|
+
grow: (amount, adopted) => Effect.suspend(() => {
|
|
384
|
+
if (amount <= 0) {
|
|
385
|
+
adopted?.();
|
|
386
|
+
return Effect.void;
|
|
387
|
+
}
|
|
388
|
+
const take = () => {
|
|
389
|
+
const extra = extraFor(amount);
|
|
390
|
+
if (extra === 0) {
|
|
391
|
+
used += amount;
|
|
392
|
+
adopted?.();
|
|
393
|
+
return Effect.void;
|
|
394
|
+
}
|
|
395
|
+
return allotment.grow(extra, pushTooLarge, () => {
|
|
396
|
+
used += amount;
|
|
397
|
+
grown += extra;
|
|
398
|
+
adopted?.();
|
|
399
|
+
});
|
|
400
|
+
};
|
|
401
|
+
const extra = extraFor(amount);
|
|
402
|
+
return !reclaiming && extra > allotment.growable && reclaimState !== void 0 ? Effect.flatMap(runReclaim(extra), take) : take();
|
|
403
|
+
}),
|
|
404
|
+
shrink: (amount) => {
|
|
405
|
+
if (amount <= 0) return;
|
|
406
|
+
const nextUsed = Math.max(0, used - amount);
|
|
407
|
+
const neededGrown = Math.max(0, nextUsed - covered);
|
|
408
|
+
const give = Math.max(0, grown - neededGrown);
|
|
409
|
+
used = nextUsed;
|
|
410
|
+
grown -= give;
|
|
411
|
+
if (give > 0) allotment.shrink(give);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
const unpackMemory = {
|
|
415
|
+
...stagerCharge,
|
|
416
|
+
page: (roundCap) => Math.min(roundCap, Math.max(limits.valueBytes, allotment.growable + Math.max(0, covered - used))),
|
|
417
|
+
delta: Effect.fnUntraced(function* (size, canHold, spillChunk) {
|
|
418
|
+
if (size > allotment.growable + Math.max(covered, used)) yield* stagerCharge.grow(size);
|
|
419
|
+
if (canHold && stagerCharge.tryGrow(size)) return true;
|
|
420
|
+
yield* stagerCharge.grow(spillChunk);
|
|
421
|
+
return false;
|
|
422
|
+
}),
|
|
423
|
+
free: (ensureStager, waiting, dropPending, hasInline) => {
|
|
424
|
+
reclaimState = {
|
|
425
|
+
ensureStager,
|
|
426
|
+
waiting,
|
|
427
|
+
dropPending,
|
|
428
|
+
hasInline
|
|
429
|
+
};
|
|
430
|
+
},
|
|
431
|
+
lru
|
|
432
|
+
};
|
|
433
|
+
const staging = {
|
|
434
|
+
stager: Effect.fnUntraced(function* () {
|
|
435
|
+
opened ??= yield* openBatch({
|
|
436
|
+
store,
|
|
437
|
+
repo,
|
|
438
|
+
at: yield* Clock.currentTimeMillis
|
|
439
|
+
});
|
|
440
|
+
if (stager === void 0) {
|
|
441
|
+
const hooks = stagerHooks(stagerCharge);
|
|
442
|
+
clearStager = hooks.clear;
|
|
443
|
+
stager = batchStager(store, repo, opened, stageBytes, hooks);
|
|
444
|
+
}
|
|
445
|
+
return stager;
|
|
446
|
+
}),
|
|
447
|
+
readStaged: readStagedRows(store, repo)
|
|
448
|
+
};
|
|
449
|
+
const eachHeld = (oids, take) => cachedReader.each(oids, (object) => Effect.flatMap(cache?.bodies.has(object.oid) === true ? Effect.void : stepEffect(reserveOutside(object.bytes.byteLength)), () => take(object)));
|
|
224
450
|
const unpacked = yield* unpackObjects({
|
|
225
451
|
receive,
|
|
226
452
|
limits: {
|
|
227
453
|
objects,
|
|
228
|
-
bytes
|
|
454
|
+
bytes
|
|
229
455
|
},
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
456
|
+
inflatedBytes: unpackInflatedMost,
|
|
457
|
+
tooMany: pastDeclared,
|
|
458
|
+
held: cachedReader.held,
|
|
459
|
+
eachHeld,
|
|
460
|
+
headers: cachedReader.headers,
|
|
461
|
+
offsetDeltas: "refuse",
|
|
462
|
+
staging,
|
|
463
|
+
memory: unpackMemory
|
|
464
|
+
}).pipe(Effect.onError(() => opened === void 0 ? Effect.void : abandonBatch(store, repo, opened.batch)), Effect.ensuring(Effect.sync(() => {
|
|
465
|
+
lru.clear();
|
|
466
|
+
clearStager?.();
|
|
467
|
+
stagerCharge.shrink(used);
|
|
468
|
+
})));
|
|
469
|
+
const staged = streamedChange(opened, unpacked.inlineRows, unpacked.own, unpacked.moved, yield* Clock.currentTimeMillis);
|
|
234
470
|
const quarantine = {
|
|
235
471
|
id: newChangeId(),
|
|
236
|
-
change:
|
|
237
|
-
put: unpacked.rows,
|
|
238
|
-
rows: unpacked.moved
|
|
239
|
-
},
|
|
472
|
+
change: staged.change,
|
|
240
473
|
bytes: unpacked.bytes,
|
|
241
|
-
objects: unpacked.
|
|
242
|
-
lfsPointers:
|
|
243
|
-
...
|
|
474
|
+
objects: unpacked.count,
|
|
475
|
+
lfsPointers: unpacked.lfsPointers,
|
|
476
|
+
...unpacked.largest
|
|
244
477
|
};
|
|
245
478
|
if (unpacked.cut.length > 0) quarantine.cut = unpacked.cut;
|
|
246
|
-
|
|
247
|
-
if (
|
|
248
|
-
|
|
249
|
-
|
|
479
|
+
if (staged.quarantine !== void 0) quarantine.quarantine = staged.quarantine;
|
|
480
|
+
if (unpacked.roots === void 0) return {
|
|
481
|
+
quarantine,
|
|
482
|
+
batch: opened?.batch
|
|
483
|
+
};
|
|
484
|
+
quarantine.roots = unpacked.roots;
|
|
485
|
+
const linked = unpacked.outside === void 0 ? void 0 : yield* linkedPacks(cachedReader, unpacked.outside);
|
|
250
486
|
if (linked !== void 0) quarantine.linked = linked;
|
|
251
|
-
return
|
|
487
|
+
return {
|
|
488
|
+
quarantine,
|
|
489
|
+
batch: opened?.batch
|
|
490
|
+
};
|
|
252
491
|
});
|
|
253
492
|
/**
|
|
254
493
|
* `packs()`: each push's objects one pack in the bucket, indexed as it streams in, under a
|
|
@@ -256,7 +495,15 @@ const receiveRows = /* @__PURE__ */ Effect.fnUntraced(function* (reader, unpack,
|
|
|
256
495
|
* opened `GitObjects` serves every repo of its server, each read by its own `Listed`; only the
|
|
257
496
|
* packs' indexes are kept across calls, by pack.
|
|
258
497
|
*/
|
|
259
|
-
const packs = (options = {}) =>
|
|
498
|
+
const packs = (options = {}) => packsWith(options);
|
|
499
|
+
/**
|
|
500
|
+
* `packs(options)`, with `inner`'s settings past its options: one seam, kept for
|
|
501
|
+
* `index-fetch-levels.test.ts` alone. Its rows pin the range path's search and join over a pack of
|
|
502
|
+
* 1,000 objects (#945, #522, #2140), an index under `wholeIndexMost` that would otherwise be read
|
|
503
|
+
* whole; one sized past it holds a pack whose `.idx` reads differently, so those rows would test
|
|
504
|
+
* something else.
|
|
505
|
+
*/
|
|
506
|
+
const packsWith = (options = {}, inner = {}) => {
|
|
260
507
|
const memoryTotal = memoryOf(options.memory);
|
|
261
508
|
if (options.repack !== false && memoryTotal < packsMemoryLeast) throw new RangeError(`packs()' memory of ${memoryTotal} bytes leaves upkeep no room for a merge: raise it to at least ${packsMemoryLeast}`);
|
|
262
509
|
const optionsFor = (stats) => {
|
|
@@ -276,6 +523,7 @@ const packs = (options = {}) => {
|
|
|
276
523
|
open: ({ store: calls, bucket: hosts, clock, fetchLimits, callLimits }) => {
|
|
277
524
|
const bucket = countedBucket(hostFailures(hosts));
|
|
278
525
|
const callsMost = fetchCallsMost(callLimits, options.callLimits);
|
|
526
|
+
const stepMost = callLimits === void 0 ? callsMost : fetchCallsMost(jobCallLimitsOf(callLimits), options.callLimits);
|
|
279
527
|
const base = {
|
|
280
528
|
store: calls,
|
|
281
529
|
bucket
|
|
@@ -286,12 +534,12 @@ const packs = (options = {}) => {
|
|
|
286
534
|
const indexLimits = {
|
|
287
535
|
graphMost,
|
|
288
536
|
memory: budget.total,
|
|
289
|
-
calls:
|
|
537
|
+
calls: stepMost
|
|
290
538
|
};
|
|
291
539
|
const readerOf = (listed, memory, listedOnly, visible, handles = {
|
|
292
540
|
store: calls,
|
|
293
541
|
bucket
|
|
294
|
-
}) => {
|
|
542
|
+
}, blocks, observe, rowCache) => {
|
|
295
543
|
const input = {
|
|
296
544
|
...handles,
|
|
297
545
|
indexes,
|
|
@@ -299,7 +547,10 @@ const packs = (options = {}) => {
|
|
|
299
547
|
memory
|
|
300
548
|
};
|
|
301
549
|
if (listedOnly !== void 0) input.listedOnly = listedOnly;
|
|
550
|
+
if (blocks !== void 0) input.blocks = blocks;
|
|
302
551
|
if (visible !== void 0) input.visible = visible;
|
|
552
|
+
if (observe !== void 0) input.observe = observe;
|
|
553
|
+
if (rowCache !== void 0) input.rowCache = rowCache;
|
|
303
554
|
return packReader(input);
|
|
304
555
|
};
|
|
305
556
|
/**
|
|
@@ -314,11 +565,26 @@ const packs = (options = {}) => {
|
|
|
314
565
|
const listedOnly = input?.listedOnly;
|
|
315
566
|
const context = yield* Effect.context();
|
|
316
567
|
const count = yield* callScope;
|
|
317
|
-
const
|
|
568
|
+
const rowCache = listedOnly === true ? void 0 : yield* fetchRowCacheOf(listed, () => rowCacheRoomOf(budget, fetchRowCacheBytes));
|
|
569
|
+
const allotted = "push" in on ? on.push.take(listedOnly === true, handles?.bucket ?? bucket) : void 0;
|
|
318
570
|
if (allotted !== void 0) {
|
|
319
|
-
const reader = readerOf(listed, readerMemoryOf(allotted.allotment, {
|
|
571
|
+
const reader = readerOf(listed, readerMemoryOf(allotted.allotment, {
|
|
572
|
+
floors: {
|
|
573
|
+
...allotted.floors,
|
|
574
|
+
blocks: 0
|
|
575
|
+
},
|
|
576
|
+
most: {
|
|
577
|
+
...readerMost,
|
|
578
|
+
blocks: 0
|
|
579
|
+
}
|
|
580
|
+
}), listedOnly, visible, handles, allotted.blocks);
|
|
581
|
+
const bases = listedOnly === true || !("push" in on) ? void 0 : on.push.bases;
|
|
320
582
|
return made(objectReader({
|
|
321
583
|
...reader,
|
|
584
|
+
object: bases === void 0 ? reader.object : (oid, signal) => {
|
|
585
|
+
const kept = bases.get(oid);
|
|
586
|
+
return kept === void 0 ? reader.object(oid, signal) : Effect.map(wholeOfCached(kept), gitObjectOf);
|
|
587
|
+
},
|
|
322
588
|
has: reader.seenHeld,
|
|
323
589
|
allotment: (most, refusal) => allottedWithin(allotted.allotment, most, refusal, context),
|
|
324
590
|
release: () => {
|
|
@@ -327,7 +593,7 @@ const packs = (options = {}) => {
|
|
|
327
593
|
}
|
|
328
594
|
}, count));
|
|
329
595
|
}
|
|
330
|
-
const scope = yield* Scope.make();
|
|
596
|
+
const scope = yield* Scope$1.make();
|
|
331
597
|
const held = "upkeep" in on ? Effect.map(upkeepMemoryOf(on.upkeep), (memory) => ({
|
|
332
598
|
memory,
|
|
333
599
|
allotment: on.upkeep
|
|
@@ -335,15 +601,15 @@ const packs = (options = {}) => {
|
|
|
335
601
|
memory: readerMemoryOf(allotment),
|
|
336
602
|
allotment
|
|
337
603
|
}));
|
|
338
|
-
return yield* Effect.uninterruptibleMask((restore) => Effect.map(restore(Scope.provide(held, scope)).pipe(Effect.onError(() => Scope.close(scope, Exit.void))), ({ memory, allotment }) => {
|
|
339
|
-
const reader = readerOf(listed, memory, listedOnly, visible, handles);
|
|
604
|
+
return yield* Effect.uninterruptibleMask((restore) => Effect.map(restore(Scope$1.provide(held, scope)).pipe(Effect.onError(() => Scope$1.close(scope, Exit.void))), ({ memory, allotment }) => {
|
|
605
|
+
const reader = readerOf(listed, memory, listedOnly, visible, handles, void 0, void 0, rowCache);
|
|
340
606
|
return made(objectReader({
|
|
341
607
|
...reader,
|
|
342
608
|
has: reader.seenHeld,
|
|
343
609
|
allotment: (most, refusal) => allottedWithin(allotment, most, refusal, context),
|
|
344
610
|
release: () => {
|
|
345
611
|
reader.release();
|
|
346
|
-
forkIn(Scope.close(scope, Exit.void), noCall);
|
|
612
|
+
forkIn(Scope$1.close(scope, Exit.void), noCall);
|
|
347
613
|
}
|
|
348
614
|
}, count));
|
|
349
615
|
}));
|
|
@@ -354,12 +620,12 @@ const packs = (options = {}) => {
|
|
|
354
620
|
* `listed`'s objects, read whole through one reader over `handles` in `on`'s memory, closed
|
|
355
621
|
* with the scope.
|
|
356
622
|
*/
|
|
357
|
-
const objectsAt = (listed, on, handles) => Effect.map(Effect.acquireRelease(openReader(listed, on, void 0, void 0, handles), (reader) => Effect.sync(() => reader.close())), (reader) => (oid) =>
|
|
623
|
+
const objectsAt = (listed, on, handles) => Effect.map(Effect.acquireRelease(openReader(listed, on, void 0, void 0, handles), (reader) => Effect.sync(() => reader.close())), (reader) => (oid) => reader.read({ oid }));
|
|
358
624
|
/** What a reach on the index reads through: a want check's, and a visible set's. */
|
|
359
625
|
const reachParts = {
|
|
360
626
|
bucket,
|
|
361
627
|
budget,
|
|
362
|
-
cache: new ReachCache(),
|
|
628
|
+
cache: new ReachCache(instanceRoomOf(budget, reachCacheBytes)),
|
|
363
629
|
objects: (listed) => objectsAt(listed, { read: true }),
|
|
364
630
|
indexes
|
|
365
631
|
};
|
|
@@ -369,7 +635,7 @@ const packs = (options = {}) => {
|
|
|
369
635
|
bucket,
|
|
370
636
|
indexes,
|
|
371
637
|
listed,
|
|
372
|
-
at: clock.
|
|
638
|
+
at: clock.currentTimeMillisUnsafe(),
|
|
373
639
|
prune,
|
|
374
640
|
receive: input,
|
|
375
641
|
memory,
|
|
@@ -396,6 +662,7 @@ const packs = (options = {}) => {
|
|
|
396
662
|
let written;
|
|
397
663
|
const memory = {
|
|
398
664
|
...pushMemoryOf(allotment, input),
|
|
665
|
+
allotment,
|
|
399
666
|
written: (pack, files) => {
|
|
400
667
|
written = {
|
|
401
668
|
listed: pack,
|
|
@@ -403,12 +670,25 @@ const packs = (options = {}) => {
|
|
|
403
670
|
};
|
|
404
671
|
}
|
|
405
672
|
};
|
|
406
|
-
const received = yield*
|
|
673
|
+
const { caught, received, bases } = yield* Effect.uninterruptibleMask((restore) => Effect.suspend(() => {
|
|
674
|
+
const caught = input.objects === 0 ? void 0 : catchPack(input.pack, input);
|
|
675
|
+
const body = caught === void 0 ? input : {
|
|
676
|
+
...input,
|
|
677
|
+
pack: caught.pack
|
|
678
|
+
};
|
|
679
|
+
const receiving = restore(receiveWithin(listed, body, memory, visible));
|
|
680
|
+
return Effect.map(cancelsBody(body.pack, receiving), ({ quarantine, bases }) => ({
|
|
681
|
+
caught,
|
|
682
|
+
received: quarantine,
|
|
683
|
+
bases
|
|
684
|
+
}));
|
|
685
|
+
}));
|
|
407
686
|
if (input.objects === 0) return {
|
|
408
687
|
answer: received,
|
|
409
688
|
seed: void 0
|
|
410
689
|
};
|
|
411
|
-
const
|
|
690
|
+
const block = written === void 0 ? void 0 : caught?.block(written);
|
|
691
|
+
const kept = yield* keepReceived(input, allotment, received, written, answered, block, bases);
|
|
412
692
|
return {
|
|
413
693
|
answer: made(kept.received),
|
|
414
694
|
seed: kept.seed
|
|
@@ -418,18 +698,22 @@ const packs = (options = {}) => {
|
|
|
418
698
|
* What a received pack keeps past its receive's scope, owned by `answered`: the rules' share
|
|
419
699
|
* of its allotment and its LFS pointers, then the seed's charge for the files it wrote.
|
|
420
700
|
*/
|
|
421
|
-
const keepReceived = Effect.fnUntraced(function* (input, allotment, received, written, answered) {
|
|
422
|
-
const keep = (bytes) => Scope.provide(Effect.acquireRelease(Effect.sync(() => allotment.keep(bytes, treesBusy)), (each, exit) => Exit.isSuccess(exit) || each.released ? Effect.void : Effect.sync(() =>
|
|
423
|
-
|
|
424
|
-
|
|
701
|
+
const keepReceived = Effect.fnUntraced(function* (input, allotment, received, written, answered, caught, bases) {
|
|
702
|
+
const keep = (bytes, onAbort) => Scope$1.provide(Effect.acquireRelease(Effect.sync(() => allotment.keep(bytes, treesBusy)), (each, exit) => Exit.isSuccess(exit) || each.released ? Effect.void : Effect.sync(() => {
|
|
703
|
+
onAbort?.();
|
|
704
|
+
each.release();
|
|
705
|
+
})), answered);
|
|
706
|
+
const kept = yield* keep(pushRulesOf(input) + received.lfsPointers.bytes + (bases?.chargedBytes ?? 0), () => bases?.clear());
|
|
707
|
+
const context = Context.omit(Scope$1.Scope)(yield* Effect.context());
|
|
425
708
|
const seed = written === void 0 ? void 0 : {
|
|
426
709
|
...written,
|
|
427
710
|
charge: yield* keep(seedBytes(written.files))
|
|
428
711
|
};
|
|
712
|
+
const pushAllotment = new PacksAllotment(kept, input, context, caught, bases);
|
|
429
713
|
return {
|
|
430
714
|
received: {
|
|
431
715
|
...received,
|
|
432
|
-
allotment:
|
|
716
|
+
allotment: pushAllotment
|
|
433
717
|
},
|
|
434
718
|
seed
|
|
435
719
|
};
|
|
@@ -448,7 +732,7 @@ const packs = (options = {}) => {
|
|
|
448
732
|
bucket,
|
|
449
733
|
indexes,
|
|
450
734
|
repo: listed.repo,
|
|
451
|
-
at: clock.
|
|
735
|
+
at: clock.currentTimeMillisUnsafe(),
|
|
452
736
|
prune,
|
|
453
737
|
pack: input.pack,
|
|
454
738
|
...length !== void 0 && { length },
|
|
@@ -461,6 +745,48 @@ const packs = (options = {}) => {
|
|
|
461
745
|
}
|
|
462
746
|
});
|
|
463
747
|
});
|
|
748
|
+
/** Stepped multipart staging for push uploads (#1931), internal to `packs()`. */
|
|
749
|
+
const stageStep = {
|
|
750
|
+
open: Effect.fnUntraced(function* (listed) {
|
|
751
|
+
const { quarantine: prune } = optionsFor(chosen ? yield* statsOf(calls, listed.repo) : void 0);
|
|
752
|
+
return yield* openStageReceive({
|
|
753
|
+
store: calls,
|
|
754
|
+
bucket,
|
|
755
|
+
indexes,
|
|
756
|
+
repo: listed.repo,
|
|
757
|
+
at: clock.currentTimeMillisUnsafe(),
|
|
758
|
+
prune
|
|
759
|
+
});
|
|
760
|
+
}),
|
|
761
|
+
slice: Effect.fnUntraced(function* (listed, input) {
|
|
762
|
+
const { shallow = [] } = input;
|
|
763
|
+
return yield* stageReceiveStep({
|
|
764
|
+
store: calls,
|
|
765
|
+
bucket,
|
|
766
|
+
sourceBucket: input.sourceBucket,
|
|
767
|
+
indexes,
|
|
768
|
+
repo: listed.repo,
|
|
769
|
+
sourceKey: input.sourceKey,
|
|
770
|
+
bytes: input.bytes,
|
|
771
|
+
staging: input.staging,
|
|
772
|
+
sliceBytes: input.sliceBytes,
|
|
773
|
+
partBytes: input.partBytes,
|
|
774
|
+
answer: {
|
|
775
|
+
boundary: [],
|
|
776
|
+
needs: [],
|
|
777
|
+
...shallow.length > 0 && { shallow: [...shallow] }
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
}),
|
|
781
|
+
abort: (pack, token) => bucketDo(bucket.abortPut(packFiles(pack).pack, token)).pipe(Effect.catchIf((error) => error.code === "NOT_FOUND", () => Effect.void)),
|
|
782
|
+
drop: (repo, pack) => dropRefused({
|
|
783
|
+
store: calls,
|
|
784
|
+
bucket,
|
|
785
|
+
indexes,
|
|
786
|
+
repo,
|
|
787
|
+
pack
|
|
788
|
+
})
|
|
789
|
+
};
|
|
464
790
|
/**
|
|
465
791
|
* One step of a staged receive, admitted as `receive` admits a push of its objects and needs:
|
|
466
792
|
* paused, with the step its next try runs, or its pack received, kept and seeded as
|
|
@@ -495,7 +821,7 @@ const packs = (options = {}) => {
|
|
|
495
821
|
bucket,
|
|
496
822
|
indexes,
|
|
497
823
|
listed,
|
|
498
|
-
at: clock.
|
|
824
|
+
at: clock.currentTimeMillisUnsafe(),
|
|
499
825
|
prune,
|
|
500
826
|
receive: {
|
|
501
827
|
pack: new Blob([]).stream(),
|
|
@@ -539,16 +865,34 @@ const packs = (options = {}) => {
|
|
|
539
865
|
const seeded = (run) => Effect.scoped(Effect.flatMap(Effect.scope, (answered) => Effect.flatMap(Effect.scoped(run(answered)), (done) => done.seed === void 0 ? Effect.succeed(done.answer) : Effect.as(indexes.seed(done.seed), done.answer))));
|
|
540
866
|
const receiveWithin = Effect.fnUntraced(function* (listed, input, memory, visible) {
|
|
541
867
|
const { unpack, quarantine } = optionsFor(chosen ? yield* statsOf(calls, listed.repo) : void 0);
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
868
|
+
const cache = createReceiveCache(allotmentCacheCharge(memory.allotment));
|
|
869
|
+
const makeReader = (readerMemory) => readerOf(listed, readerMemory, void 0, visible, void 0, void 0, cache.observe);
|
|
870
|
+
const dropPushPreload = Effect.flatMap(RequestSnapshot, (snapshot) => Effect.sync(() => snapshot?.dropPush?.(repoScope(listed.repo))));
|
|
871
|
+
if (input.objects === 0) {
|
|
872
|
+
yield* dropPushPreload;
|
|
873
|
+
return {
|
|
874
|
+
quarantine: (yield* receiveRows(calls, listed.repo, makeReader, unpack, input, memory, cache).pipe(Effect.ensuring(Effect.sync(() => cache.release())))).quarantine,
|
|
875
|
+
bases: void 0
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
if (unpack === false || input.objects > unpack.maxObjects) {
|
|
879
|
+
yield* dropPushPreload;
|
|
880
|
+
return {
|
|
881
|
+
quarantine: yield* asPack(listed, input, quarantine, memory, visible),
|
|
882
|
+
bases: void 0
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
const read = yield* readPast(input.pack, unpack.maxBytes, memory.allotment, pushPartBytes(input));
|
|
546
886
|
if (!read.ended) {
|
|
887
|
+
yield* dropPushPreload;
|
|
547
888
|
const whole = {
|
|
548
889
|
...input,
|
|
549
|
-
pack: rejoined(read.chunks, read.reader)
|
|
890
|
+
pack: rejoined(read.chunks, read.reader, read.shrink)
|
|
891
|
+
};
|
|
892
|
+
return {
|
|
893
|
+
quarantine: yield* cancelsBody(whole.pack, asPack(listed, whole, quarantine, memory, visible)).pipe(Effect.ensuring(Effect.sync(read.release))),
|
|
894
|
+
bases: void 0
|
|
550
895
|
};
|
|
551
|
-
return yield* cancelsBody(whole.pack, asPack(listed, whole, quarantine, memory, visible));
|
|
552
896
|
}
|
|
553
897
|
const whole = {
|
|
554
898
|
...input,
|
|
@@ -558,8 +902,37 @@ const packs = (options = {}) => {
|
|
|
558
902
|
...input,
|
|
559
903
|
pack: rejoined(read.chunks)
|
|
560
904
|
};
|
|
561
|
-
const rows = receiveRows(
|
|
562
|
-
|
|
905
|
+
const rows = Effect.flatMap(receiveRows(calls, listed.repo, makeReader, unpack, whole, memory, cache).pipe(Effect.ensuring(dropPushPreload), Effect.map((done) => ({
|
|
906
|
+
kind: "rows",
|
|
907
|
+
done
|
|
908
|
+
})), Effect.catchIf(canFallbackFromRows, (rowsError) => Effect.gen(function* () {
|
|
909
|
+
cache.release();
|
|
910
|
+
yield* dropPushPreload;
|
|
911
|
+
return {
|
|
912
|
+
kind: "pack",
|
|
913
|
+
quarantine: yield* asPack(listed, again, quarantine, memory, visible).pipe(Effect.mapError((packError) => rowsFallbackError(rowsError, packError)))
|
|
914
|
+
};
|
|
915
|
+
}))), Effect.fnUntraced(function* (outcome) {
|
|
916
|
+
if (outcome.kind === "pack") return {
|
|
917
|
+
quarantine: outcome.quarantine,
|
|
918
|
+
bases: void 0
|
|
919
|
+
};
|
|
920
|
+
const { quarantine: received, batch } = outcome.done;
|
|
921
|
+
if (received.lfsPointers.count > 0) yield* memory.pointers.carrying(received.lfsPointers.count).pipe(Effect.onError(() => batch === void 0 ? Effect.void : abandonBatch(calls, listed.repo, batch)));
|
|
922
|
+
cache.dropLocations();
|
|
923
|
+
if (cache.bodies.size === 0) {
|
|
924
|
+
cache.release();
|
|
925
|
+
return {
|
|
926
|
+
quarantine: received,
|
|
927
|
+
bases: void 0
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
return {
|
|
931
|
+
quarantine: received,
|
|
932
|
+
bases: cache
|
|
933
|
+
};
|
|
934
|
+
})).pipe(Effect.onExit((exit) => Exit.isFailure(exit) ? Effect.sync(() => cache.release()) : Effect.void));
|
|
935
|
+
return yield* cancelsBody(whole.pack, rows).pipe(Effect.ensuring(Effect.sync(read.release)));
|
|
563
936
|
});
|
|
564
937
|
/**
|
|
565
938
|
* The stored packs streamed whole, for a fetch the core proved may have them, over the whole
|
|
@@ -573,12 +946,13 @@ const packs = (options = {}) => {
|
|
|
573
946
|
const streamed = Effect.fnUntraced(function* (listed, input, started, counted) {
|
|
574
947
|
const { limits } = input;
|
|
575
948
|
const { store, bucket } = counted.handles;
|
|
576
|
-
const scope = yield* Scope.make();
|
|
577
|
-
const ended = Scope.close(scope, Exit.void);
|
|
949
|
+
const scope = yield* Scope$1.make();
|
|
950
|
+
const ended = Scope$1.close(scope, Exit.void);
|
|
578
951
|
return yield* Effect.gen(function* () {
|
|
579
|
-
const allotment = yield* Scope.provide(budget.allot(fetchFloorBytes, fetchBusy), scope);
|
|
580
|
-
const charge = (bytes) => allotment.grow(bytes, fetchTooLarge);
|
|
581
|
-
const
|
|
952
|
+
const allotment = yield* Scope$1.provide(budget.allot(fetchFloorBytes, fetchBusy), scope);
|
|
953
|
+
const charge = (bytes, adopted) => allotment.grow(bytes, fetchTooLarge, adopted);
|
|
954
|
+
const release = (bytes) => Effect.sync(() => allotment.shrink(bytes));
|
|
955
|
+
const plan = yield* wholePlan(store, bucket, indexes, listed, input, counted.calls, charge, release).pipe(Effect.timeoutOrElse({
|
|
582
956
|
duration: Math.max(0, yield* timeLeft(limits, started)),
|
|
583
957
|
orElse: () => Effect.fail(planTooSlow(limits))
|
|
584
958
|
}));
|
|
@@ -602,11 +976,28 @@ const packs = (options = {}) => {
|
|
|
602
976
|
const fetch = Effect.fnUntraced(function* (listed, input, whole, counted) {
|
|
603
977
|
const refused = pastLimits(input.limits, fetchLimits);
|
|
604
978
|
if (refused !== void 0) return yield* Effect.fail(refused);
|
|
605
|
-
const started = yield* Clock
|
|
979
|
+
const started = yield* Clock.currentTimeMillis;
|
|
606
980
|
const sent = whole && input.whole === true ? yield* streamed(listed, input, started, counted) : void 0;
|
|
607
981
|
if (sent !== void 0) return sent;
|
|
608
982
|
const { store, bucket: read } = counted.handles;
|
|
609
|
-
|
|
983
|
+
const depth = shallow === false ? void 0 : shallow.depth;
|
|
984
|
+
const { answer, want } = yield* readyLookup(store, read, listed, input, started, depth, counted.calls);
|
|
985
|
+
if (answer !== void 0) return answer;
|
|
986
|
+
if (want === void 0) return yield* planned(listed, input, started, counted);
|
|
987
|
+
const allowance = Math.min(readyAskMs, (yield* timeLeft(input.limits, started)) - readyAskRoomMs);
|
|
988
|
+
if (allowance <= 0) return yield* planned(listed, input, started, counted);
|
|
989
|
+
const asked = store.add({
|
|
990
|
+
scope: repoScope(listed.repo),
|
|
991
|
+
addition: {
|
|
992
|
+
put: [wantedRow(want)],
|
|
993
|
+
jobs: [repackJobRow(started)]
|
|
994
|
+
}
|
|
995
|
+
}).pipe(Effect.timeoutOrElse({
|
|
996
|
+
duration: allowance,
|
|
997
|
+
orElse: () => Effect.logWarning(`A shallow clone's ask for repo ${listed.repo}'s ready pack took past ${allowance} ms, so a later clone asks again`)
|
|
998
|
+
}));
|
|
999
|
+
yield* bestEffort(asked, (error) => error.code === "ALREADY_EXISTS" ? Effect.void : Effect.logWarning(`A shallow clone's ask for repo ${listed.repo}'s ready pack wasn't saved, so a later clone asks again: ${error.message}`));
|
|
1000
|
+
return yield* planned(listed, input, started, counted);
|
|
610
1001
|
});
|
|
611
1002
|
/**
|
|
612
1003
|
* A walk past what one fetch may be allotted: `awaitingIndex` while the repo's `git.index`
|
|
@@ -619,9 +1010,9 @@ const packs = (options = {}) => {
|
|
|
619
1010
|
* to 30 before the next, are final too: no push saves `git.index` before `retryAt`, so "a few
|
|
620
1011
|
* minutes" would be false. Once the wait has passed, `retry`, the next push saves a try.
|
|
621
1012
|
*/
|
|
622
|
-
const pastWalk = Effect.fnUntraced(function* (store, listed, request, extras, index) {
|
|
1013
|
+
const pastWalk = Effect.fnUntraced(function* (store, listed, request, extras, index, knownIndexRow) {
|
|
623
1014
|
if (!indexEligible(request)) return yield* Effect.fail(fetchTooLarge);
|
|
624
|
-
const pending = yield* indexPending(store, listed);
|
|
1015
|
+
const pending = yield* indexPending(store, listed, knownIndexRow);
|
|
625
1016
|
const covered = index.opened && !extras.met;
|
|
626
1017
|
return yield* Effect.fail(!pending || covered ? fetchTooLarge : awaitingIndex);
|
|
627
1018
|
});
|
|
@@ -629,20 +1020,21 @@ const packs = (options = {}) => {
|
|
|
629
1020
|
* A walk refused at its call bound before the repo's first index: `awaitingIndex` while
|
|
630
1021
|
* `git.index` will build an index that answers `request`, since the index path's calls grow
|
|
631
1022
|
* by its packs where the walk's grow by its bytes; `refused` as it was once the fetch opened
|
|
632
|
-
* an index, or when none will build (#647).
|
|
1023
|
+
* an index, or when none will build (#647). When `knownIndexRow` was already read by `opened`
|
|
1024
|
+
* at `listed.version` (#2899), no extra store call is needed or held back.
|
|
633
1025
|
*/
|
|
634
|
-
const pastCalls = Effect.fnUntraced(function* (store, listed, request, index, refused) {
|
|
1026
|
+
const pastCalls = Effect.fnUntraced(function* (store, listed, request, index, refused, knownIndexRow) {
|
|
635
1027
|
if (index.opened || !indexEligible(request)) return yield* Effect.fail(refused);
|
|
636
|
-
return yield* Effect.fail((yield* indexPending(store, listed)) ? awaitingIndex : refused);
|
|
1028
|
+
return yield* Effect.fail((yield* indexPending(store, listed, knownIndexRow)) ? awaitingIndex : refused);
|
|
637
1029
|
});
|
|
638
1030
|
/** Whether the repo's `git.index` will build or update an index for `listed`, by its row. */
|
|
639
|
-
const indexPending = Effect.fnUntraced(function* (store, listed) {
|
|
640
|
-
const
|
|
1031
|
+
const indexPending = Effect.fnUntraced(function* (store, listed, known) {
|
|
1032
|
+
const raw = known !== void 0 ? known.row : (yield* store.read({
|
|
641
1033
|
scope: repoScope(listed.repo),
|
|
642
1034
|
reads: [indexRowKey]
|
|
643
|
-
});
|
|
644
|
-
const row = indexRowOf(
|
|
645
|
-
const at = yield* Clock
|
|
1035
|
+
})).results[0]?.[0];
|
|
1036
|
+
const row = indexRowOf(raw);
|
|
1037
|
+
const at = yield* Clock.currentTimeMillis;
|
|
646
1038
|
return indexSaves(indexStatus(row, indexLimits, at, listedIds(listed)));
|
|
647
1039
|
});
|
|
648
1040
|
/**
|
|
@@ -650,48 +1042,53 @@ const packs = (options = {}) => {
|
|
|
650
1042
|
* pack's stream outlives the call.
|
|
651
1043
|
*/
|
|
652
1044
|
const planned = Effect.fnUntraced(function* (listed, input, started, counted) {
|
|
653
|
-
const scope = yield* Scope.make();
|
|
654
|
-
const ended = Scope.close(scope, Exit.void);
|
|
1045
|
+
const scope = yield* Scope$1.make();
|
|
1046
|
+
const ended = Scope$1.close(scope, Exit.void);
|
|
655
1047
|
return yield* Effect.gen(function* () {
|
|
656
|
-
const allotment = yield* Scope.provide(budget.allot(fetchFloorBytes, fetchBusy), scope);
|
|
1048
|
+
const allotment = yield* Scope$1.provide(budget.allot(fetchFloorBytes, fetchBusy), scope);
|
|
657
1049
|
const memory = readerMemoryOf(allotment, { tooLarge: () => fetchTooLarge });
|
|
658
|
-
const
|
|
1050
|
+
const rowCache = yield* adoptFetchRowCache(listed, rowCacheRoomOf(allotment, fetchRowCacheBytes));
|
|
1051
|
+
const reader = readerOf(listed, memory, void 0, void 0, counted.handles, void 0, void 0, rowCache);
|
|
659
1052
|
const charge = (bytes) => allotment.grow(bytes, fetchTooLarge);
|
|
660
1053
|
const { store, bucket: read } = counted.handles;
|
|
661
1054
|
const extras = counted.calls?.extras ?? { met: false };
|
|
662
1055
|
const opened = { opened: false };
|
|
1056
|
+
const indexRow = yield* fetchIndexRowOf(listed);
|
|
663
1057
|
const index = {
|
|
664
1058
|
store,
|
|
665
1059
|
bucket: read,
|
|
666
1060
|
listed,
|
|
667
1061
|
extras,
|
|
668
|
-
opened
|
|
1062
|
+
opened,
|
|
1063
|
+
indexes,
|
|
1064
|
+
...inner.wholeIndexMost !== void 0 && { wholeMost: inner.wholeIndexMost },
|
|
1065
|
+
...indexRow !== void 0 && { indexRow }
|
|
669
1066
|
};
|
|
670
1067
|
const release = (bytes) => Effect.sync(() => allotment.shrink(bytes));
|
|
671
1068
|
const held = {
|
|
672
1069
|
started,
|
|
673
1070
|
ended,
|
|
674
1071
|
charge,
|
|
675
|
-
index,
|
|
1072
|
+
index: indexPath(index),
|
|
676
1073
|
release
|
|
677
1074
|
};
|
|
678
1075
|
if (counted.calls !== void 0) held.calls = counted.calls;
|
|
679
|
-
const givenBack = indexEligible(input.request) ? yield* heldCall("store") : Effect.void;
|
|
1076
|
+
const givenBack = indexEligible(input.request) && indexRow === void 0 ? yield* heldCall("store") : Effect.void;
|
|
680
1077
|
const walk = { over: false };
|
|
681
1078
|
held.walked = givenBack;
|
|
682
1079
|
held.planned = Effect.sync(() => {
|
|
683
1080
|
walk.over = true;
|
|
684
1081
|
});
|
|
685
1082
|
const clone = input.request.haves.length === 0;
|
|
686
|
-
const fetched = Scope.provide(fetchPack(reader, input, fetchLimits, held), scope);
|
|
687
|
-
return yield* refusedWhenSpent(fetched, counted.calls, clone).pipe(Effect.ensuring(givenBack), Effect.catchIf((error) => error === fetchTooLarge, () => pastWalk(store, listed, input.request, extras, opened)), Effect.catchIf((error) => !walk.over && error.context?.["reason"] === "too-many-store-calls", (refused) => pastCalls(store, listed, input.request, opened, refused)));
|
|
1083
|
+
const fetched = Scope$1.provide(fetchPack(reader, input, fetchLimits, held), scope).pipe(Effect.ensuring(Effect.sync(() => rowCache.clear())));
|
|
1084
|
+
return yield* refusedWhenSpent(fetched, counted.calls, clone).pipe(Effect.ensuring(givenBack), Effect.catchIf((error) => error === fetchTooLarge, () => pastWalk(store, listed, input.request, extras, opened, indexRow)), Effect.catchIf((error) => !walk.over && error.context?.["reason"] === "too-many-store-calls", (refused) => pastCalls(store, listed, input.request, opened, refused, indexRow)));
|
|
688
1085
|
}).pipe(Effect.onError(() => ended));
|
|
689
1086
|
});
|
|
690
1087
|
/**
|
|
691
1088
|
* Clean-up's step first; once it has nothing to do, a geometric merge's, which answers
|
|
692
1089
|
* `more`; once there's none, the ready shallow pack's.
|
|
693
1090
|
*/
|
|
694
|
-
const maintain = (listed, input) =>
|
|
1091
|
+
const maintain = (listed, input) => stepMost === void 0 ? upkeepOf(listed, input, void 0) : Effect.flatMap(stepBudget(stepMost, "upkeep"), (own) => Effect.provideService(upkeepOf(listed, input, own), CallBudget, own));
|
|
695
1092
|
/** `maintain`'s step, its calls counted into `own`, the step's budget, when bounded. */
|
|
696
1093
|
const upkeepOf = Effect.fnUntraced(function* (listed, input, own) {
|
|
697
1094
|
const { at, deleted } = input;
|
|
@@ -714,7 +1111,9 @@ const packs = (options = {}) => {
|
|
|
714
1111
|
...cleaned,
|
|
715
1112
|
more: true
|
|
716
1113
|
};
|
|
717
|
-
|
|
1114
|
+
const batches = yield* maintainBatches(input.store, listed, at);
|
|
1115
|
+
if (batches.step !== void 0) return batches.step;
|
|
1116
|
+
return yield* Effect.flatMap(budget.upkeep(), (allotment) => upkeepSteps(listed, input, allotment, own, raw, cleaned)).pipe(Effect.map((step) => withBatchesDue(step, batches.due)), Effect.catchIf((error) => error === readBusy, () => Effect.succeed({
|
|
718
1117
|
change: { rows: noRows },
|
|
719
1118
|
more: false,
|
|
720
1119
|
due: at + growWaitMs
|
|
@@ -764,6 +1163,22 @@ const packs = (options = {}) => {
|
|
|
764
1163
|
...step,
|
|
765
1164
|
repack: at
|
|
766
1165
|
};
|
|
1166
|
+
const holds = indexHolds(indexRowOf({
|
|
1167
|
+
...indexRowKey,
|
|
1168
|
+
value: input.index
|
|
1169
|
+
}), listed, {
|
|
1170
|
+
count: objectRows.rows.length,
|
|
1171
|
+
whole: objectRows.whole
|
|
1172
|
+
});
|
|
1173
|
+
const geometricRemap = (options) => ({
|
|
1174
|
+
row: input.index,
|
|
1175
|
+
budget,
|
|
1176
|
+
cpuMost: options === false ? defaultRemapCpuMost : options.remapCpuMost ?? 3e4,
|
|
1177
|
+
grace: fetchLimits.milliseconds,
|
|
1178
|
+
lease: input.lease,
|
|
1179
|
+
calls: counted,
|
|
1180
|
+
holds
|
|
1181
|
+
});
|
|
767
1182
|
const step = yield* Effect.gen(function* () {
|
|
768
1183
|
if (orphan !== void 0) return ending(droppedStep(orphan));
|
|
769
1184
|
if (input.deleted !== void 0 && read.started !== void 0) return (yield* passScratch(upkeep, read.started.at)) === "more" ? {
|
|
@@ -776,15 +1191,31 @@ const packs = (options = {}) => {
|
|
|
776
1191
|
},
|
|
777
1192
|
more: true
|
|
778
1193
|
};
|
|
779
|
-
if (merging !== void 0 && input.steps !== "prune") return yield* resumeMerge(upkeep, merging,
|
|
780
|
-
|
|
781
|
-
|
|
1194
|
+
if (merging !== void 0 && input.steps !== "prune") return yield* resumeMerge(upkeep, merging, {
|
|
1195
|
+
most: chosen === false ? defaultRepack.maxPackSize : chosen.maxPackSize ?? defaultRepack.maxPackSize,
|
|
1196
|
+
calls: counted === void 0 ? void 0 : {
|
|
1197
|
+
made: counted.made,
|
|
1198
|
+
most: counted.most
|
|
1199
|
+
},
|
|
1200
|
+
remap: geometricRemap(chosen)
|
|
782
1201
|
});
|
|
783
1202
|
const pruned = prune === false || input.steps === "others" ? void 0 : yield* pruneStep(upkeep, prune, chosen, read, objectRows, input.drops !== false, input.pruneHeld, input.retried === true, counted === void 0 ? void 0 : {
|
|
784
1203
|
made: counted.made,
|
|
785
1204
|
most: counted.most
|
|
1205
|
+
}, {
|
|
1206
|
+
row: input.index,
|
|
1207
|
+
budget,
|
|
1208
|
+
cpuMost: repack === false ? defaultRemapCpuMost : repack.remapCpuMost ?? 3e4,
|
|
1209
|
+
grace: fetchLimits.milliseconds,
|
|
1210
|
+
lease: input.lease,
|
|
1211
|
+
calls: counted,
|
|
1212
|
+
holdsUncovered: true
|
|
786
1213
|
}).pipe(Effect.catchIf(parksPass, parking));
|
|
787
1214
|
const stepped = pruned === void 0 || pruned.step !== void 0 || parked === void 0 ? pruned?.step : droppedStep(parked);
|
|
1215
|
+
if (stepped !== void 0 && input.steps === "prune" && pruned !== void 0 && "alone" in pruned && pruned.next !== void 0) return {
|
|
1216
|
+
...stepped,
|
|
1217
|
+
due: pruned.next
|
|
1218
|
+
};
|
|
788
1219
|
if (stepped !== void 0) return {
|
|
789
1220
|
...ending(stepped),
|
|
790
1221
|
more: true
|
|
@@ -803,31 +1234,18 @@ const packs = (options = {}) => {
|
|
|
803
1234
|
const cruft = mergesAlone(read);
|
|
804
1235
|
const alone = (pack) => cruft(pack) || held.has(pack.id);
|
|
805
1236
|
const kept = (pack) => alone(pack) || read.refused.has(pack.id);
|
|
806
|
-
const holds = indexHolds(indexRowOf({
|
|
807
|
-
...indexRowKey,
|
|
808
|
-
value: input.index
|
|
809
|
-
}), listed, {
|
|
810
|
-
count: objectRows.rows.length,
|
|
811
|
-
whole: objectRows.whole
|
|
812
|
-
});
|
|
813
1237
|
const members = membersOf(upkeep, objectRows.rows, kept, holds);
|
|
814
|
-
const opens = opensWithin(upkeep.bucket.multipart,
|
|
1238
|
+
const opens = opensWithin(upkeep.bucket.multipart, stepMost);
|
|
815
1239
|
const grouped = repack === false ? void 0 : groupedPacks(members, repack, opens);
|
|
816
1240
|
const heldUntil = burst?.quietAt === void 0 || chosen === false || grouped === void 0 || groupedPacks(members, chosen, opens).size <= grouped.size ? void 0 : burst.quietAt;
|
|
817
1241
|
const plan = grouped === void 0 ? void 0 : yield* containedPlan(upkeep, alone, grouped);
|
|
818
1242
|
const walksFirst = plan !== void 0 && plan.merges >= 4;
|
|
819
1243
|
const owed = walksFirst ? yield* containedWalk(upkeep, plan) : void 0;
|
|
820
1244
|
if (owed !== void 0) return owed;
|
|
821
|
-
const merged = repack === false ? void 0 : yield* geometricStep(upkeep, repack, objectRows.rows, kept,
|
|
822
|
-
row: input.index,
|
|
823
|
-
budget,
|
|
824
|
-
cpuMost: repack.remapCpuMost ?? 3e4,
|
|
825
|
-
grace: fetchLimits.milliseconds,
|
|
826
|
-
lease: input.lease,
|
|
827
|
-
calls: counted,
|
|
828
|
-
holds
|
|
829
|
-
});
|
|
1245
|
+
const merged = repack === false ? void 0 : yield* geometricStep(upkeep, repack, objectRows.rows, kept, geometricRemap(repack));
|
|
830
1246
|
if (merged !== void 0) return plan === void 0 ? merged : countedMerge(plan, merged);
|
|
1247
|
+
const folded = repack === false || objectRows.rows.length === 0 || !(yield* rowsPastInflated(upkeep, objectRows, 16777216, input.stats)) ? void 0 : yield* foldStep(upkeep, objectRows.rows, repack.maxPackSize ?? defaultRepack.maxPackSize);
|
|
1248
|
+
if (folded !== void 0) return folded;
|
|
831
1249
|
const dropped = plan === void 0 || walksFirst ? void 0 : yield* containedWalk(upkeep, plan);
|
|
832
1250
|
if (dropped !== void 0) return dropped;
|
|
833
1251
|
const step = {
|
|
@@ -852,7 +1270,19 @@ const packs = (options = {}) => {
|
|
|
852
1270
|
const last = read.pass?.at;
|
|
853
1271
|
const behind = last === void 0 || last + wait <= at ? { pruneWait: wait } : {};
|
|
854
1272
|
const ended = ready ?? cleaned;
|
|
855
|
-
const
|
|
1273
|
+
const passes = passAt !== void 0 && passAt <= at && ended === void 0 && input.deleted === void 0 && input.pruneHeld.length === 0 && read.started === void 0 && passAlone(read);
|
|
1274
|
+
const named = passAt === void 0 ? ended : passes ? {
|
|
1275
|
+
change: {
|
|
1276
|
+
put: [{
|
|
1277
|
+
...prunePassKey,
|
|
1278
|
+
value: { at }
|
|
1279
|
+
}],
|
|
1280
|
+
rows: noRows
|
|
1281
|
+
},
|
|
1282
|
+
more: false,
|
|
1283
|
+
prune: at + wait,
|
|
1284
|
+
...behind
|
|
1285
|
+
} : {
|
|
856
1286
|
change: { rows: noRows },
|
|
857
1287
|
more: false,
|
|
858
1288
|
...ended,
|
|
@@ -938,7 +1368,7 @@ const packs = (options = {}) => {
|
|
|
938
1368
|
}, listed, input).pipe(Effect.tap((answer) => answer.kind === "moved" && own !== void 0 ? countInto(own, "store", 1) : Effect.void));
|
|
939
1369
|
return own === void 0 ? step : Effect.provideService(step, CallBudget, own);
|
|
940
1370
|
};
|
|
941
|
-
return
|
|
1371
|
+
return stepMost === void 0 ? counted(void 0) : Effect.flatMap(indexBudget(input, stepMost), counted);
|
|
942
1372
|
},
|
|
943
1373
|
reach: (listed, input) => {
|
|
944
1374
|
const built = indexReach(reachParts, listed, input);
|
|
@@ -950,35 +1380,36 @@ const packs = (options = {}) => {
|
|
|
950
1380
|
const face = faceOf(visible, setReach);
|
|
951
1381
|
const { copyRows } = face;
|
|
952
1382
|
return {
|
|
953
|
-
reader:
|
|
954
|
-
pushedCommits:
|
|
955
|
-
receive:
|
|
956
|
-
stage:
|
|
957
|
-
receiveStep:
|
|
958
|
-
fetch:
|
|
959
|
-
maintain:
|
|
960
|
-
share:
|
|
961
|
-
holdings:
|
|
962
|
-
...copyRows && { copyRows
|
|
1383
|
+
reader: face.reader,
|
|
1384
|
+
pushedCommits: face.pushedCommits,
|
|
1385
|
+
receive: face.receive,
|
|
1386
|
+
stage: face.stage,
|
|
1387
|
+
receiveStep: face.receiveStep,
|
|
1388
|
+
fetch: face.fetch,
|
|
1389
|
+
maintain: face.maintain,
|
|
1390
|
+
share: face.share,
|
|
1391
|
+
holdings: face.holdings,
|
|
1392
|
+
...copyRows && { copyRows },
|
|
963
1393
|
index: {
|
|
964
|
-
step: (listed, input) =>
|
|
1394
|
+
step: (listed, input) => inCallScope(face.index.step(listed, input), readScope(noScope, input)),
|
|
965
1395
|
status: (row, at, packs) => indexStatus(indexRowOf(row), indexLimits, at, packs),
|
|
966
|
-
reach:
|
|
1396
|
+
reach: face.index.reach
|
|
967
1397
|
},
|
|
968
1398
|
readyShallow: shallow !== false,
|
|
969
|
-
pushObjectsMost: pushObjectsMostOf(memoryTotal)
|
|
1399
|
+
pushObjectsMost: pushObjectsMostOf(memoryTotal),
|
|
1400
|
+
...visible === void 0 && { [stageStepKey]: stageStep }
|
|
970
1401
|
};
|
|
971
1402
|
};
|
|
972
|
-
const visible = (listed, input, fallback = () => walkedVisible(
|
|
1403
|
+
const visible = (listed, input, fallback = () => walkedVisible(over(), listed, input, { budget: serverRequestBudget(requestBudgetOf(budget)) })) => indexedVisible(reachParts, listed, input, fallback);
|
|
973
1404
|
const seen = (set) => over(visibleOf(set), setReachOf(set));
|
|
974
1405
|
const rootsReached = (listed, input) => reachedRoots(reachParts, listed, input);
|
|
975
|
-
return withBound({
|
|
1406
|
+
return withBound(withMemoryBudget({
|
|
976
1407
|
...over(),
|
|
977
1408
|
visible,
|
|
978
1409
|
seen,
|
|
979
1410
|
rootsReached
|
|
980
|
-
}, callsMost);
|
|
1411
|
+
}, budget), callsMost);
|
|
981
1412
|
}
|
|
982
1413
|
};
|
|
983
1414
|
};
|
|
984
|
-
export { defaultUnpack, fetchCallsMost, linkedPacks, packs, packsMemoryLeast };
|
|
1415
|
+
export { defaultUnpack, fetchCallsMost, linkedPacks, packs, packsMemoryLeast, packsWith };
|