@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/ready.mjs
CHANGED
|
@@ -12,12 +12,12 @@ import { isPackId, objectCollections, packFiles } from "./layout.mjs";
|
|
|
12
12
|
import { noRows } from "./object-rows.mjs";
|
|
13
13
|
import { openQuarantine } from "./quarantine.mjs";
|
|
14
14
|
import { leavingRow, removeAt } from "./rows.mjs";
|
|
15
|
-
import * as Clock$1 from "effect/Clock";
|
|
16
|
-
import * as Effect from "effect/Effect";
|
|
17
15
|
import * as Schema from "effect/Schema";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
18
17
|
import * as Exit from "effect/Exit";
|
|
19
|
-
import * as Hex from "effect/encoding/Hex";
|
|
20
18
|
import * as Deferred from "effect/Deferred";
|
|
19
|
+
import * as Clock from "effect/Clock";
|
|
20
|
+
import * as Hex from "effect/encoding/Hex";
|
|
21
21
|
// src/storage/ready.ts
|
|
22
22
|
/** `git clone --depth 1` of the default branch, within 20,000 objects. */
|
|
23
23
|
const defaultShallow = {
|
|
@@ -34,6 +34,19 @@ const readyBytesMost = 67108864;
|
|
|
34
34
|
* the row stays well under a store's 1 MiB.
|
|
35
35
|
*/
|
|
36
36
|
const readyShallowsMost = 1e4;
|
|
37
|
+
/**
|
|
38
|
+
* The most a shallow clone that missed waits for its ask for the ready pack to save, before its
|
|
39
|
+
* pack is planned: past it the ask is dropped, and a later clone asks again. Well under a stream's
|
|
40
|
+
* 30 s unread bound, though the ask is made before the stream is (#2898).
|
|
41
|
+
*/
|
|
42
|
+
const readyAskMs = 2e3;
|
|
43
|
+
/**
|
|
44
|
+
* What a shallow clone that missed keeps of its fetch's time for its own plan and pack, before it
|
|
45
|
+
* gives any to its ask: with less left, it doesn't ask. Planning and sending a first clone of 825
|
|
46
|
+
* and of 4,951 objects took 61 and 178 ms locally, so 5 s leaves room for a host's slower store
|
|
47
|
+
* (#2898).
|
|
48
|
+
*/
|
|
49
|
+
const readyAskRoomMs = 5e3;
|
|
37
50
|
/** How long a ready pack's build may take to write: a third of `git.repack`'s 15 minutes. */
|
|
38
51
|
const readyMilliseconds = 3e5;
|
|
39
52
|
const PackIdText = /* @__PURE__ */ Schema.String.check(Schema.isPattern(/^p_[A-Za-z0-9_-]{16}$/));
|
|
@@ -65,6 +78,21 @@ const readyRow = (value) => ({
|
|
|
65
78
|
...readyKey,
|
|
66
79
|
value
|
|
67
80
|
});
|
|
81
|
+
/**
|
|
82
|
+
* A shallow clone's ask for a ready pack, in `ready` by `wanted`: the tip it cloned, when it found
|
|
83
|
+
* none for that tip. Added, never put, so the repo holds one until `git.repack`'s ready step takes
|
|
84
|
+
* it: it builds the pack when the ask names the default branch's tip, and drops it otherwise.
|
|
85
|
+
*/
|
|
86
|
+
const ReadyWanted = /* @__PURE__ */ Schema.Struct({ tip: Schema.String });
|
|
87
|
+
const wantedKey = {
|
|
88
|
+
collection: objectCollections.ready,
|
|
89
|
+
id: "wanted"
|
|
90
|
+
};
|
|
91
|
+
/** The row a missed clone of `tip` adds. */
|
|
92
|
+
const wantedRow = (tip) => ({
|
|
93
|
+
...wantedKey,
|
|
94
|
+
value: { tip }
|
|
95
|
+
});
|
|
68
96
|
/** The tags a fetch may follow, as one digest: the sorted IDs, each once, hashed. */
|
|
69
97
|
const tagsDigest = (tags) => {
|
|
70
98
|
const sha = new Sha1();
|
|
@@ -80,6 +108,7 @@ const readyRequest = (tip, depth) => ({
|
|
|
80
108
|
includeTag: true
|
|
81
109
|
});
|
|
82
110
|
const decodeReady = (row) => row === void 0 ? Effect.succeed(void 0) : decodeRow(ReadyRow, row, "The ready shallow pack's row");
|
|
111
|
+
const decodeWanted = (row) => row === void 0 ? Effect.succeed(void 0) : decodeRow(ReadyWanted, row, "The ready shallow pack's ask");
|
|
83
112
|
const readOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, listed) {
|
|
84
113
|
const snapshot = yield* store.read({
|
|
85
114
|
scope: repoScope(listed.repo),
|
|
@@ -88,17 +117,34 @@ const readOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, listed) {
|
|
|
88
117
|
return yield* decodeReady(snapshot.results[0]?.[0]);
|
|
89
118
|
});
|
|
90
119
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
120
|
+
* Whether a clone's ask waits already: read only by a clone that would ask, apart from the ready
|
|
121
|
+
* row, which a request's snapshot answers from memory (#2899), so a clone the ready pack serves
|
|
122
|
+
* reads no more than before.
|
|
123
|
+
*/
|
|
124
|
+
const askWaits = /* @__PURE__ */ Effect.fnUntraced(function* (store, listed) {
|
|
125
|
+
const snapshot = yield* store.read({
|
|
126
|
+
scope: repoScope(listed.repo),
|
|
127
|
+
reads: [wantedKey]
|
|
128
|
+
});
|
|
129
|
+
return (yield* decodeWanted(snapshot.results[0]?.[0])) !== void 0;
|
|
130
|
+
});
|
|
131
|
+
/**
|
|
132
|
+
* The ready row, the repo's roots and the ask for a pack, in one read: a step builds over the
|
|
133
|
+
* roots as they are now, with no fetch to pass them, as `git.index`'s build reads them.
|
|
93
134
|
*/
|
|
94
135
|
const readWithRoots = /* @__PURE__ */ Effect.fnUntraced(function* (store, listed) {
|
|
95
136
|
const snapshot = yield* store.read({
|
|
96
137
|
scope: repoScope(listed.repo),
|
|
97
|
-
reads: [
|
|
138
|
+
reads: [
|
|
139
|
+
readyKey,
|
|
140
|
+
repoRootsKey,
|
|
141
|
+
wantedKey
|
|
142
|
+
]
|
|
98
143
|
});
|
|
99
144
|
return {
|
|
100
145
|
ready: yield* decodeReady(snapshot.results[0]?.[0]),
|
|
101
|
-
roots: yield* rootsOf(snapshot.results[1])
|
|
146
|
+
roots: yield* rootsOf(snapshot.results[1]),
|
|
147
|
+
wanted: yield* decodeWanted(snapshot.results[2]?.[0])
|
|
102
148
|
};
|
|
103
149
|
});
|
|
104
150
|
/** The bytes of the ready pack `rows`, a read of `readyKey`, hold: 0 with none kept. */
|
|
@@ -108,6 +154,11 @@ const readyBytesOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows) {
|
|
|
108
154
|
return (yield* decodeRow(ReadyRow, row, "The ready shallow pack's row")).pack?.bytes ?? 0;
|
|
109
155
|
});
|
|
110
156
|
/**
|
|
157
|
+
* Whether a ready shallow pack can ever answer `request` before reading its row: one want, no
|
|
158
|
+
* haves or client shallows, an explicit shallow depth, no `deepen-relative`, and no filter.
|
|
159
|
+
*/
|
|
160
|
+
const readyEligible = (request) => request.haves.length === 0 && request.shallows.length === 0 && request.depth !== void 0 && request.deepenRelative !== true && request.filter === void 0 && new Set(request.wants).size === 1;
|
|
161
|
+
/**
|
|
111
162
|
* Whether a ready pack answers `input` exactly, as its plan would now: the one want its tip, no
|
|
112
163
|
* haves and no shallow commits, its depth, no `deepen-relative` and no filter, `include-tag`
|
|
113
164
|
* over the same tags, so a tag a rule hides from the caller never reaches them, and the same roots. The objects a tip
|
|
@@ -119,7 +170,7 @@ const answers = (ready, input) => {
|
|
|
119
170
|
if (pack === void 0) return false;
|
|
120
171
|
const tags = request.includeTag ? tagsDigest(input.tags ?? []) === ready.tags : pack.tagged === 0;
|
|
121
172
|
const roots = () => rootsDigest(input.roots ?? []) === ready.roots;
|
|
122
|
-
return
|
|
173
|
+
return readyEligible(request) && request.wants[0] === ready.tip && request.depth === ready.depth && tags && pack.objects <= limits.objects && pack.bytes <= limits.bytes && roots();
|
|
123
174
|
};
|
|
124
175
|
/**
|
|
125
176
|
* `bytes`, ended as a planned pack's stream is: when `signal` aborts, its reader gets the signal's
|
|
@@ -198,7 +249,7 @@ const untilEnded = /* @__PURE__ */ Effect.fnUntraced(function* (bytes, signal, l
|
|
|
198
249
|
}
|
|
199
250
|
signal?.addEventListener("abort", aborted, { once: true });
|
|
200
251
|
const totalWait = Math.max(0, left);
|
|
201
|
-
const startedAt = yield* Clock
|
|
252
|
+
const startedAt = yield* Clock.currentTimeMillis;
|
|
202
253
|
const waitForEnd = (duration) => Deferred.await(over).pipe(Effect.timeoutOrElse({
|
|
203
254
|
duration: Math.max(0, duration),
|
|
204
255
|
orElse: () => Effect.sync(() => stop(timedOut))
|
|
@@ -210,51 +261,60 @@ const untilEnded = /* @__PURE__ */ Effect.fnUntraced(function* (bytes, signal, l
|
|
|
210
261
|
})
|
|
211
262
|
}), Effect.andThen(Effect.suspend(() => {
|
|
212
263
|
if (stopped) return Effect.void;
|
|
213
|
-
return Effect.flatMap(Clock
|
|
264
|
+
return Effect.flatMap(Clock.currentTimeMillis, (now) => waitForEnd(startedAt + totalWait - now));
|
|
214
265
|
}))) : waitForEnd(totalWait);
|
|
215
266
|
yield* Effect.forkDetach(timer);
|
|
216
267
|
return stream;
|
|
217
268
|
});
|
|
218
269
|
/**
|
|
219
|
-
* The ready pack that answers `input` exactly, and its stream from the bucket,
|
|
220
|
-
* one
|
|
270
|
+
* The ready pack that answers `input` exactly, and its stream from the bucket, as `opened`; or,
|
|
271
|
+
* when none does, the tip to ask one for, as `want`: a clone at `depth` of a tip no ready row
|
|
272
|
+
* names, with no ask waiting. Its one get is checked against `calls` before it's made.
|
|
221
273
|
*/
|
|
222
|
-
const readyOpened = /* @__PURE__ */ Effect.fnUntraced(function* (store, bucket, listed, input, calls) {
|
|
274
|
+
const readyOpened = /* @__PURE__ */ Effect.fnUntraced(function* (store, bucket, listed, input, depth, calls) {
|
|
223
275
|
const ready = yield* readOf(store, listed);
|
|
224
|
-
if (ready?.pack === void 0 || !answers(ready, input))
|
|
276
|
+
if (ready?.pack === void 0 || !answers(ready, input)) {
|
|
277
|
+
const [tip] = input.request.wants;
|
|
278
|
+
if (tip === void 0 || input.request.depth !== depth) return {};
|
|
279
|
+
if (ready?.tip === tip && ready.depth === depth && ready.roots === rootsDigest(input.roots ?? [])) return {};
|
|
280
|
+
return (yield* askWaits(store, listed)) ? {} : { want: tip };
|
|
281
|
+
}
|
|
225
282
|
const { id, objects, shallow } = ready.pack;
|
|
226
|
-
if (!isPackId(id)) return
|
|
283
|
+
if (!isPackId(id)) return {};
|
|
227
284
|
yield* callsAhead(calls, {
|
|
228
285
|
bucket: 1,
|
|
229
286
|
store: 0
|
|
230
287
|
}, input.request.haves.length === 0);
|
|
231
|
-
return {
|
|
288
|
+
return { opened: {
|
|
232
289
|
bytes: yield* bucketBody(bucket, packFiles(id).pack),
|
|
233
290
|
objects,
|
|
234
291
|
shallow
|
|
235
|
-
};
|
|
292
|
+
} };
|
|
236
293
|
});
|
|
237
294
|
/**
|
|
238
|
-
* The ready pack's answer to `input`, its bytes streamed from the bucket as they were written,
|
|
239
|
-
* `
|
|
240
|
-
*
|
|
241
|
-
*
|
|
295
|
+
* The ready pack's answer to `input`, its bytes streamed from the bucket as they were written, as
|
|
296
|
+
* `answer`; when it doesn't answer it exactly, and the fetch is planned, none, and with a clone at
|
|
297
|
+
* `depth`, the shallow pack's, the tip to ask one for, as `want`. Its bytes are read only as its
|
|
298
|
+
* reader pulls them, so bytes that are gone fail the stream. The fetch's one deadline, from
|
|
299
|
+
* `started`, holds the look-up and the stream, and the call's signal ends the stream, as each does
|
|
300
|
+
* a planned pack's. `calls` counts what the fetch made before.
|
|
242
301
|
*/
|
|
243
|
-
const
|
|
302
|
+
const readyLookup = /* @__PURE__ */ Effect.fnUntraced(function* (store, bucket, listed, input, started, depth, calls) {
|
|
303
|
+
if (!readyEligible(input.request)) return {};
|
|
244
304
|
const { limits } = input;
|
|
245
|
-
const opened = yield* readyOpened(store, bucket, listed, input, calls).pipe(Effect.timeoutOrElse({
|
|
305
|
+
const { opened, want } = yield* readyOpened(store, bucket, listed, input, depth, calls).pipe(Effect.timeoutOrElse({
|
|
246
306
|
duration: Math.max(0, yield* timeLeft(limits, started)),
|
|
247
307
|
orElse: () => Effect.fail(planTooSlow(limits))
|
|
248
308
|
}));
|
|
249
|
-
if (opened === void 0) return void 0;
|
|
309
|
+
if (opened === void 0) return want === void 0 ? {} : { want };
|
|
250
310
|
const left = yield* timeLeft(limits, started);
|
|
251
311
|
const pack = yield* untilEnded(opened.bytes, input.signal, left, limits);
|
|
252
|
-
return {
|
|
312
|
+
return { answer: {
|
|
253
313
|
shallow: opened.shallow,
|
|
254
314
|
unshallow: [],
|
|
255
315
|
objects: opened.objects,
|
|
256
316
|
pack
|
|
257
|
-
};
|
|
317
|
+
} };
|
|
258
318
|
});
|
|
259
319
|
const readyLimits = (shallow) => ({
|
|
260
320
|
objects: shallow.maxObjects,
|
|
@@ -328,11 +388,13 @@ const keepPack = /* @__PURE__ */ Effect.fnUntraced(function* (input, shallow, pl
|
|
|
328
388
|
const left = yield* timeLeft(limits, started);
|
|
329
389
|
const answer = yield* handingOn(packOfPlan(input.reads, plan, limits, { left }));
|
|
330
390
|
yield* putWhole(bucket, packFiles(opened.pack).pack, answer.pack);
|
|
331
|
-
const
|
|
391
|
+
const { columns } = plan;
|
|
392
|
+
let followed = 0;
|
|
393
|
+
for (let ordinal = 0; ordinal < columns.count; ordinal += 1) if (columns.kindAt(ordinal) === "tag") followed += 1;
|
|
332
394
|
return {
|
|
333
395
|
pack: {
|
|
334
396
|
id: opened.pack,
|
|
335
|
-
objects:
|
|
397
|
+
objects: columns.count,
|
|
336
398
|
bytes: plan.bytes,
|
|
337
399
|
tagged: followed,
|
|
338
400
|
shallow: [...plan.deepened.shallow]
|
|
@@ -343,19 +405,23 @@ const keepPack = /* @__PURE__ */ Effect.fnUntraced(function* (input, shallow, pl
|
|
|
343
405
|
/**
|
|
344
406
|
* `git.repack`'s step for the ready shallow pack, after clean-up's, as a change the core commits:
|
|
345
407
|
* - with the default branch's tip, its depth and its tags as the row says, nothing to do;
|
|
346
|
-
* - otherwise its pack is planned, and within its limits
|
|
347
|
-
* its `quarantine` row gone; past them, or at a tip
|
|
348
|
-
* put with no pack, so only a moved tip plans it
|
|
408
|
+
* - otherwise, with a clone's ask for that tip, its pack is planned, and within its limits
|
|
409
|
+
* written to the bucket and its row put, its `quarantine` row gone; past them, or at a tip
|
|
410
|
+
* naming an object the repo lacks, its row put with no pack, so only a moved tip plans it
|
|
411
|
+
* again;
|
|
412
|
+
* - without one, the row is deleted, its pack leaving, so a push no shallow clone follows costs
|
|
413
|
+
* no walk and no write, and the next clone that misses asks;
|
|
349
414
|
* - a pack the row named before leaves through a `leaving` row, so a clone still streaming it
|
|
350
415
|
* can finish, and clean-up ends its marker and bytes after: at prune's time, or a deleted
|
|
351
416
|
* repo's `leaveAt` when that's sooner;
|
|
352
417
|
* - with no tip, a deleted repo's or one whose default branch isn't there, or `shallow: false`,
|
|
353
|
-
* the row is deleted, its pack leaving
|
|
418
|
+
* the row is deleted, its pack leaving;
|
|
419
|
+
* - an ask is taken by whichever of these meets it, in the same change.
|
|
354
420
|
* `undefined` when there is nothing to do.
|
|
355
421
|
*/
|
|
356
422
|
const readyStep = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
357
423
|
const { shallow, tip, at, prune, leaveAt } = input;
|
|
358
|
-
const { ready, roots: rooted } = yield* readWithRoots(input.store, input.listed);
|
|
424
|
+
const { ready, roots: rooted, wanted } = yield* readWithRoots(input.store, input.listed);
|
|
359
425
|
const roots = [...rooted];
|
|
360
426
|
const tags = tagsDigest(input.tags);
|
|
361
427
|
const rootsAt = rootsDigest(roots);
|
|
@@ -368,29 +434,40 @@ const readyStep = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
368
434
|
...old,
|
|
369
435
|
id: old.id
|
|
370
436
|
}, due));
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
437
|
+
const asked = wanted === void 0 ? [] : [wantedKey];
|
|
438
|
+
const removed = () => {
|
|
439
|
+
if (ready === void 0 && wanted === void 0) return void 0;
|
|
440
|
+
const drops = [...ready === void 0 ? [] : [readyKey], ...asked];
|
|
441
|
+
const change = {
|
|
374
442
|
change: {
|
|
375
443
|
put,
|
|
376
|
-
delete:
|
|
444
|
+
delete: drops,
|
|
377
445
|
rows: noRows
|
|
378
446
|
},
|
|
379
447
|
more: false
|
|
380
448
|
};
|
|
381
|
-
return old === void 0 ?
|
|
382
|
-
...
|
|
449
|
+
return old === void 0 ? change : {
|
|
450
|
+
...change,
|
|
383
451
|
due
|
|
384
452
|
};
|
|
385
|
-
}
|
|
386
|
-
if (
|
|
453
|
+
};
|
|
454
|
+
if (shallow === false || tip === void 0) return removed();
|
|
455
|
+
if (ready?.tip === tip && ready.depth === shallow.depth && ready.tags === tags && ready.roots === rootsAt) return wanted === void 0 ? void 0 : {
|
|
456
|
+
change: {
|
|
457
|
+
put: [],
|
|
458
|
+
delete: asked,
|
|
459
|
+
rows: noRows
|
|
460
|
+
},
|
|
461
|
+
more: false
|
|
462
|
+
};
|
|
463
|
+
if (wanted?.tip !== tip) return removed();
|
|
387
464
|
const kept = yield* Effect.scoped(Effect.gen(function* () {
|
|
388
465
|
const build = {
|
|
389
466
|
...input,
|
|
390
467
|
reads: yield* input.reads,
|
|
391
468
|
roots
|
|
392
469
|
};
|
|
393
|
-
const started = yield* Clock
|
|
470
|
+
const started = yield* Clock.currentTimeMillis;
|
|
394
471
|
const plan = yield* readyPlan(build, shallow, tip, started);
|
|
395
472
|
const left = yield* timeLeft(readyLimits(shallow), started);
|
|
396
473
|
return plan !== void 0 && left > 0 ? yield* keepPack(build, shallow, plan, started).pipe(Effect.catchIf(isLimitRefusal, () => Effect.succeed(void 0))) : void 0;
|
|
@@ -401,6 +478,7 @@ const readyStep = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
401
478
|
tags,
|
|
402
479
|
roots: rootsAt
|
|
403
480
|
};
|
|
481
|
+
del.push(...asked);
|
|
404
482
|
if (kept !== void 0) {
|
|
405
483
|
value.pack = kept.pack;
|
|
406
484
|
del.push(kept.quarantine);
|
|
@@ -423,4 +501,4 @@ const readyStep = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
423
501
|
due
|
|
424
502
|
};
|
|
425
503
|
});
|
|
426
|
-
export { ReadyRow, defaultShallow,
|
|
504
|
+
export { ReadyRow, ReadyWanted, defaultShallow, readyAskMs, readyAskRoomMs, readyBytesMost, readyBytesOf, readyKey, readyLookup, readyRequest, readyShallowsMost, readyStep, tagsDigest, untilEnded, wantedKey, wantedRow };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { millis } from "../contracts/
|
|
1
|
+
import { millis } from "../contracts/time.mjs";
|
|
2
2
|
import { repoRootsMost } from "../store/records.mjs";
|
|
3
3
|
import { graphBytes } from "../protocol/packs/graph.mjs";
|
|
4
4
|
import { packIndexBytes } from "../protocol/packs/idx.mjs";
|
|
@@ -36,6 +36,17 @@ const receiveLinkSpillBytes = 64 * mib;
|
|
|
36
36
|
*/
|
|
37
37
|
const receiveLinksMost = 8e7;
|
|
38
38
|
/**
|
|
39
|
+
* The links outside a pack a receive of rows asks the repo's headers of at once, 1,000: each batch
|
|
40
|
+
* read, checked and let go, so a tree of any width holds one batch of them. Ten of `rowReadBatch`.
|
|
41
|
+
*/
|
|
42
|
+
const receiveLinksAskedBatch = 1e3;
|
|
43
|
+
/**
|
|
44
|
+
* The IDs outside a pack whose types a receive of rows keeps once asked, 100,000, about 10 MB: each
|
|
45
|
+
* asked once while it holds them, and again past it, so a push of many trees naming one file asks
|
|
46
|
+
* once, and one naming a million files holds no more.
|
|
47
|
+
*/
|
|
48
|
+
const receiveLinksAskedMost = 1e5;
|
|
49
|
+
/**
|
|
39
50
|
* The most bytes a receive's check rows are held before they're put, 1 MiB: an object whose check
|
|
40
51
|
* waited for the sweeps is a row of 4 B, so a full buffer's sort, `sortRowBytes` a row, takes
|
|
41
52
|
* 5.5 MB, under the deferred rows' 7.3 MB at `receiveRunBytes`.
|
|
@@ -85,26 +96,34 @@ const receiveCutParentsMost = 2 * receiveBoundaryMost;
|
|
|
85
96
|
*/
|
|
86
97
|
const receiveDropPage = 1e3;
|
|
87
98
|
/**
|
|
88
|
-
* One try of an import
|
|
89
|
-
*
|
|
90
|
-
*
|
|
99
|
+
* One try of an import or a mirror, 13 minutes, longer than every other long job's
|
|
100
|
+
* `jobTryTimeout`. An import copies each LFS object its history points at in one streamed put, and
|
|
101
|
+
* a mirror sends what its upstream lacks in one push, neither with a cursor in its bytes, so a try
|
|
102
|
+
* shorter than the largest transfer at a slow peer starts it again every try. Both stay at 13
|
|
103
|
+
* minutes until their transfers resume across tries (#2900), so a stock Vercel host can't set
|
|
104
|
+
* `longestTry` yet.
|
|
91
105
|
*/
|
|
92
106
|
const importTryTimeout = "13 minutes";
|
|
93
107
|
/**
|
|
94
108
|
* How long after a receive's keys may last have been put clean-up waits to delete them: its
|
|
95
109
|
* `staged` row's wait, from the landing, the end or the drop that left them. A step puts them
|
|
96
|
-
* only inside an import's
|
|
97
|
-
*
|
|
110
|
+
* only inside an import's try, which the queue aborts at `importTryTimeout`, or a push upload's,
|
|
111
|
+
* which it aborts sooner, at `jobTryTimeout`, after its claim and its read of its quarantine, so
|
|
112
|
+
* it's bound by how long the longer of those tries' calls can run:
|
|
98
113
|
* - On Cloudflare, an alarm's `alarmWallTime`, 15 minutes from before the claim. R2's calls
|
|
99
114
|
* through its binding take no signal, so one started before the try's timeout runs on, but
|
|
100
115
|
* the alarm's end stops it.
|
|
101
|
-
* - On
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
116
|
+
* - On Node, Bun or Deno, `importTryTimeout`: at it the signal aborts, `bucketCall` starts no
|
|
117
|
+
* call, and a call under way ends at once. S3's and Vercel Blob's take it, so a request
|
|
118
|
+
* already sent can only commit within its own trip. The disk bucket's calls take no signal: the
|
|
119
|
+
* bound assumes its local writes, an fsync then a link, end within the grace. A queue on
|
|
120
|
+
* `Node.workerThreads()` caps any call: a second past the abort, it ends the handler's thread.
|
|
105
121
|
* Then `jobLeaseMargin`, the queue's own room past a try's end, covers that last call's commit.
|
|
106
|
-
* So 15.5 minutes
|
|
107
|
-
*
|
|
122
|
+
* So 15.5 minutes, on every bucket and host Git ships, given that local I/O. A call that outlasts
|
|
123
|
+
* it on a queue run in-process, the disk bucket's on a disk that stalls, or a host's own bucket's
|
|
124
|
+
* that its interrupt doesn't stop, which the `Bucket` service forbids, can put a key after clean-up.
|
|
125
|
+
* That key belongs to the receive's fresh pack ID, under its prefix or among its pack files, such
|
|
126
|
+
* as `packs/<pack ID>.idx`, which nothing reads again, so it only orphans those bytes.
|
|
108
127
|
*/
|
|
109
128
|
const receiveStepGrace = Math.max(millis(importTryTimeout), alarmWallTime) + jobLeaseMargin;
|
|
110
129
|
/**
|
|
@@ -138,6 +157,24 @@ const pushStepLeast = mib;
|
|
|
138
157
|
*/
|
|
139
158
|
const pushStepBytesOf = (cpuMs) => Math.floor(receiveCpuShare * (cpuMs ?? 3e4) / 400 * mib);
|
|
140
159
|
/**
|
|
160
|
+
* One part of a stepped staging multipart put, 8 MiB: above S3 and R2's 5 MiB minimum, matching
|
|
161
|
+
* `uploadPartBytes`, keeping peak staging JS heap at 8 MiB (within a 128 MB isolate's budget),
|
|
162
|
+
* and producing at most 128 parts for a 1 GiB pack (~8 KB of JSON in `PushUploadSteps.staging`).
|
|
163
|
+
*/
|
|
164
|
+
const stagePartBytes = 8 * mib;
|
|
165
|
+
/** The largest staging slice a single try writes, 128 MiB (16 parts at `stagePartBytes`). */
|
|
166
|
+
const stageSliceMost = 128 * mib;
|
|
167
|
+
/**
|
|
168
|
+
* The bytes one staging try reads and uploads as multipart parts, rounded down to a whole multiple
|
|
169
|
+
* of `stagePartBytes` (so every non-final part meets S3/R2's 5 MiB minimum), floored at
|
|
170
|
+
* `stagePartBytes` and capped at `stageSliceMost`. At Workers' 30 s it is 64 MiB.
|
|
171
|
+
*/
|
|
172
|
+
const stageSliceBytesOf = (cpuMs) => {
|
|
173
|
+
const raw = Math.floor(receiveCpuShare * (cpuMs ?? 3e4) / 375 * mib);
|
|
174
|
+
const aligned = Math.floor(raw / stagePartBytes) * stagePartBytes;
|
|
175
|
+
return Math.min(stageSliceMost, Math.max(stagePartBytes, aligned));
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
141
178
|
* The found rows a receive's join may still write, from its `links` and the pack's `objects`: one
|
|
142
179
|
* for each ID a link names that the table finds among the pack's objects, so at most a link row
|
|
143
180
|
* and at most an object. A join that finds more is refused `foundWrongly`.
|
|
@@ -221,4 +258,4 @@ const receiveCallsAfter = (written, multipart, batch) => {
|
|
|
221
258
|
const runs = written.others + objects.length + commits.length + found.length + links.length + joined.runs + merges.reduce((sum, merge) => sum + merge.runs, 0);
|
|
222
259
|
return lastRuns.reduce((sum, length) => sum + sizedPutCalls(multipart, length), 0) + merges.reduce((sum, merge) => sum + merge.calls, 0) + files.reduce((sum, bytes) => sum + sizedPutCalls(multipart, bytes), 0) + dropRunsCalls(runs, batch);
|
|
223
260
|
};
|
|
224
|
-
export { dropRunsCalls, importTryTimeout, joinFoundMost, mergeCallsOf, pushStepBytesOf, pushStepLeast, receiveBoundaryMost, receiveCallsAfter, receiveCheckRunBytes, receiveCpuShare, receiveCutParentsMost, receiveDeferredSpillBytes, receiveDropPage, receiveLinkSpillBytes, receiveLinksMost, receiveMergeReadBytes, receiveRunBytes, receiveStepFloor, receiveStepGrace, receiveSweepHeldBytes, receiveTableMost, tryCpuMsDefault };
|
|
261
|
+
export { dropRunsCalls, importTryTimeout, joinFoundMost, mergeCallsOf, pushStepBytesOf, pushStepLeast, receiveBoundaryMost, receiveCallsAfter, receiveCheckRunBytes, receiveCpuShare, receiveCutParentsMost, receiveDeferredSpillBytes, receiveDropPage, receiveLinkSpillBytes, receiveLinksAskedBatch, receiveLinksAskedMost, receiveLinksMost, receiveMergeReadBytes, receiveRunBytes, receiveStepFloor, receiveStepGrace, receiveSweepHeldBytes, receiveTableMost, stagePartBytes, stageSliceBytesOf, stageSliceMost, tryCpuMsDefault };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { chargedCache } from "./charged-cache.mjs";
|
|
2
|
+
import { chunkedOf } from "./chunks.mjs";
|
|
3
|
+
import { objectOfRow } from "./object-rows.mjs";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
// src/storage/receive-cache.ts
|
|
6
|
+
/**
|
|
7
|
+
* The most bytes of stored base objects kept from one `receiveRows` call to reuse in that same
|
|
8
|
+
* push's `headers`, `held`, and `kindsOf` reads (#2899). Past this cap, additional bodies are not
|
|
9
|
+
* cached and subsequent reads fall back to the store or packs.
|
|
10
|
+
*/
|
|
11
|
+
const receiveBaseBytes = 1048576;
|
|
12
|
+
/**
|
|
13
|
+
* The most object locations (`packId` or loose row `undefined`) remembered from one `receiveRows`
|
|
14
|
+
* call so `linkedPacks` reuses what `unpackObjects` already resolved (#2899). Past this cap,
|
|
15
|
+
* additional locations are not recorded and `linkedPacks` falls back to `reader.heldIn`.
|
|
16
|
+
*/
|
|
17
|
+
const receiveLocatedMost = 4096;
|
|
18
|
+
/** Per-entry map and key overhead charged to the push's memory allotment for each cached entry. */
|
|
19
|
+
const receiveEntryOverheadBytes = 96;
|
|
20
|
+
/** Inline base64 row payload bytes counted against `receiveBaseBytes` and the push's allotment. */
|
|
21
|
+
const rowBodyBytes = (size) => Math.ceil(size * 4 / 3);
|
|
22
|
+
const cachedBaseBytes = (entry) => entry.kind === "row" ? rowBodyBytes(entry.header.size) : entry.object.bytes.byteLength;
|
|
23
|
+
/**
|
|
24
|
+
* A bounded per-receive cache for one `receiveRows` call: observes what `headers` and `held` read
|
|
25
|
+
* (within `receiveBaseBytes`, `receiveLocatedMost`, and `charge`) and answers repeat `headers`,
|
|
26
|
+
* `held`, and `heldIn` asks without re-reading the store. Past any bound or with no memory room,
|
|
27
|
+
* misses fall back to `reader`.
|
|
28
|
+
*/
|
|
29
|
+
const createReceiveCache = (charge) => {
|
|
30
|
+
const bodies = chargedCache(charge, {
|
|
31
|
+
maxBytes: receiveBaseBytes,
|
|
32
|
+
entryOverhead: receiveEntryOverheadBytes,
|
|
33
|
+
weight: cachedBaseBytes,
|
|
34
|
+
evict: "none"
|
|
35
|
+
});
|
|
36
|
+
const locations = chargedCache(charge, {
|
|
37
|
+
maxBytes: 0,
|
|
38
|
+
maxEntries: receiveLocatedMost,
|
|
39
|
+
entryOverhead: receiveEntryOverheadBytes,
|
|
40
|
+
weight: () => 0,
|
|
41
|
+
evict: "none"
|
|
42
|
+
});
|
|
43
|
+
const keepWhole = (object) => {
|
|
44
|
+
const existing = bodies.get(object.oid);
|
|
45
|
+
if (existing !== void 0 && existing.kind !== "row") return;
|
|
46
|
+
bodies.set(object.oid, {
|
|
47
|
+
kind: "whole",
|
|
48
|
+
object
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const observe = {
|
|
52
|
+
located: (oid, pack) => {
|
|
53
|
+
if (locations.has(oid)) return;
|
|
54
|
+
locations.set(oid, pack);
|
|
55
|
+
},
|
|
56
|
+
row: (row, header) => {
|
|
57
|
+
if (bodies.has(row.id) || chunkedOf(row.value) !== void 0) return;
|
|
58
|
+
bodies.set(row.id, {
|
|
59
|
+
kind: "row",
|
|
60
|
+
row,
|
|
61
|
+
header
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
whole: keepWhole
|
|
65
|
+
};
|
|
66
|
+
const wrap = (reader) => ({
|
|
67
|
+
each: Effect.fnUntraced(function* (oids, take) {
|
|
68
|
+
const seen = /* @__PURE__ */ new Set();
|
|
69
|
+
const missing = [];
|
|
70
|
+
for (const oid of oids) {
|
|
71
|
+
if (seen.has(oid)) continue;
|
|
72
|
+
seen.add(oid);
|
|
73
|
+
const kept = bodies.get(oid);
|
|
74
|
+
if (kept !== void 0) {
|
|
75
|
+
const object = kept.kind === "whole" ? kept.object : yield* objectOfRow(kept.row);
|
|
76
|
+
if (kept.kind === "row") keepWhole(object);
|
|
77
|
+
yield* take(object);
|
|
78
|
+
} else missing.push(oid);
|
|
79
|
+
}
|
|
80
|
+
if (missing.length > 0) yield* reader.each(missing, take);
|
|
81
|
+
}),
|
|
82
|
+
headers: Effect.fnUntraced(function* (oids) {
|
|
83
|
+
const answer = /* @__PURE__ */ new Map();
|
|
84
|
+
const missing = [];
|
|
85
|
+
for (const oid of oids) {
|
|
86
|
+
const kept = bodies.get(oid);
|
|
87
|
+
if (kept !== void 0) answer.set(oid, kept.kind === "row" ? kept.header : {
|
|
88
|
+
type: kept.object.type,
|
|
89
|
+
size: kept.object.bytes.byteLength
|
|
90
|
+
});
|
|
91
|
+
else missing.push(oid);
|
|
92
|
+
}
|
|
93
|
+
if (missing.length > 0) for (const [oid, header] of yield* reader.headers(missing)) answer.set(oid, header);
|
|
94
|
+
return answer;
|
|
95
|
+
}),
|
|
96
|
+
held: Effect.fnUntraced(function* (oids) {
|
|
97
|
+
const answer = /* @__PURE__ */ new Map();
|
|
98
|
+
const missing = [];
|
|
99
|
+
for (const oid of oids) {
|
|
100
|
+
const kept = bodies.get(oid);
|
|
101
|
+
if (kept !== void 0) {
|
|
102
|
+
const object = kept.kind === "whole" ? kept.object : yield* objectOfRow(kept.row);
|
|
103
|
+
if (kept.kind === "row") keepWhole(object);
|
|
104
|
+
answer.set(oid, object);
|
|
105
|
+
} else missing.push(oid);
|
|
106
|
+
}
|
|
107
|
+
if (missing.length > 0) for (const [oid, object] of yield* reader.held(missing)) answer.set(oid, object);
|
|
108
|
+
return answer;
|
|
109
|
+
}),
|
|
110
|
+
heldIn: Effect.fnUntraced(function* (oids) {
|
|
111
|
+
const answer = /* @__PURE__ */ new Map();
|
|
112
|
+
const missing = [];
|
|
113
|
+
for (const oid of oids) if (locations.has(oid)) answer.set(oid, locations.get(oid));
|
|
114
|
+
else missing.push(oid);
|
|
115
|
+
if (missing.length > 0) for (const [oid, pack] of yield* reader.heldIn(missing)) answer.set(oid, pack);
|
|
116
|
+
return answer;
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
const dropLocations = () => {
|
|
120
|
+
locations.clear();
|
|
121
|
+
};
|
|
122
|
+
const release = () => {
|
|
123
|
+
locations.release();
|
|
124
|
+
bodies.release();
|
|
125
|
+
};
|
|
126
|
+
const clear = () => {
|
|
127
|
+
locations.release();
|
|
128
|
+
bodies.release();
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
observe,
|
|
132
|
+
bodies,
|
|
133
|
+
get bodyBytes() {
|
|
134
|
+
return bodies.bytes;
|
|
135
|
+
},
|
|
136
|
+
get chargedBytes() {
|
|
137
|
+
return bodies.chargedBytes + locations.chargedBytes;
|
|
138
|
+
},
|
|
139
|
+
wrap,
|
|
140
|
+
dropLocations,
|
|
141
|
+
release,
|
|
142
|
+
clear
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
/** Decodes a cached base object as a `WholeObject`, hashing inline rows on demand. */
|
|
146
|
+
const wholeOfCached = (cached) => cached.kind === "whole" ? Effect.succeed(cached.object) : objectOfRow(cached.row);
|
|
147
|
+
export { createReceiveCache, receiveBaseBytes, receiveEntryOverheadBytes, receiveLocatedMost, rowBodyBytes, wholeOfCached };
|
|
@@ -8,8 +8,8 @@ import { packTypesBytes, typeCode, typeOfByte, writePackTypes } from "../protoco
|
|
|
8
8
|
import { compareIds } from "./raw-ids.mjs";
|
|
9
9
|
import { receiveRunBytes } from "./receive-bounds.mjs";
|
|
10
10
|
import { StoredRuns, firstBytesOf, mergeRuns, mergedCursor, receiveRuns, steppedWriter } from "./runs.mjs";
|
|
11
|
-
import * as Effect from "effect/Effect";
|
|
12
11
|
import * as Schema from "effect/Schema";
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
13
|
const noParent = 4294967295;
|
|
14
14
|
const linkedMark = 2147483648;
|
|
15
15
|
/**
|
|
@@ -7,8 +7,8 @@ import { compareIds } from "./raw-ids.mjs";
|
|
|
7
7
|
import { mistyped, objectMissing, shallowRoot, wrongType } from "./links.mjs";
|
|
8
8
|
import { receiveLinkSpillBytes, receiveLinksMost, receiveRunBytes } from "./receive-bounds.mjs";
|
|
9
9
|
import { StoredRuns, mergedCursor, steppedWriter } from "./runs.mjs";
|
|
10
|
-
import * as Effect from "effect/Effect";
|
|
11
10
|
import * as Schema from "effect/Schema";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
12
|
/** A link's place in the push's order: the low 30 bits of its row's word. */
|
|
13
13
|
const placeMask = 2 ** 30 - 1;
|
|
14
14
|
const receiveLinkLimits = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bucketReading, readWhole } from "./calls.mjs";
|
|
1
|
+
import { bucketReading, bucketTry, readWhole } from "./calls.mjs";
|
|
2
2
|
import { checkedCarried, receiveChecked, receiveCheckedLimits } from "./fsck.mjs";
|
|
3
3
|
import { putOnce } from "./index-build.mjs";
|
|
4
4
|
import { stepKey } from "./layout.mjs";
|
|
@@ -9,8 +9,8 @@ import { LinksCarry } from "./receive-links.mjs";
|
|
|
9
9
|
import { receiveTableOf } from "./receive-table.mjs";
|
|
10
10
|
import { StoredRuns } from "./runs.mjs";
|
|
11
11
|
import { fail } from "../contracts/result.mjs";
|
|
12
|
-
import * as Effect from "effect/Effect";
|
|
13
12
|
import * as Schema from "effect/Schema";
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
14
|
// src/storage/receive-state.ts
|
|
15
15
|
const objectType = /* @__PURE__ */ Schema.Literals([
|
|
16
16
|
"blob",
|
|
@@ -109,23 +109,21 @@ const putStepState = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, keys,
|
|
|
109
109
|
* `key`'s records of `width` bytes, each handed to `each` as it comes, so none is held whole past
|
|
110
110
|
* its chunk: the bytes read, past `most` no more, and whether `each` took every one.
|
|
111
111
|
*/
|
|
112
|
-
const readRecords = (bucket, key, width, most, each) => bucketReading(bucket, key, void 0,
|
|
113
|
-
if (
|
|
114
|
-
const reader = body.getReader();
|
|
112
|
+
const readRecords = (bucket, key, width, most, each) => bucketReading(bucket, key, void 0, Effect.fnUntraced(function* (reader) {
|
|
113
|
+
if (reader === void 0) return void 0;
|
|
115
114
|
const record = new Uint8Array(width);
|
|
116
115
|
let bytes = 0;
|
|
117
116
|
let taken = true;
|
|
118
|
-
for (let next =
|
|
117
|
+
for (let next = yield* bucketTry(() => reader.read()); !next.done && bytes <= most; next = yield* bucketTry(() => reader.read())) for (const byte of next.value) {
|
|
119
118
|
record[bytes % width] = byte;
|
|
120
119
|
bytes += 1;
|
|
121
120
|
if (bytes % width === 0 && bytes <= most) taken = each(record) && taken;
|
|
122
121
|
}
|
|
123
|
-
if (bytes > most) await reader.cancel();
|
|
124
122
|
return {
|
|
125
123
|
bytes,
|
|
126
124
|
taken
|
|
127
125
|
};
|
|
128
|
-
});
|
|
126
|
+
}));
|
|
129
127
|
/**
|
|
130
128
|
* The state, table and records a committed step put, which the record names. A state or table
|
|
131
129
|
* missing or unreadable is `INTERNAL`; records missing, cut short, too long, or holding what no step
|