@ref0/git 0.20.0 → 0.26.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 +3 -3
- 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 +1 -1
- package/dist/auth/fences.d.mts +1 -1
- package/dist/auth/host-function.mjs +1 -1
- package/dist/auth/host-services.mjs +4 -6
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +6 -0
- package/dist/auth/token-cleanup.mjs +2 -2
- package/dist/auth/token-rows.mjs +6 -1
- package/dist/auth/token-text.mjs +1 -1
- package/dist/auth/tokens-base.d.mts +1 -1
- package/dist/auth/tokens.d.mts +1 -1
- package/dist/auth/tokens.mjs +1 -1
- package/dist/client/client.d.mts +15 -7
- package/dist/client/client.mjs +21 -12
- package/dist/client/git-http.mjs +1 -1
- package/dist/client/local.mjs +60 -24
- package/dist/client/negotiate.mjs +3 -3
- package/dist/client/push-upload.mjs +26 -10
- package/dist/client/remote.mjs +4 -3
- package/dist/client/run-remote-helper.d.mts +2 -2
- package/dist/client/run-remote-helper.mjs +6 -6
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +3 -3
- package/dist/contracts/blobs.d.mts +3 -3
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/calls-spent.mjs +5 -33
- package/dist/contracts/client.d.mts +15 -14
- package/dist/contracts/commits.d.mts +4 -4
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +2 -2
- package/dist/contracts/events.d.mts +1 -1
- package/dist/contracts/events.mjs +1 -1
- package/dist/contracts/files.d.mts +4 -4
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +4 -4
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-hooks.d.mts +1 -1
- package/dist/contracts/git.d.mts +9 -5
- package/dist/contracts/grants.d.mts +1 -1
- package/dist/contracts/merges.d.mts +1 -1
- package/dist/contracts/object-values.d.mts +1 -0
- package/dist/contracts/object-values.mjs +16 -1
- package/dist/contracts/objects.d.mts +30 -18
- package/dist/contracts/opaque.mjs +1 -1
- package/dist/contracts/operations.mjs +1 -1
- package/dist/contracts/queue.d.mts +208 -44
- package/dist/contracts/queue.mjs +5 -5
- package/dist/contracts/refs.d.mts +5 -5
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +3 -6
- package/dist/contracts/repos.d.mts +3 -3
- package/dist/contracts/repos.mjs +1 -1
- package/dist/contracts/result.d.mts +10 -7
- package/dist/contracts/result.mjs +8 -3
- package/dist/contracts/rules.d.mts +13 -12
- package/dist/contracts/server.d.mts +8 -10
- 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 +2 -2
- package/dist/contracts/sync.d.mts +63 -6
- package/dist/contracts/sync.mjs +3 -2
- package/dist/contracts/tags.d.mts +3 -3
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/tokens.d.mts +2 -2
- package/dist/contracts/tokens.mjs +1 -1
- package/dist/contracts/topics.d.mts +9 -9
- package/dist/contracts/trees.d.mts +4 -4
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +4 -4
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +1 -1
- package/dist/core/ancestry.mjs +30 -34
- package/dist/core/{promise.mjs → call-groups.mjs} +7 -30
- package/dist/core/call-services.mjs +1 -1
- package/dist/core/events/deliver.d.mts +2 -2
- package/dist/core/events/deliver.mjs +3 -3
- package/dist/core/events/retired.mjs +1 -1
- package/dist/core/forks.mjs +5 -5
- package/dist/core/hooks/groups.mjs +2 -2
- package/dist/core/imports.mjs +101 -21
- package/dist/core/index-job.mjs +14 -9
- package/dist/core/index-lost.d.mts +1 -1
- 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 +8 -10
- package/dist/core/objects/files.mjs +20 -17
- package/dist/core/objects/objects-layer.mjs +1 -1
- package/dist/core/objects/peel.mjs +1 -7
- package/dist/core/objects/reading.mjs +19 -18
- package/dist/core/objects/tree-edits.mjs +1 -1
- package/dist/core/objects/trees.mjs +257 -58
- package/dist/core/objects/writing.mjs +3 -9
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +8 -1
- package/dist/core/parts.mjs +8 -4
- package/dist/core/purge.mjs +31 -18
- package/dist/core/push.d.mts +2 -2
- package/dist/core/push.mjs +145 -98
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +9 -2
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +74 -31
- package/dist/core/refs.mjs +3 -3
- package/dist/core/repack.mjs +25 -30
- package/dist/core/repo-info.mjs +1 -1
- package/dist/core/repos.mjs +1 -1
- package/dist/core/rules/changes.mjs +18 -40
- package/dist/core/rules/check.mjs +6 -5
- package/dist/core/rules/commit-changes.mjs +114 -58
- 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 +1 -1
- package/dist/core/saved-caller-views.mjs +3 -3
- package/dist/core/saved-callers.d.mts +1 -1
- package/dist/core/saved-callers.mjs +1 -1
- package/dist/core/seam.d.mts +1 -2
- package/dist/core/view.d.mts +6 -3
- package/dist/core/view.mjs +11 -10
- package/dist/core/work.mjs +2 -2
- 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/merge.mjs +7 -9
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +22 -14
- 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 +2 -2
- package/dist/event-streams/stream.mjs +3 -3
- package/dist/extend.d.mts +2 -6
- package/dist/extend.mjs +1 -5
- package/dist/http/core-parts.mjs +83 -26
- package/dist/http/handler.mjs +54 -9
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +138 -24
- package/dist/http/push-uploads.mjs +2 -2
- package/dist/http/receive-pack.mjs +14 -53
- package/dist/http/request-snapshot.mjs +258 -0
- package/dist/http/upload-pack.mjs +23 -18
- package/dist/index.d.mts +29 -21
- package/dist/index.mjs +11 -2
- package/dist/lfs/base.d.mts +1 -1
- package/dist/lfs/copy.d.mts +49 -1
- package/dist/lfs/copy.mjs +135 -22
- package/dist/lfs/layer.d.mts +4 -3
- package/dist/lfs/layer.mjs +4 -5
- package/dist/lfs/locks.mjs +2 -2
- package/dist/lfs/objects.d.mts +1 -1
- package/dist/lfs/objects.mjs +3 -3
- package/dist/lfs/pointers.mjs +1 -1
- package/dist/lfs/rows.d.mts +1 -1
- package/dist/lfs/rows.mjs +11 -4
- package/dist/lfs/upkeep.mjs +40 -9
- package/dist/lfs/uploaded.mjs +1 -1
- package/dist/lfs/wire.mjs +1 -1
- package/dist/merges/merges.mjs +17 -2
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +1 -1
- 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/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +1 -1
- package/dist/protocol/diff/read.d.mts +2 -1
- package/dist/protocol/diff/read.mjs +102 -8
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +1 -1
- package/dist/protocol/packs/idx.mjs +1 -1
- package/dist/protocol/packs/parts.mjs +1 -1
- package/dist/protocol/packs/reader.d.mts +1 -1
- package/dist/protocol/packs/reader.mjs +1 -1
- 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 +3 -3
- 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 +31 -24
- package/dist/queue/base.d.mts +5 -3
- package/dist/queue/calls.mjs +5 -5
- package/dist/queue/commit.mjs +1 -1
- package/dist/queue/host.d.mts +1 -1
- package/dist/queue/layer.d.mts +0 -1
- package/dist/queue/layer.mjs +9 -5
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +1 -1
- package/dist/queue/state.mjs +1 -1
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/client.d.mts +1 -1
- package/dist/rest/client.mjs +6 -6
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/handler.mjs +2 -2
- package/dist/rest/handlers.mjs +16 -6
- package/dist/rest/layer.mjs +1 -1
- package/dist/rest/listen.mjs +2 -2
- package/dist/rest/refs.mjs +1 -1
- package/dist/server/edge.mjs +27 -3
- package/dist/server/git-layer.d.mts +1 -2
- package/dist/server/git-layer.mjs +4 -5
- package/dist/server/lifecycle.mjs +1 -1
- package/dist/server/registry.mjs +2 -8
- package/dist/server/server.mjs +62 -43
- package/dist/signin/context.d.mts +1 -1
- 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/wire.mjs +1 -1
- package/dist/storage/allotted.mjs +4 -9
- package/dist/storage/batch-upkeep.mjs +31 -12
- package/dist/storage/batches.d.mts +2 -3
- package/dist/storage/batches.mjs +52 -49
- package/dist/storage/budget.mjs +23 -1
- package/dist/storage/calls.d.mts +1 -1
- package/dist/storage/calls.mjs +41 -43
- package/dist/storage/charged-cache.mjs +180 -0
- package/dist/storage/chunks.d.mts +3 -3
- package/dist/storage/chunks.mjs +121 -8
- package/dist/storage/counted-bucket.mjs +32 -10
- 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 +1 -0
- package/dist/storage/fetch.mjs +54 -242
- package/dist/storage/held-types.d.mts +0 -1
- package/dist/storage/held-types.mjs +13 -4
- package/dist/storage/host-bucket.mjs +9 -4
- package/dist/storage/index-bitmaps.mjs +340 -65
- package/dist/storage/index-build.d.mts +2 -3
- package/dist/storage/index-build.mjs +274 -56
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +60 -21
- package/dist/storage/index-graph.mjs +1 -1
- package/dist/storage/index-layers.mjs +55 -25
- package/dist/storage/index-reach.mjs +15 -22
- package/dist/storage/index-whole.d.mts +7 -0
- package/dist/storage/index-whole.mjs +145 -37
- package/dist/storage/largest-files.mjs +1 -7
- package/dist/storage/layout.mjs +17 -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 +8 -8
- package/dist/storage/loose.mjs +157 -91
- package/dist/storage/memory-budget.mjs +226 -22
- package/dist/storage/merge-cut.mjs +9 -6
- package/dist/storage/merge-fence.mjs +1 -1
- package/dist/storage/merge-row.mjs +1 -1
- package/dist/storage/merge.d.mts +2 -3
- package/dist/storage/merge.mjs +2 -2
- package/dist/storage/object-rows.d.mts +3 -3
- package/dist/storage/object-rows.mjs +179 -38
- package/dist/storage/pack-order.mjs +97 -44
- package/dist/storage/pack-ranges.mjs +44 -16
- package/dist/storage/pack-reads.d.mts +5 -3
- package/dist/storage/pack-reads.mjs +236 -72
- package/dist/storage/pack-receive.d.mts +1 -2
- package/dist/storage/pack-receive.mjs +24 -18
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +477 -116
- package/dist/storage/placed-reads.mjs +33 -16
- package/dist/storage/prune-seen.mjs +1 -1
- package/dist/storage/prune-walk.mjs +1 -1
- package/dist/storage/prune.mjs +4 -31
- package/dist/storage/push-allotment.mjs +26 -14
- package/dist/storage/push-uploads.mjs +195 -57
- package/dist/storage/pushed-commits.mjs +20 -1
- package/dist/storage/quarantine.d.mts +2 -3
- package/dist/storage/range-cache.mjs +175 -40
- package/dist/storage/raw-ids.mjs +39 -10
- package/dist/storage/ready.d.mts +2 -3
- package/dist/storage/ready.mjs +114 -38
- package/dist/storage/receive-bounds.mjs +31 -9
- 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 -6
- package/dist/storage/repack-contained.mjs +2 -2
- package/dist/storage/repack-job.mjs +1 -1
- package/dist/storage/repack.d.mts +2 -3
- 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 +2 -2
- package/dist/storage/rows.mjs +1 -1
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +1 -1
- package/dist/storage/send-list.mjs +62 -25
- package/dist/storage/stream-whole.mjs +84 -63
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +878 -450
- package/dist/storage/visible.mjs +110 -32
- package/dist/storage/walk.mjs +1 -0
- package/dist/storage/wants.mjs +22 -58
- package/dist/store/call-count.d.mts +2 -2
- package/dist/store/call-count.mjs +24 -11
- package/dist/store/catalogue.d.mts +1 -1
- package/dist/store/catalogue.mjs +19 -7
- package/dist/store/crossing.mjs +1 -7
- package/dist/store/cursor-seal.d.mts +1 -1
- package/dist/store/cursor-seal.mjs +1 -1
- package/dist/store/door.mjs +9 -4
- package/dist/store/errors.d.mts +2 -2
- package/dist/store/errors.mjs +107 -19
- package/dist/store/git-store.mjs +7 -2
- package/dist/store/job-try.mjs +90 -9
- package/dist/store/list-job.mjs +10 -34
- 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 +2 -2
- package/dist/store/records.mjs +2 -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 -2
- package/dist/store/repo-record.mjs +3 -3
- package/dist/store/request-snapshot.mjs +5 -0
- package/dist/store/reservations.mjs +2 -2
- 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 +65 -67
- package/dist/sync/http.mjs +1 -1
- package/dist/sync/import.mjs +201 -66
- package/dist/sync/layer.d.mts +1 -1
- package/dist/sync/layer.mjs +6 -6
- package/dist/sync/lfs-batch.mjs +1 -1
- package/dist/sync/lfs-copy.mjs +175 -15
- package/dist/sync/mirror.mjs +5 -10
- package/dist/sync/said.mjs +1 -1
- package/dist/sync/step.mjs +268 -86
- package/dist/sync/tries.mjs +25 -6
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +3 -3
- package/dist/topics/calls.mjs +1 -1
- package/dist/topics/layer.d.mts +15 -14
- package/dist/topics/members.mjs +1 -1
- package/dist/topics/topic.mjs +1 -1
- package/package.json +3 -13
- package/dist/auth/helpers.mjs +0 -17
- package/dist/auth.d.mts +0 -5
- package/dist/auth.mjs +0 -5
- package/dist/core/rules/commit-changes.d.mts +0 -12
- package/dist/effect.d.mts +0 -9
- package/dist/effect.mjs +0 -7
- package/dist/server/joined.d.mts +0 -70
- package/dist/server/joined.mjs +0 -41
|
@@ -96,28 +96,32 @@ const receiveCutParentsMost = 2 * receiveBoundaryMost;
|
|
|
96
96
|
*/
|
|
97
97
|
const receiveDropPage = 1e3;
|
|
98
98
|
/**
|
|
99
|
-
* One try of an import
|
|
100
|
-
*
|
|
101
|
-
*
|
|
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.
|
|
102
105
|
*/
|
|
103
106
|
const importTryTimeout = "13 minutes";
|
|
104
107
|
/**
|
|
105
108
|
* How long after a receive's keys may last have been put clean-up waits to delete them: its
|
|
106
109
|
* `staged` row's wait, from the landing, the end or the drop that left them. A step puts them
|
|
107
|
-
* only inside an import's
|
|
108
|
-
*
|
|
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:
|
|
109
113
|
* - On Cloudflare, an alarm's `alarmWallTime`, 15 minutes from before the claim. R2's calls
|
|
110
114
|
* through its binding take no signal, so one started before the try's timeout runs on, but
|
|
111
115
|
* the alarm's end stops it.
|
|
112
116
|
* - On Node, Bun or Deno, `importTryTimeout`: at it the signal aborts, `bucketCall` starts no
|
|
113
117
|
* call, and a call under way ends at once. S3's and Vercel Blob's take it, so a request
|
|
114
|
-
* already sent can only commit within its own trip.
|
|
118
|
+
* already sent can only commit within its own trip. The disk bucket's calls take no signal: the
|
|
115
119
|
* bound assumes its local writes, an fsync then a link, end within the grace. A queue on
|
|
116
120
|
* `Node.workerThreads()` caps any call: a second past the abort, it ends the handler's thread.
|
|
117
121
|
* Then `jobLeaseMargin`, the queue's own room past a try's end, covers that last call's commit.
|
|
118
122
|
* So 15.5 minutes, on every bucket and host Git ships, given that local I/O. A call that outlasts
|
|
119
|
-
* it on a queue run in-process,
|
|
120
|
-
*
|
|
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.
|
|
121
125
|
* That key belongs to the receive's fresh pack ID, under its prefix or among its pack files, such
|
|
122
126
|
* as `packs/<pack ID>.idx`, which nothing reads again, so it only orphans those bytes.
|
|
123
127
|
*/
|
|
@@ -153,6 +157,24 @@ const pushStepLeast = mib;
|
|
|
153
157
|
*/
|
|
154
158
|
const pushStepBytesOf = (cpuMs) => Math.floor(receiveCpuShare * (cpuMs ?? 3e4) / 400 * mib);
|
|
155
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
|
+
/**
|
|
156
178
|
* The found rows a receive's join may still write, from its `links` and the pack's `objects`: one
|
|
157
179
|
* for each ID a link names that the table finds among the pack's objects, so at most a link row
|
|
158
180
|
* and at most an object. A join that finds more is refused `foundWrongly`.
|
|
@@ -236,4 +258,4 @@ const receiveCallsAfter = (written, multipart, batch) => {
|
|
|
236
258
|
const runs = written.others + objects.length + commits.length + found.length + links.length + joined.runs + merges.reduce((sum, merge) => sum + merge.runs, 0);
|
|
237
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);
|
|
238
260
|
};
|
|
239
|
-
export { dropRunsCalls, importTryTimeout, joinFoundMost, mergeCallsOf, pushStepBytesOf, pushStepLeast, receiveBoundaryMost, receiveCallsAfter, receiveCheckRunBytes, receiveCpuShare, receiveCutParentsMost, receiveDeferredSpillBytes, receiveDropPage, receiveLinkSpillBytes, receiveLinksAskedBatch, receiveLinksAskedMost, 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
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "../contracts/result.mjs";
|
|
2
|
+
import "../contracts/ids.mjs";
|
|
3
|
+
import "../contracts/objects.mjs";
|
|
4
|
+
import "../contracts/store.mjs";
|
|
5
|
+
import "./memory-budget.mjs";
|
|
6
|
+
import "./pack-receive.mjs";
|
|
7
|
+
import "./pack-reads.mjs";
|
|
8
|
+
import "./quarantine.mjs";
|
|
9
|
+
import "./layout.mjs";
|
|
10
|
+
import "./rows.mjs";
|
|
11
|
+
import { Key, Moment, Row } from "@ref0/infra";
|
|
12
|
+
import * as Schema from "effect/Schema";
|
|
13
|
+
import "effect/Effect";
|
|
14
|
+
/** One uploaded multipart receipt kept across staging tries, matching infra's `ListedPart`. */
|
|
15
|
+
export declare const StagePart: Schema.Struct<{
|
|
16
|
+
readonly part: Schema.Int;
|
|
17
|
+
readonly etag: Schema.String;
|
|
18
|
+
readonly size: Schema.Int;
|
|
19
|
+
}>;
|
|
20
|
+
export type StagePart = typeof StagePart.Type;
|