@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
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
2
|
+
import { drawnMix, hashOf, keyed } from "./id-mix.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* The most IDs a table holds: 2^24, 16,777,216, whose slots are 2^25 32-bit words, 128 MiB, beside
|
|
5
|
+
* 320 MiB of IDs. A Worker's memory refuses a caller long before; this bounds what `grow` allocates
|
|
6
|
+
* when a caller's own bound is wrong.
|
|
7
|
+
*/
|
|
8
|
+
const oidTableMost = 2 ** 24;
|
|
9
|
+
/** The slots for `capacity` IDs: at least twice as many, a power of two, so a probe always ends. */
|
|
10
|
+
const slotsFor = (capacity) => 2 ** Math.ceil(Math.log2(Math.max(capacity, 1) * 2));
|
|
11
|
+
/** What a table of `capacity` IDs holds: its IDs and its slots, whether or not they're filled. */
|
|
12
|
+
const oidTableBytes = (capacity) => capacity * 20 + slotsFor(capacity) * 4;
|
|
13
|
+
/** `capacity`, checked: a whole number from 0 to `oidTableMost`, so no `NaN` or `Infinity` sizes an array. */
|
|
14
|
+
const checked = (capacity) => {
|
|
15
|
+
if (!Number.isInteger(capacity) || capacity < 0 || capacity > oidTableMost) throw new Error(`an ID table holds 0 to ${oidTableMost} IDs, not ${capacity}`);
|
|
16
|
+
return capacity;
|
|
17
|
+
};
|
|
18
|
+
/** The ID last read from text into `lastKey`, which every table shares: see `keyOf`. */
|
|
19
|
+
let lastOid;
|
|
20
|
+
const lastKey = /* @__PURE__ */ new Uint8Array(20);
|
|
21
|
+
/**
|
|
22
|
+
* `oid`'s 20 bytes: a string `keyed` refuses is no ID. Every table reads text IDs into one key and
|
|
23
|
+
* looks it up at once, so an ID asked of several tables in turn, as a walk asks its sets of each
|
|
24
|
+
* link, is read from text once, as a `Set` hashes a string once.
|
|
25
|
+
*/
|
|
26
|
+
const keyOf = (oid) => {
|
|
27
|
+
if (oid === lastOid) return lastKey;
|
|
28
|
+
lastOid = void 0;
|
|
29
|
+
if (!keyed(oid, lastKey)) throw new Error(`${oid} isn't an object ID`);
|
|
30
|
+
lastOid = oid;
|
|
31
|
+
return lastKey;
|
|
32
|
+
};
|
|
33
|
+
/** A table with room for `capacity` IDs, its hash under a mix drawn for it alone. */
|
|
34
|
+
const oidTable = (capacity) => {
|
|
35
|
+
let room = checked(capacity);
|
|
36
|
+
const mix = drawnMix();
|
|
37
|
+
let ids = new Uint8Array(room * 20);
|
|
38
|
+
let slots = new Uint32Array(slotsFor(room));
|
|
39
|
+
let size = 0;
|
|
40
|
+
const same = (ordinal, bytes, at) => {
|
|
41
|
+
const from = ordinal * 20;
|
|
42
|
+
for (let byte = 0; byte < 20; byte += 1) if (ids[from + byte] !== bytes[at + byte]) return false;
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
45
|
+
/** The slot holding the ID at `at` in `bytes`, or the empty one it goes in. */
|
|
46
|
+
const slotOf = (bytes, at) => {
|
|
47
|
+
const mask = slots.length - 1;
|
|
48
|
+
for (let slot = hashOf(bytes, at, mix) & mask;; slot = slot + 1 & mask) {
|
|
49
|
+
const held = slots[slot] ?? 0;
|
|
50
|
+
if (held === 0 || same(held - 1, bytes, at)) return slot;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
/** The 20 bytes at `at` in `bytes`, past `bytes`' end refused, so a short ID is never read as zeros. */
|
|
54
|
+
const within = (bytes, at) => {
|
|
55
|
+
if (!Number.isInteger(at) || at < 0 || at + 20 > bytes.byteLength) throw new Error(`no ID of 20 bytes at ${at} of ${bytes.byteLength}`);
|
|
56
|
+
};
|
|
57
|
+
/** The ordinal of the ID at `at` in `bytes`, or `undefined` when none was added. */
|
|
58
|
+
const findBytes = (bytes, at = 0) => {
|
|
59
|
+
within(bytes, at);
|
|
60
|
+
if (size === 0) return void 0;
|
|
61
|
+
const held = slots[slotOf(bytes, at)] ?? 0;
|
|
62
|
+
return held === 0 ? void 0 : held - 1;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The ordinal of the ID at `at` in `bytes`: the one it was added at, or the next, `size`, when
|
|
66
|
+
* it's new; `undefined` when it's new and the table is full.
|
|
67
|
+
*/
|
|
68
|
+
const addBytes = (bytes, at = 0) => {
|
|
69
|
+
within(bytes, at);
|
|
70
|
+
const slot = slotOf(bytes, at);
|
|
71
|
+
const held = slots[slot] ?? 0;
|
|
72
|
+
if (held !== 0) return held - 1;
|
|
73
|
+
if (size === room) return void 0;
|
|
74
|
+
ids.set(bytes.subarray(at, at + 20), size * 20);
|
|
75
|
+
size += 1;
|
|
76
|
+
slots[slot] = size;
|
|
77
|
+
return size - 1;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Room for `capacity` IDs, at least the table's size: its IDs copied and its slots laid again.
|
|
81
|
+
* The old arrays are let go after, so for that moment it holds both, as a caller that charged
|
|
82
|
+
* `oidTableBytes(capacity)` beside the table's own has paid for.
|
|
83
|
+
*/
|
|
84
|
+
const grow = (capacity) => {
|
|
85
|
+
if (checked(capacity) < size) throw new Error(`an ID table of ${size} IDs can't shrink to ${capacity}`);
|
|
86
|
+
const grown = new Uint8Array(capacity * 20);
|
|
87
|
+
grown.set(ids.subarray(0, size * 20));
|
|
88
|
+
ids = grown;
|
|
89
|
+
room = capacity;
|
|
90
|
+
slots = new Uint32Array(slotsFor(capacity));
|
|
91
|
+
for (let ordinal = 0; ordinal < size; ordinal += 1) slots[slotOf(ids, ordinal * 20)] = ordinal + 1;
|
|
92
|
+
};
|
|
93
|
+
/** The bytes of the ID at `ordinal`, a view of the table's own: copy them to keep them past a `grow`. */
|
|
94
|
+
const bytesAt = (ordinal) => {
|
|
95
|
+
if (!Number.isInteger(ordinal) || ordinal < 0 || ordinal >= size) throw new Error(`no ID at ${ordinal} of ${size}`);
|
|
96
|
+
return ids.subarray(ordinal * 20, ordinal * 20 + 20);
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
/** How many IDs it holds. */
|
|
100
|
+
get size() {
|
|
101
|
+
return size;
|
|
102
|
+
},
|
|
103
|
+
/** How many IDs it has room for before `grow`. */
|
|
104
|
+
get capacity() {
|
|
105
|
+
return room;
|
|
106
|
+
},
|
|
107
|
+
/** What it holds now: `oidTableBytes` of its capacity. */
|
|
108
|
+
get bytes() {
|
|
109
|
+
return oidTableBytes(room);
|
|
110
|
+
},
|
|
111
|
+
/** Its IDs end to end, in ordinal order, as a view of its own: valid until the next `grow`. */
|
|
112
|
+
get ids() {
|
|
113
|
+
return ids.subarray(0, size * 20);
|
|
114
|
+
},
|
|
115
|
+
/** `addBytes` of `oid`'s 20 bytes. */
|
|
116
|
+
add: (oid) => addBytes(keyOf(oid)),
|
|
117
|
+
addBytes,
|
|
118
|
+
/** `findBytes` of `oid`'s 20 bytes. */
|
|
119
|
+
find: (oid) => findBytes(keyOf(oid)),
|
|
120
|
+
findBytes,
|
|
121
|
+
/** `oid` as it was added, in lowercase hex. */
|
|
122
|
+
oidAt: (ordinal) => hexOf(bytesAt(ordinal)),
|
|
123
|
+
bytesAt,
|
|
124
|
+
grow
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
/** The room a table adds when it's full: a quarter more, and at least 64. */
|
|
128
|
+
const grownRoom = (room) => room + Math.max(64, Math.ceil(room / 4));
|
|
129
|
+
/**
|
|
130
|
+
* `column`'s values in `made`, a longer column of its kind, as a table's caller grows the columns
|
|
131
|
+
* it keeps by ordinal beside the table.
|
|
132
|
+
*/
|
|
133
|
+
const longer = (column, made) => {
|
|
134
|
+
made.set(column);
|
|
135
|
+
return made;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* A set of object IDs on an `oidTable`, in the order they were added, as a `Set<Oid>` holds them:
|
|
139
|
+
* 20 B an ID and at most 16 B of slots, where a `Set`'s string and slot hold about 110 B. It grows
|
|
140
|
+
* by `grownRoom` as it fills, holding the old table and the new for a moment as it does; what it
|
|
141
|
+
* holds is part of what a fetch's walk charges for each object it adds.
|
|
142
|
+
*/
|
|
143
|
+
const oidSet = (oids = []) => {
|
|
144
|
+
const table = oidTable(0);
|
|
145
|
+
/** Adds the ID at `at` in `bytes`: `true` when it's new, as `Set.add` answers nothing and `has` would ask twice. */
|
|
146
|
+
const addBytes = (bytes, at = 0) => {
|
|
147
|
+
const before = table.size;
|
|
148
|
+
if (table.addBytes(bytes, at) !== void 0) return table.size > before;
|
|
149
|
+
table.grow(grownRoom(table.capacity));
|
|
150
|
+
table.addBytes(bytes, at);
|
|
151
|
+
return true;
|
|
152
|
+
};
|
|
153
|
+
/** `addBytes` of `oid`'s 20 bytes. */
|
|
154
|
+
const add = (oid) => addBytes(keyOf(oid));
|
|
155
|
+
for (const oid of oids) add(oid);
|
|
156
|
+
return {
|
|
157
|
+
/** Its table, grown in place, for a caller that keeps columns by its ordinals. */
|
|
158
|
+
table,
|
|
159
|
+
add,
|
|
160
|
+
addBytes,
|
|
161
|
+
/** Whether `oid` was added. */
|
|
162
|
+
has: (oid) => table.find(oid) !== void 0,
|
|
163
|
+
/** Whether the ID at `at` in `bytes` was added, none of it made as text. */
|
|
164
|
+
hasBytes: (bytes, at = 0) => table.findBytes(bytes, at) !== void 0,
|
|
165
|
+
/** Its IDs in the order they were added, each made as text as it's reached. */
|
|
166
|
+
*values() {
|
|
167
|
+
for (let ordinal = 0; ordinal < table.size; ordinal += 1) yield table.oidAt(ordinal);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
export { grownRoom, longer, oidSet, oidTable, oidTableBytes, oidTableMost };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gitError } from "../contracts/result.mjs";
|
|
2
2
|
import { BufferError, BufferMeter } from "../protocol/bytes/buffers.mjs";
|
|
3
3
|
import { DeltaError } from "../protocol/packs/delta.mjs";
|
|
4
|
-
import { oidBytes } from "../protocol/packs/idx.mjs";
|
|
4
|
+
import { oidBytes, writeOidBytes } from "../protocol/packs/idx.mjs";
|
|
5
5
|
import { PackIndexer } from "../protocol/packs/indexer.mjs";
|
|
6
6
|
import { PackError, PackTransportError, boundedSource, readEntryHeader, readPackFrom } from "../protocol/packs/reader.mjs";
|
|
7
7
|
import { stepEffect } from "../protocol/packs/step.mjs";
|
|
@@ -12,7 +12,7 @@ import { typeCodes } from "./index-files.mjs";
|
|
|
12
12
|
import { packFiles } from "./layout.mjs";
|
|
13
13
|
import { headerLimits, packIndexerLimits } from "./pack-reads.mjs";
|
|
14
14
|
import { locateAll, locateAllBytes, rangeRanks, readExactly } from "./pack-ranges.mjs";
|
|
15
|
-
import {
|
|
15
|
+
import { compareIdsFrom, idsBytes, orderByIdWithFanout } from "./raw-ids.mjs";
|
|
16
16
|
import * as Effect from "effect/Effect";
|
|
17
17
|
import * as Result from "effect/Result";
|
|
18
18
|
// src/storage/pack-order.ts
|
|
@@ -139,8 +139,10 @@ var SliceLinks = class SliceLinks {
|
|
|
139
139
|
}
|
|
140
140
|
/** One link of the object begun last: the 20 bytes of `bytes` from `at`. */
|
|
141
141
|
add = (bytes, at) => {
|
|
142
|
-
|
|
143
|
-
this.#
|
|
142
|
+
const to = this.size * 20;
|
|
143
|
+
if (this.#refused || to + 20 > this.#ids.length && !this.#fit(this.sources, this.size + 1)) return;
|
|
144
|
+
const ids = this.#ids;
|
|
145
|
+
for (let each = 0; each < 20; each += 1) ids[to + each] = bytes[at + each] ?? 0;
|
|
144
146
|
this.size += 1;
|
|
145
147
|
this.#starts[this.sources] = this.size;
|
|
146
148
|
};
|
|
@@ -189,6 +191,14 @@ var SliceLinks = class SliceLinks {
|
|
|
189
191
|
linksOf(at) {
|
|
190
192
|
return [this.#starts[at] ?? 0, this.#starts[at + 1] ?? 0];
|
|
191
193
|
}
|
|
194
|
+
/** Where the `at`th object's links start in `ids`. */
|
|
195
|
+
linkStart(at) {
|
|
196
|
+
return this.#starts[at] ?? 0;
|
|
197
|
+
}
|
|
198
|
+
/** Where the `at`th object's links end in `ids` (exclusive). */
|
|
199
|
+
linkEnd(at) {
|
|
200
|
+
return this.#starts[at + 1] ?? 0;
|
|
201
|
+
}
|
|
192
202
|
/** Whether the `at`th object's `link`th link may name an object the repo lacks. */
|
|
193
203
|
mayLack(at, link) {
|
|
194
204
|
return mayLack(this.#kinds[at] ?? 0, link);
|
|
@@ -247,7 +257,8 @@ const sliceEntries = /* @__PURE__ */ Effect.fnUntraced(function* (ranges, at, by
|
|
|
247
257
|
let first = Number.POSITIVE_INFINITY;
|
|
248
258
|
for (let rank = 0; rank < ranges.count; rank += rangeRanks) {
|
|
249
259
|
const chunk = yield* ranges.offsets(rank, Math.min(rangeRanks, ranges.count - rank));
|
|
250
|
-
for (
|
|
260
|
+
for (let each = 0; each < chunk.length; each += 1) {
|
|
261
|
+
const offset = chunk[each] ?? 0;
|
|
251
262
|
if (offset < at.offset) {
|
|
252
263
|
before += 1;
|
|
253
264
|
continue;
|
|
@@ -292,11 +303,14 @@ const sliceEntries = /* @__PURE__ */ Effect.fnUntraced(function* (ranges, at, by
|
|
|
292
303
|
const places = new Uint32Array(length);
|
|
293
304
|
for (let each = 0; each < length; each += 1) places[each] = placeOf(sorted, offsets[each] ?? 0);
|
|
294
305
|
const ids = yield* idsOf(ranges, ranks.subarray(0, length), places);
|
|
306
|
+
const end = Number.isFinite(next) ? next : ranges.pack.bytes - 20;
|
|
307
|
+
const ordered = orderByIdWithFanout(ids, length);
|
|
295
308
|
return {
|
|
296
309
|
offsets: sorted,
|
|
297
|
-
end
|
|
310
|
+
end,
|
|
298
311
|
ids,
|
|
299
|
-
byId:
|
|
312
|
+
byId: ordered.order,
|
|
313
|
+
fanout: ordered.fanout,
|
|
300
314
|
held: capacity * 104
|
|
301
315
|
};
|
|
302
316
|
});
|
|
@@ -330,14 +344,19 @@ const idsOf = /* @__PURE__ */ Effect.fnUntraced(function* (ranges, ranks, places
|
|
|
330
344
|
}
|
|
331
345
|
return ids;
|
|
332
346
|
});
|
|
333
|
-
/** The entry of the slice whose ID is `id`'s 20 bytes, by
|
|
347
|
+
/** The entry of the slice whose ID is `id`'s 20 bytes, narrowed by its 12-bit prefix fanout, or -1. */
|
|
334
348
|
const entryById = (entries, id) => {
|
|
335
|
-
|
|
336
|
-
|
|
349
|
+
const b0 = id[0] ?? 0;
|
|
350
|
+
const b1 = id[1] ?? 0;
|
|
351
|
+
const bucket = b0 << 4 | b1 >>> 4;
|
|
352
|
+
let low = entries.fanout[bucket] ?? 0;
|
|
353
|
+
let high = entries.fanout[bucket + 1] ?? entries.byId.length;
|
|
337
354
|
while (low < high) {
|
|
338
355
|
const middle = low + high >>> 1;
|
|
339
356
|
const each = entries.byId[middle] ?? 0;
|
|
340
|
-
const
|
|
357
|
+
const off = each * 20;
|
|
358
|
+
const diff1 = (entries.ids[off + 1] ?? 0) - b1;
|
|
359
|
+
const compared = diff1 !== 0 ? diff1 : compareIdsFrom(entries.ids, off, id, 0, 2);
|
|
341
360
|
if (compared === 0) return each;
|
|
342
361
|
if (compared < 0) low = middle + 1;
|
|
343
362
|
else high = middle;
|
|
@@ -565,18 +584,26 @@ const sliceRead = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
565
584
|
asked = bytes;
|
|
566
585
|
return allot(held + asked);
|
|
567
586
|
};
|
|
568
|
-
const
|
|
587
|
+
const holdingMoreStep = (bytes) => {
|
|
569
588
|
held += bytes;
|
|
570
|
-
return
|
|
589
|
+
return holding(asked);
|
|
571
590
|
};
|
|
591
|
+
const holdingMore = (bytes) => stepEffect(holdingMoreStep(bytes));
|
|
572
592
|
const known = new Uint8Array(entries.offsets.length).fill(unknown);
|
|
573
593
|
const last = entries.offsets.length - 1;
|
|
574
|
-
const
|
|
594
|
+
const lookupId = /* @__PURE__ */ new Uint8Array(20);
|
|
595
|
+
const withinOf = (oid) => {
|
|
596
|
+
writeOidBytes(oid, lookupId, 0);
|
|
597
|
+
return entryById(entries, lookupId);
|
|
598
|
+
};
|
|
575
599
|
const outside = outsideBases(bucket, ranges, withinOf, holdingMore, {
|
|
576
600
|
before: at.position,
|
|
577
601
|
types: input.storedTypes
|
|
578
602
|
});
|
|
603
|
+
let cachedBaseOid;
|
|
604
|
+
let cachedBaseOffset = 0;
|
|
579
605
|
const offsetOf = (oid) => {
|
|
606
|
+
if (oid === cachedBaseOid) return cachedBaseOffset;
|
|
580
607
|
const within = withinOf(oid);
|
|
581
608
|
return within >= 0 ? entries.offsets[within] ?? 0 : outside.offsetOf(oid);
|
|
582
609
|
};
|
|
@@ -595,18 +622,22 @@ const sliceRead = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
595
622
|
};
|
|
596
623
|
let read = 0;
|
|
597
624
|
let skipped = 0;
|
|
598
|
-
const
|
|
599
|
-
|
|
600
|
-
const resolved = yield* stepEffect(indexer.settle()).pipe(Effect.mapError((error) => error instanceof DeltaError ? lost(`Pack ${pack.id}'s delta at ${entry.offset} won't apply: ${error.message}`) : error));
|
|
601
|
-
if (resolved.kind === "unindexable") return yield* Effect.fail(lost(`Pack ${pack.id}'s entry at ${entry.offset} won't resolve: ${resolved.why}`));
|
|
625
|
+
const finishSettled = (entry, within, target, resolved) => {
|
|
626
|
+
if (resolved.kind === "unindexable") return Effect.fail(lost(`Pack ${pack.id}'s entry at ${entry.offset} won't resolve: ${resolved.why}`));
|
|
602
627
|
const { kind, bytes } = resolved.object;
|
|
603
628
|
known[within] = typeCodes[kind];
|
|
604
|
-
if (kind === "blob") return;
|
|
629
|
+
if (kind === "blob") return void 0;
|
|
605
630
|
target.begin(ranges.base + entry.index, kind);
|
|
606
631
|
const malformed = rawLinks(kind, bytes, target.add);
|
|
607
|
-
if (malformed !== void 0) return
|
|
608
|
-
if (target.refused) return
|
|
609
|
-
}
|
|
632
|
+
if (malformed !== void 0) return Effect.fail(lost(`Pack ${pack.id}'s ${kind} at ${entry.offset} is malformed: ${malformed}`));
|
|
633
|
+
if (target.refused) return Effect.fail(linksPastMemory());
|
|
634
|
+
};
|
|
635
|
+
const settled = (entry, within, target) => {
|
|
636
|
+
read += 1;
|
|
637
|
+
const resolved = indexer.settle();
|
|
638
|
+
if (!Effect.isEffect(resolved)) return finishSettled(entry, within, target, resolved);
|
|
639
|
+
return Effect.flatMap(Effect.mapError(resolved, (error) => error instanceof DeltaError ? lost(`Pack ${pack.id}'s delta at ${entry.offset} won't apply: ${error.message}`) : error), (done) => finishSettled(entry, within, target, done) ?? Effect.void);
|
|
640
|
+
};
|
|
610
641
|
let current = 0;
|
|
611
642
|
let spentMost;
|
|
612
643
|
let skip = false;
|
|
@@ -619,11 +650,17 @@ const sliceRead = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
619
650
|
if (entry.base?.kind !== "oid") return Effect.fail(lost(`Pack ${pack.id}'s entry at ${entry.offset} is an offset delta, which no stored pack holds`));
|
|
620
651
|
const oid = entry.base.oid;
|
|
621
652
|
const within = withinOf(oid);
|
|
622
|
-
if (within < 0 || within < current && known[within] === unknown) return {
|
|
653
|
+
if (within < 0 || within < current && known[within] === unknown) return {
|
|
654
|
+
base: oid,
|
|
655
|
+
inSlice: within
|
|
656
|
+
};
|
|
623
657
|
baseAt(entry.index, at.position + within);
|
|
658
|
+
cachedBaseOid = oid;
|
|
659
|
+
cachedBaseOffset = entries.offsets[within] ?? 0;
|
|
624
660
|
return { type: within < current ? known[within] ?? unknown : unknown };
|
|
625
661
|
};
|
|
626
662
|
const sink = {
|
|
663
|
+
crc32: false,
|
|
627
664
|
begin: () => Effect.void,
|
|
628
665
|
entry: (entry) => {
|
|
629
666
|
current = entry.index - at.position;
|
|
@@ -636,12 +673,14 @@ const sliceRead = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
636
673
|
deferring = {
|
|
637
674
|
entry,
|
|
638
675
|
oid: typed.base,
|
|
676
|
+
inSlice: typed.inSlice,
|
|
639
677
|
within: current,
|
|
640
678
|
pieces: keeps ? [] : void 0
|
|
641
679
|
};
|
|
642
680
|
const bytes = deferredEntryBytes + (keeps ? entry.size : 0);
|
|
643
681
|
deferredBytes += bytes;
|
|
644
|
-
|
|
682
|
+
const step = holdingMoreStep(bytes);
|
|
683
|
+
return Effect.isEffect(step) ? step : void 0;
|
|
645
684
|
}
|
|
646
685
|
skip = typed.type === typeCodes.blob;
|
|
647
686
|
if (skip) return void 0;
|
|
@@ -658,18 +697,26 @@ const sliceRead = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
658
697
|
if (deferring === void 0) indexer.data(bytes);
|
|
659
698
|
else deferring.pieces?.push(bytes.slice());
|
|
660
699
|
},
|
|
661
|
-
entryEnd:
|
|
662
|
-
|
|
663
|
-
|
|
700
|
+
entryEnd: (ended) => {
|
|
701
|
+
const active = deferring;
|
|
702
|
+
const within = current;
|
|
664
703
|
deferring = void 0;
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
704
|
+
const pauseAfter = () => {
|
|
705
|
+
const full = deferred.length >= 16384 || deferredBytes >= 16777216;
|
|
706
|
+
return within === last || full || links.size >= input.bounds.links ? "pause" : void 0;
|
|
707
|
+
};
|
|
708
|
+
if (active !== void 0) {
|
|
709
|
+
deferred.push(active);
|
|
710
|
+
return pauseAfter();
|
|
711
|
+
}
|
|
712
|
+
const done = settled(ended, within, links);
|
|
713
|
+
return done === void 0 ? pauseAfter() : Effect.map(done, pauseAfter);
|
|
714
|
+
}
|
|
668
715
|
};
|
|
669
|
-
const reading = yield* Effect.uninterruptibleMask((restore) => Effect.flatMap(
|
|
716
|
+
const reading = yield* Effect.uninterruptibleMask((restore) => Effect.flatMap(refusedIfSpent(bucketStream(bucket, packFiles(pack.id).pack, {
|
|
670
717
|
offset: at.offset,
|
|
671
718
|
length: entries.end - at.offset
|
|
672
|
-
}))
|
|
719
|
+
})), (body) => {
|
|
673
720
|
if (body === void 0) return Effect.fail(lost(`Pack ${pack.id} has no bytes`));
|
|
674
721
|
const source = boundedSource(body, /* @__PURE__ */ new Uint8Array(0), new BufferMeter(sliceReaderBytes));
|
|
675
722
|
return restore(cutAtSpent(readPackFrom(source, noHash, sink, headerLimits, new BufferMeter(sliceReaderBytes), {
|
|
@@ -702,24 +749,31 @@ const sliceRead = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
702
749
|
if (counted + later.size >= input.bounds.links) return links.positionOf(streamed) - ranges.base - at.position + 1;
|
|
703
750
|
}
|
|
704
751
|
};
|
|
705
|
-
const settleDeferred =
|
|
706
|
-
const { entry, within } = each;
|
|
707
|
-
const inSlice = withinOf(each.oid);
|
|
752
|
+
const settleDeferred = (each, types) => {
|
|
753
|
+
const { entry, within, inSlice } = each;
|
|
708
754
|
const base = inSlice >= 0 ? {
|
|
709
755
|
offset: entries.offsets[inSlice] ?? 0,
|
|
710
756
|
position: at.position + inSlice
|
|
711
757
|
} : outside.placeOf(each.oid);
|
|
712
|
-
if (base === void 0) return
|
|
758
|
+
if (base === void 0) return Effect.fail(lost(`Pack ${pack.id}'s delta at ${entry.offset} names ${each.oid}, which the pack lacks`));
|
|
713
759
|
baseAt(entry.index, base.position);
|
|
714
760
|
if ((inSlice >= 0 ? inSlice < within ? known[inSlice] ?? unknown : unknown : types.get(each.oid) ?? unknown) === typeCodes.blob) {
|
|
715
761
|
known[within] = typeCodes.blob;
|
|
716
762
|
skipped += 1;
|
|
717
763
|
return;
|
|
718
764
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
765
|
+
cachedBaseOid = each.oid;
|
|
766
|
+
cachedBaseOffset = base.offset;
|
|
767
|
+
const began = indexer.entry(entry);
|
|
768
|
+
if (!Effect.isEffect(began)) {
|
|
769
|
+
for (const piece of each.pieces ?? []) indexer.data(piece);
|
|
770
|
+
return settled(entry, within, later);
|
|
771
|
+
}
|
|
772
|
+
return Effect.flatMap(began, () => {
|
|
773
|
+
for (const piece of each.pieces ?? []) indexer.data(piece);
|
|
774
|
+
return settled(entry, within, later) ?? Effect.void;
|
|
775
|
+
});
|
|
776
|
+
};
|
|
723
777
|
const types = /* @__PURE__ */ new Map();
|
|
724
778
|
let size = input.calls === void 0 ? deferred.length : 16;
|
|
725
779
|
let perBaseLast = 0;
|
|
@@ -727,7 +781,7 @@ const sliceRead = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
727
781
|
if (from > 0) size = nextChunk(input.calls, perBaseLast, size, deferred.length - from);
|
|
728
782
|
const made = input.calls?.made() ?? 0;
|
|
729
783
|
const chunk = deferred.slice(from, from + size);
|
|
730
|
-
const named = idsBytes(chunk.flatMap((each) =>
|
|
784
|
+
const named = idsBytes(chunk.flatMap((each) => each.inSlice < 0 && !types.has(each.oid) ? [each.oid] : []));
|
|
731
785
|
const found = yield* Effect.result(cutAtSpent(outside.find(named.sorted, named.bytes)));
|
|
732
786
|
if (Result.isFailure(found)) {
|
|
733
787
|
spentMost = spentOf(found.failure)?.most;
|
|
@@ -744,12 +798,15 @@ const sliceRead = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
744
798
|
const { within } = each;
|
|
745
799
|
cut = cutBefore(within);
|
|
746
800
|
if (cut !== void 0) break chunks;
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
749
|
-
|
|
750
|
-
if (
|
|
751
|
-
|
|
752
|
-
|
|
801
|
+
const step = settleDeferred(each, types);
|
|
802
|
+
if (step !== void 0) {
|
|
803
|
+
const done = yield* Effect.result(cutAtSpent(step));
|
|
804
|
+
if (Result.isFailure(done)) {
|
|
805
|
+
spentMost = spentOf(done.failure)?.most;
|
|
806
|
+
if (spentMost === void 0) return yield* Effect.fail(done.failure);
|
|
807
|
+
cut = within;
|
|
808
|
+
break chunks;
|
|
809
|
+
}
|
|
753
810
|
}
|
|
754
811
|
each.pieces = void 0;
|
|
755
812
|
if (counted + later.size >= input.bounds.links) {
|
|
@@ -4,11 +4,10 @@ import { indexHeadBytes, indexMagic, smallMost, tablesOf } from "../protocol/pac
|
|
|
4
4
|
import { reverseHeader } from "../protocol/packs/rev.mjs";
|
|
5
5
|
import { checkPositionsHeader, positionAt } from "../protocol/packs/pos.mjs";
|
|
6
6
|
import { packFiles } from "./layout.mjs";
|
|
7
|
-
import { bucketDo, readWhole } from "./calls.mjs";
|
|
7
|
+
import { bucketDo, readEach, readWhole } from "./calls.mjs";
|
|
8
8
|
import { compareIds } from "./raw-ids.mjs";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
10
|
import * as Predicate from "effect/Predicate";
|
|
11
|
-
import * as Stream from "effect/Stream";
|
|
12
11
|
// src/storage/pack-ranges.ts
|
|
13
12
|
/**
|
|
14
13
|
* A listed pack's `.idx` and `.pos`, read by range: their headers and the fanout once, then its
|
|
@@ -89,8 +88,7 @@ const openIndexRanges = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, pac
|
|
|
89
88
|
* as `openIndexRanges` opens it, and the `.pos`'s header checked against its count.
|
|
90
89
|
*/
|
|
91
90
|
const openRanges = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, pack, objects, base) {
|
|
92
|
-
const index = yield* openIndexRanges(bucket, pack, objects);
|
|
93
|
-
const positions = yield* openPositions(bucket, pack, index.count);
|
|
91
|
+
const [index, positions] = yield* Effect.all([openIndexRanges(bucket, pack, objects), openPositions(bucket, pack, objects)], { concurrency: "unbounded" });
|
|
94
92
|
return {
|
|
95
93
|
...index,
|
|
96
94
|
base,
|
|
@@ -169,17 +167,29 @@ const heldOrRanges = (ranges, held) => {
|
|
|
169
167
|
crcs: (rank, length) => loaded().crcs(rank, length)
|
|
170
168
|
};
|
|
171
169
|
};
|
|
172
|
-
/** `
|
|
173
|
-
const
|
|
170
|
+
/** `PlacedTables` whose `.rev` header has passed `checkReverseHeader`. */
|
|
171
|
+
const checkedTables = /* @__PURE__ */ new WeakSet();
|
|
172
|
+
/** `pack`'s `.rev` header check alone, 1 get. */
|
|
173
|
+
const checkReverseHeader = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, pack) {
|
|
174
174
|
const key = packFiles(pack.id).rev;
|
|
175
175
|
const head = yield* readExactly(bucket, key, 0, 12);
|
|
176
176
|
if (reverseHeader().some((byte, at) => head[at] !== byte)) return yield* Effect.fail(lost(`${key} doesn't start as a version 1 reverse index`));
|
|
177
|
-
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* `pack`'s tables for `placedEntries`: its first read checks `.rev`'s header alongside the first
|
|
180
|
+
* `.rev` spans, and later reads reuse that proof without re-reading the header.
|
|
181
|
+
*/
|
|
182
|
+
const placedTablesOf = (bucket, pack, count) => {
|
|
183
|
+
const tables = {
|
|
178
184
|
bucket,
|
|
179
185
|
pack,
|
|
180
|
-
count
|
|
186
|
+
count,
|
|
187
|
+
get headerChecked() {
|
|
188
|
+
return checkedTables.has(tables);
|
|
189
|
+
}
|
|
181
190
|
};
|
|
182
|
-
|
|
191
|
+
return tables;
|
|
192
|
+
};
|
|
183
193
|
/**
|
|
184
194
|
* Rows `rows[from..to)`, ascending and distinct, of a table of `width`-byte rows at `start` in
|
|
185
195
|
* `key`, read as one span from the first to the last and streamed: each handed to `each` with its
|
|
@@ -196,10 +206,10 @@ const spanRows = (bucket, key, table, rows, [from, to], each) => {
|
|
|
196
206
|
let carried = 0;
|
|
197
207
|
let seen = 0;
|
|
198
208
|
let slot = from;
|
|
199
|
-
return bucket
|
|
209
|
+
return readEach(bucket, key, {
|
|
200
210
|
offset,
|
|
201
211
|
length
|
|
202
|
-
}
|
|
212
|
+
}, (chunk) => Effect.sync(() => {
|
|
203
213
|
let at = 0;
|
|
204
214
|
if (carried > 0) {
|
|
205
215
|
at = Math.min(width - carried, chunk.byteLength);
|
|
@@ -222,7 +232,7 @@ const spanRows = (bucket, key, table, rows, [from, to], each) => {
|
|
|
222
232
|
each(slot, chunk, rowAt);
|
|
223
233
|
}
|
|
224
234
|
seen += chunk.byteLength;
|
|
225
|
-
}))
|
|
235
|
+
})).pipe(Effect.catchIf((error) => Predicate.isTagged(error, "NotFound"), () => Effect.void), Effect.andThen(() => seen === length && slot === to ? Effect.void : Effect.fail(lost(`${key} is missing its bytes from ${offset}`))));
|
|
226
236
|
}));
|
|
227
237
|
};
|
|
228
238
|
/**
|
|
@@ -311,8 +321,18 @@ const placedEntries = /* @__PURE__ */ Effect.fnUntraced(function* (tables, place
|
|
|
311
321
|
start: 12,
|
|
312
322
|
width: 4
|
|
313
323
|
};
|
|
314
|
-
|
|
324
|
+
const revReads = spanRuns(read).map((span) => spanRows(bucket, files.rev, reverse, read, span, (slot, bytes, at) => {
|
|
315
325
|
ranks[slot] = uint32(bytes, at);
|
|
326
|
+
}));
|
|
327
|
+
if (!checkedTables.has(tables)) {
|
|
328
|
+
yield* Effect.all([checkReverseHeader(bucket, pack), ...revReads], {
|
|
329
|
+
concurrency: 16,
|
|
330
|
+
discard: true
|
|
331
|
+
});
|
|
332
|
+
checkedTables.add(tables);
|
|
333
|
+
} else yield* Effect.all(revReads, {
|
|
334
|
+
concurrency: 16,
|
|
335
|
+
discard: true
|
|
316
336
|
});
|
|
317
337
|
const named = ranks.find((rank) => rank >= count);
|
|
318
338
|
if (named !== void 0) return yield* Effect.fail(lost(`${files.rev} names rank ${named}`));
|
|
@@ -337,7 +357,10 @@ const placedEntries = /* @__PURE__ */ Effect.fnUntraced(function* (tables, place
|
|
|
337
357
|
const ownerOf = (slot) => owners[order[slot] ?? 0] ?? -1;
|
|
338
358
|
const larges = new Uint32Array(read.length);
|
|
339
359
|
const largeAt = new Uint32Array(read.length);
|
|
340
|
-
|
|
360
|
+
const rankSpans = spanRuns(sortedRanks);
|
|
361
|
+
const spansAtOnce = Math.max(1, Math.floor(16 / 3));
|
|
362
|
+
yield* Effect.forEach(rankSpans, Effect.fnUntraced(function* (span) {
|
|
363
|
+
const [spanFrom] = span;
|
|
341
364
|
let largeCount = 0;
|
|
342
365
|
yield* Effect.all([
|
|
343
366
|
spanRows(bucket, files.idx, {
|
|
@@ -361,7 +384,7 @@ const placedEntries = /* @__PURE__ */ Effect.fnUntraced(function* (tables, place
|
|
|
361
384
|
const small = uint32(bytes, from);
|
|
362
385
|
offsetsRead[order[slot] ?? 0] = small;
|
|
363
386
|
if ((small & 2147483648) !== 0) {
|
|
364
|
-
larges[largeCount] = slot;
|
|
387
|
+
larges[spanFrom + largeCount] = slot;
|
|
365
388
|
largeCount += 1;
|
|
366
389
|
}
|
|
367
390
|
})
|
|
@@ -369,9 +392,10 @@ const placedEntries = /* @__PURE__ */ Effect.fnUntraced(function* (tables, place
|
|
|
369
392
|
concurrency: "unbounded",
|
|
370
393
|
discard: true
|
|
371
394
|
});
|
|
372
|
-
if (largeCount === 0)
|
|
373
|
-
const
|
|
374
|
-
|
|
395
|
+
if (largeCount === 0) return;
|
|
396
|
+
const spanLarges = larges.subarray(spanFrom, spanFrom + largeCount);
|
|
397
|
+
const large = largeAt.subarray(spanFrom, spanFrom + largeCount);
|
|
398
|
+
for (let at = 0; at < largeCount; at += 1) large[at] = (offsetsRead[order[spanLarges[at] ?? 0] ?? 0] ?? 0) & smallMost;
|
|
375
399
|
if (large.some((index, slot) => slot > 0 && index <= (large[slot - 1] ?? 0))) return yield* Effect.fail(lost(`Pack ${pack.id}'s large offsets aren't in rank order`));
|
|
376
400
|
const end = (large.at(-1) ?? 0) + 1;
|
|
377
401
|
if (end > count) return yield* Effect.fail(lost(`Pack ${pack.id}'s offsets name large offset ${end - 1}`));
|
|
@@ -379,9 +403,12 @@ const placedEntries = /* @__PURE__ */ Effect.fnUntraced(function* (tables, place
|
|
|
379
403
|
start: layout.large,
|
|
380
404
|
width: 8
|
|
381
405
|
}, large, [0, large.length], (slot, bytes, from) => {
|
|
382
|
-
offsetsRead[order[
|
|
406
|
+
offsetsRead[order[spanLarges[slot] ?? 0] ?? 0] = uint32(bytes, from) * 2 ** 32 + uint32(bytes, from + 4);
|
|
383
407
|
});
|
|
384
|
-
}
|
|
408
|
+
}), {
|
|
409
|
+
concurrency: spansAtOnce,
|
|
410
|
+
discard: true
|
|
411
|
+
});
|
|
385
412
|
for (let at = 0; at < read.length; at += 1) {
|
|
386
413
|
const owner = owners[at] ?? -1;
|
|
387
414
|
if (owner === -1) continue;
|
|
@@ -716,4 +743,4 @@ const placesOf = /* @__PURE__ */ Effect.fnUntraced(function* (ranges, ranks) {
|
|
|
716
743
|
positions
|
|
717
744
|
};
|
|
718
745
|
});
|
|
719
|
-
export { heldOrRanges, idsStartingWith, indexedRanges, locateAll, locateAllBytes, openIndexRanges,
|
|
746
|
+
export { heldOrRanges, idsStartingWith, indexedRanges, locateAll, locateAllBytes, openIndexRanges, openPositions, openRanges, placedEntries, placedEntriesBytes, placedEntriesGets, placedTablesOf, placedWindowBytes, rangeRanks, rankAlike, rankOf, ranksAll, ranksAllReads, ranksForward, readExactly, searchReads };
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import "../contracts/objects.mjs";
|
|
2
2
|
import "../contracts/ids.mjs";
|
|
3
3
|
import "../contracts/result.mjs";
|
|
4
|
-
import "../contracts/services.mjs";
|
|
5
4
|
import "../contracts/store.mjs";
|
|
6
5
|
import "../protocol/packs/idx.mjs";
|
|
7
6
|
import "../protocol/packs/rev.mjs";
|
|
8
7
|
import "../protocol/packs/indexer.mjs";
|
|
9
8
|
import "../protocol/packs/step.mjs";
|
|
10
9
|
import "../protocol/packs/reader.mjs";
|
|
10
|
+
import "./fetch-row-cache.mjs";
|
|
11
|
+
import "./index-whole.mjs";
|
|
11
12
|
import "./layout.mjs";
|
|
12
13
|
import "./pack-ranges.mjs";
|
|
13
14
|
import "./object-rows.mjs";
|
|
14
|
-
import "
|
|
15
|
-
import "
|
|
15
|
+
import "./receive-cache.mjs";
|
|
16
|
+
import "./plan-columns.mjs";
|
|
17
|
+
import "@ref0/infra";
|
|
18
|
+
import "effect/Effect";
|