@ref0/git 0.6.0 → 0.8.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/namespace.d.mts +2 -0
- package/dist/access/private-refs.d.mts +6 -29
- package/dist/access/private-refs.mjs +26 -13
- package/dist/access/public.d.mts +6 -0
- package/dist/access/public.mjs +9 -0
- package/dist/auth/access-jwt.d.mts +10 -6
- package/dist/auth/access-jwt.mjs +59 -40
- package/dist/auth/auth-namespace.d.mts +6 -0
- package/dist/auth/auth-namespace.mjs +12 -0
- package/dist/auth/auth.d.mts +3 -6
- package/dist/auth/auth.mjs +2 -9
- package/dist/auth/authorize.mjs +35 -29
- package/dist/auth/bridge.mjs +8 -8
- package/dist/auth/fences.d.mts +1 -2
- package/dist/auth/fences.mjs +1 -1
- package/dist/auth/grants.d.mts +0 -1
- package/dist/auth/grants.mjs +2 -2
- package/dist/auth/host-function.d.mts +1 -7
- package/dist/auth/host-function.mjs +51 -42
- package/dist/auth/identify.d.mts +0 -1
- package/dist/auth/identify.mjs +3 -2
- package/dist/auth/namespaces.d.mts +2 -2
- package/dist/auth/policy.d.mts +7 -4
- package/dist/auth/policy.mjs +13 -10
- package/dist/auth/token-rows.mjs +3 -6
- package/dist/auth/tokens-layer.d.mts +40 -0
- package/dist/auth/tokens-layer.mjs +29 -0
- package/dist/auth/tokens-namespace.d.mts +2 -0
- package/dist/auth/tokens-public.d.mts +6 -0
- package/dist/auth/tokens-public.mjs +31 -0
- package/dist/auth/tokens.d.mts +19 -7
- package/dist/auth/tokens.mjs +12 -6
- package/dist/auth.d.mts +2 -2
- package/dist/auth.mjs +2 -2
- package/dist/client/client.d.mts +22 -15
- package/dist/client/client.mjs +31 -27
- package/dist/client/git-http.mjs +23 -6
- package/dist/client/local.mjs +5 -4
- package/dist/client/namespace.d.mts +2 -0
- package/dist/client/push-upload.d.mts +1 -0
- package/dist/client/push-upload.mjs +169 -2
- package/dist/client/remote-helper.mjs +5 -12
- package/dist/client/remote.mjs +63 -22
- package/dist/client/run-remote-helper.d.mts +1 -1
- package/dist/client/run-remote-helper.mjs +6 -6
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +26 -19
- package/dist/contracts/access.d.mts +18 -10
- package/dist/contracts/access.mjs +17 -0
- package/dist/contracts/actors.d.mts +73 -28
- package/dist/contracts/actors.mjs +45 -2
- package/dist/contracts/authorize.d.mts +26 -17
- package/dist/contracts/blobs.d.mts +1 -1
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/callers.mjs +40 -0
- package/dist/contracts/calls-spent.d.mts +6 -4
- package/dist/contracts/calls-spent.mjs +10 -8
- package/dist/contracts/client.d.mts +16 -9
- package/dist/contracts/commits.d.mts +2 -2
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +1 -1
- package/dist/contracts/events.d.mts +45 -32
- package/dist/contracts/events.mjs +21 -10
- package/dist/contracts/files.d.mts +44 -44
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +34 -58
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-events.d.mts +50 -0
- package/dist/contracts/git-events.mjs +23 -0
- package/dist/contracts/git-hooks.d.mts +254 -0
- package/dist/contracts/git-hooks.mjs +12 -0
- package/dist/contracts/git.d.mts +93 -42
- package/dist/contracts/git.mjs +6 -5
- package/dist/contracts/grants.d.mts +46 -27
- package/dist/contracts/ids.d.mts +16 -0
- package/dist/contracts/ids.mjs +19 -4
- package/dist/contracts/lfs.d.mts +19 -4
- package/dist/contracts/merges.d.mts +7 -7
- package/dist/contracts/namespaces.d.mts +2 -2
- package/dist/contracts/objects.d.mts +21 -5
- package/dist/contracts/opaque.mjs +27 -0
- package/dist/contracts/operations.d.mts +301 -101
- package/dist/contracts/operations.mjs +209 -0
- package/dist/contracts/promises.d.mts +2 -0
- package/dist/contracts/push-uploads.d.mts +4 -1
- package/dist/contracts/push-uploads.mjs +9 -4
- package/dist/contracts/queue.d.mts +220 -49
- package/dist/contracts/queue.mjs +68 -6
- package/dist/contracts/refs.d.mts +30 -8
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +53 -23
- package/dist/contracts/remote.mjs +22 -0
- package/dist/contracts/repo-records.d.mts +2 -2
- package/dist/contracts/repos.d.mts +100 -82
- package/dist/contracts/repos.mjs +47 -8
- package/dist/contracts/result.d.mts +73 -41
- package/dist/contracts/result.mjs +74 -17
- package/dist/contracts/rules.d.mts +734 -68
- package/dist/contracts/rules.mjs +84 -1
- package/dist/contracts/server.d.mts +20 -206
- package/dist/contracts/services.d.mts +1 -10
- package/dist/contracts/services.mjs +1 -5
- package/dist/contracts/signin.d.mts +140 -43
- package/dist/contracts/signin.mjs +36 -3
- package/dist/contracts/store.d.mts +1 -1
- package/dist/contracts/sync.d.mts +109 -90
- package/dist/contracts/sync.mjs +34 -7
- package/dist/contracts/tags.d.mts +1 -1
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/tokens.d.mts +247 -60
- package/dist/contracts/tokens.mjs +93 -21
- package/dist/contracts/topics.d.mts +59 -20
- package/dist/contracts/topics.mjs +14 -5
- package/dist/contracts/trees.d.mts +2 -2
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +2 -2
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +10 -12
- package/dist/core/access.mjs +45 -11
- package/dist/core/clock.mjs +1 -1
- package/dist/core/events/deliver.d.mts +3 -2
- package/dist/core/events/deliver.mjs +188 -92
- package/dist/core/forks.mjs +78 -34
- package/dist/core/hooks/groups.d.mts +26 -0
- package/dist/core/hooks/groups.mjs +73 -0
- package/dist/core/hooks/namespace.d.mts +2 -0
- package/dist/core/hooks/order.d.mts +2 -2
- package/dist/core/hooks/order.mjs +6 -6
- package/dist/core/hooks/public.d.mts +7 -0
- package/dist/core/hooks/public.mjs +5 -0
- package/dist/core/imports.mjs +94 -10
- package/dist/core/index-job.mjs +11 -8
- package/dist/core/loose-tally.mjs +46 -0
- package/dist/core/merge-parts.d.mts +1 -1
- package/dist/core/merge-parts.mjs +1 -1
- package/dist/core/mirror-rows.mjs +18 -0
- package/dist/core/names.mjs +1 -1
- package/dist/core/namespaces.d.mts +2 -1
- package/dist/core/objects/commit-writes.mjs +5 -5
- package/dist/core/objects/merges.mjs +1 -1
- package/dist/core/objects/objects-layer.mjs +1 -1
- package/dist/core/objects/reading.mjs +52 -7
- package/dist/core/objects/tree-edits.mjs +13 -28
- package/dist/core/objects/trees.mjs +4 -4
- package/dist/core/objects/writing.mjs +4 -3
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +22 -3
- package/dist/core/parts.mjs +5 -3
- package/dist/core/promise.mjs +23 -17
- package/dist/core/purge.d.mts +2 -2
- package/dist/core/purge.mjs +89 -34
- package/dist/core/push.mjs +67 -79
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +28 -4
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +16 -8
- package/dist/core/refs.mjs +41 -10
- package/dist/core/registered-records.mjs +30 -0
- package/dist/core/{claim-rows.mjs → registered-rows.mjs} +6 -6
- package/dist/core/repack.d.mts +2 -2
- package/dist/core/repack.mjs +30 -23
- package/dist/core/repo-info.mjs +62 -26
- package/dist/core/repos.mjs +18 -11
- package/dist/core/rules/changes.mjs +2 -2
- package/dist/core/rules/check.mjs +10 -10
- package/dist/core/rules/commit-changes.mjs +1 -1
- package/dist/core/rules/context.d.mts +7 -6
- package/dist/core/rules/context.mjs +18 -16
- package/dist/core/rules/fetch.mjs +78 -31
- package/dist/core/saved-caller-views.d.mts +72 -0
- package/dist/core/saved-caller-views.mjs +123 -0
- package/dist/core/saved-callers-public.d.mts +5 -0
- package/dist/core/saved-callers-public.mjs +10 -0
- package/dist/core/saved-callers.mjs +95 -0
- package/dist/core/seam.d.mts +12 -1
- package/dist/core/seam.mjs +4 -2
- package/dist/core/tokens.mjs +7 -2
- package/dist/core/view.d.mts +1 -1
- package/dist/core/view.mjs +1 -1
- package/dist/core/work.mjs +6 -5
- package/dist/effect.d.mts +2 -4
- package/dist/effect.mjs +2 -4
- package/dist/engine/commits.mjs +19 -47
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/diff.mjs +2 -2
- package/dist/engine/failures.d.mts +1 -2
- package/dist/engine/failures.mjs +1 -3
- package/dist/engine/merge-base-walk.mjs +57 -142
- package/dist/engine/merge-bases.mjs +5 -5
- package/dist/engine/merge-renames.mjs +1 -1
- package/dist/engine/merge.mjs +16 -14
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +1 -1
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +2 -2
- package/dist/event-streams/event-streams.d.mts +6 -2
- package/dist/event-streams/event-streams.mjs +6 -2
- package/dist/event-streams/stream.mjs +5 -2
- package/dist/extend.d.mts +2 -3
- package/dist/extend.mjs +2 -2
- package/dist/http/answers.mjs +4 -3
- package/dist/http/core-parts.mjs +3 -4
- package/dist/http/handler.mjs +12 -32
- package/dist/http/parts.d.mts +1 -1
- package/dist/http/push-uploads.mjs +7 -5
- package/dist/http/receive-pack.mjs +3 -3
- package/dist/http/upload-pack.mjs +6 -5
- package/dist/index.d.mts +44 -24
- package/dist/index.mjs +17 -8
- package/dist/lfs/base.d.mts +8 -5
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/calls.mjs +3 -2
- package/dist/lfs/layer.d.mts +9 -7
- package/dist/lfs/layer.mjs +37 -22
- package/dist/lfs/locks.mjs +3 -3
- package/dist/lfs/objects.d.mts +3 -2
- package/dist/lfs/objects.mjs +235 -71
- package/dist/lfs/pointers.mjs +70 -19
- package/dist/lfs/purge.mjs +7 -3
- package/dist/lfs/rows.mjs +25 -8
- package/dist/lfs/service.d.mts +6 -3
- package/dist/lfs/service.mjs +8 -2
- package/dist/lfs/upkeep.mjs +53 -31
- package/dist/lfs/upload-most.mjs +41 -0
- package/dist/lfs/uploaded.mjs +59 -0
- package/dist/lfs/wire.mjs +1 -1
- 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/hmac-sha256.mjs +3 -6
- 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 +2 -2
- package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
- package/dist/protocol/bytes/text.mjs +6 -1
- package/dist/protocol/diff/read.d.mts +1 -1
- package/dist/protocol/diff/read.mjs +1 -1
- package/dist/protocol/diff/tree-diff.d.mts +1 -1
- package/dist/protocol/diff/tree-diff.mjs +11 -11
- package/dist/protocol/objects/fsck.mjs +6 -3
- package/dist/protocol/objects/lfs-pointer.mjs +6 -1
- package/dist/protocol/objects/tag.mjs +1 -1
- package/dist/protocol/objects/tree.mjs +1 -1
- 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 +2 -2
- 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 +4 -4
- package/dist/protocol/wire/advertisement.d.mts +1 -1
- package/dist/protocol/wire/advertisement.mjs +1 -1
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +1 -1
- package/dist/protocol/wire/lines.mjs +2 -2
- package/dist/protocol/wire/push-uploads.mjs +4 -2
- 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 +2 -2
- package/dist/protocol/wire/v2.mjs +2 -2
- package/dist/queue/advance.mjs +190 -68
- package/dist/queue/callers.mjs +56 -69
- package/dist/queue/calls.mjs +10 -11
- package/dist/queue/commit.mjs +28 -22
- package/dist/queue/host.d.mts +10 -11
- package/dist/queue/host.mjs +15 -7
- package/dist/queue/lanes.mjs +9 -18
- package/dist/queue/layer.d.mts +3 -3
- package/dist/queue/layer.mjs +11 -10
- package/dist/queue/limits.mjs +17 -5
- package/dist/queue/rows.mjs +13 -10
- package/dist/queue/schedule.mjs +7 -6
- package/dist/queue/search.mjs +11 -17
- package/dist/queue/state.mjs +7 -2
- package/dist/queue/trim.mjs +10 -5
- package/dist/rest/api.d.mts +1 -1
- package/dist/rest/blobs.d.mts +20 -20
- package/dist/rest/caller.d.mts +22 -20
- package/dist/rest/client-namespace.d.mts +2 -0
- package/dist/rest/client.d.mts +32 -8
- package/dist/rest/client.mjs +314 -388
- package/dist/rest/commits.d.mts +284 -284
- package/dist/rest/errors.d.mts +10 -10
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/events.d.mts +13 -11
- package/dist/rest/events.mjs +3 -1
- package/dist/rest/files.d.mts +48 -48
- package/dist/rest/forks.d.mts +131 -143
- package/dist/rest/handler.mjs +4 -3
- package/dist/rest/handlers.mjs +15 -8
- package/dist/rest/layer.d.mts +3 -3
- package/dist/rest/layer.mjs +8 -7
- package/dist/rest/listen.d.mts +8 -6
- package/dist/rest/listen.mjs +33 -77
- package/dist/rest/me.d.mts +18 -20
- package/dist/rest/me.mjs +1 -1
- package/dist/rest/merges.d.mts +17 -17
- package/dist/rest/queue.d.mts +140 -140
- package/dist/rest/queue.mjs +1 -1
- package/dist/rest/refs.d.mts +214 -214
- package/dist/rest/refs.mjs +1 -1
- package/dist/rest/repos.d.mts +123 -135
- package/dist/rest/tags.d.mts +30 -30
- package/dist/rest/tokens.d.mts +250 -260
- package/dist/rest/tokens.mjs +10 -42
- package/dist/rest/topics.d.mts +162 -162
- package/dist/rest/topics.mjs +1 -1
- package/dist/rest/trees.d.mts +117 -117
- package/dist/rest/wire.d.mts +7 -5
- package/dist/rest/wire.mjs +4 -3
- package/dist/rest/work.d.mts +69 -69
- package/dist/rest/work.mjs +1 -1
- package/dist/rest.d.mts +1 -7
- package/dist/rest.mjs +1 -5
- package/dist/server/check-fetch.mjs +9 -0
- package/dist/server/extension.mjs +3 -115
- package/dist/server/git-layer.d.mts +30 -5
- package/dist/server/git-layer.mjs +59 -29
- package/dist/server/git-namespace.d.mts +4 -4
- package/dist/server/git-namespace.mjs +6 -4
- package/dist/server/joined.d.mts +83 -0
- package/dist/server/joined.mjs +91 -0
- package/dist/server/registry.d.mts +7 -3
- package/dist/server/registry.mjs +135 -31
- package/dist/server/server.d.mts +9 -3
- package/dist/server/server.mjs +277 -208
- package/dist/signin/context.d.mts +2 -2
- package/dist/signin/context.mjs +28 -37
- package/dist/signin/device.mjs +5 -5
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -3
- package/dist/signin/grants.mjs +5 -5
- package/dist/signin/layer.d.mts +9 -0
- package/dist/signin/layer.mjs +41 -0
- package/dist/signin/namespace.d.mts +2 -0
- package/dist/signin/public.d.mts +6 -0
- package/dist/signin/public.mjs +5 -0
- package/dist/signin/route.mjs +47 -21
- package/dist/signin/web.mjs +3 -3
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/calls.d.mts +1 -1
- package/dist/storage/calls.mjs +4 -4
- package/dist/storage/clean-up.mjs +15 -6
- package/dist/storage/counted-bucket.mjs +34 -51
- package/dist/storage/fetch.mjs +1 -1
- package/dist/storage/fsck.mjs +12 -2
- package/dist/storage/graph-rebuild.mjs +262 -0
- package/dist/storage/host-bucket.mjs +1 -1
- package/dist/storage/index-build.d.mts +2 -2
- package/dist/storage/index-build.mjs +103 -15
- package/dist/storage/index-fetch.mjs +10 -6
- package/dist/storage/index-graph.mjs +1 -1
- package/dist/storage/index-layers.mjs +1 -1
- package/dist/storage/index-visible.mjs +1 -1
- package/dist/storage/lfs-pointers.d.mts +5 -5
- package/dist/storage/lfs-pointers.mjs +37 -11
- package/dist/storage/loose.mjs +4 -1
- package/dist/storage/memory-budget.mjs +8 -2
- package/dist/storage/merge-cut.mjs +24 -1
- package/dist/storage/merge-fence.mjs +82 -20
- package/dist/storage/merge-most.mjs +1 -0
- package/dist/storage/merge-plan.mjs +5 -2
- package/dist/storage/merge-row.mjs +17 -5
- package/dist/storage/merge-stream.mjs +25 -13
- package/dist/storage/merge-write.mjs +1 -1
- package/dist/storage/merge.d.mts +2 -2
- package/dist/storage/merge.mjs +1 -1
- package/dist/storage/object-rows.d.mts +2 -2
- package/dist/storage/object-rows.mjs +20 -4
- package/dist/storage/pack-ranges.d.mts +3 -1
- package/dist/storage/pack-ranges.mjs +168 -69
- package/dist/storage/pack-reads.mjs +4 -4
- package/dist/storage/pack-receive.d.mts +1 -1
- package/dist/storage/pack-receive.mjs +17 -15
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +103 -79
- package/dist/storage/placed-reads.mjs +81 -15
- package/dist/storage/prune-seen.mjs +126 -0
- package/dist/storage/prune-walk.mjs +87 -99
- package/dist/storage/prune.mjs +113 -50
- package/dist/storage/push-uploads.mjs +4 -2
- package/dist/storage/quarantine.d.mts +2 -2
- package/dist/storage/ready.d.mts +2 -2
- package/dist/storage/ready.mjs +15 -6
- 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 +2 -2
- package/dist/storage/receive-steps.mjs +1 -1
- package/dist/storage/repack-contained.mjs +24 -16
- package/dist/storage/repack-job.d.mts +2 -2
- package/dist/storage/repack-job.mjs +5 -4
- package/dist/storage/repack.d.mts +2 -2
- package/dist/storage/repack.mjs +12 -5
- 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 +15 -6
- package/dist/storage/send-list.mjs +6 -6
- package/dist/storage/single-flight.mjs +2 -2
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +8 -1
- package/dist/store/call-count.d.mts +24 -4
- package/dist/store/call-count.mjs +158 -44
- package/dist/store/catalogue.d.mts +1 -1
- package/dist/store/catalogue.mjs +2 -2
- package/dist/store/crossing.mjs +2 -6
- package/dist/store/cursor-seal.mjs +1 -1
- package/dist/store/errors.d.mts +7 -3
- package/dist/store/errors.mjs +41 -13
- package/dist/store/job-try.mjs +119 -15
- package/dist/store/list-job.mjs +5 -5
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +75 -16
- package/dist/store/promises.d.mts +2 -2
- package/dist/store/promises.mjs +31 -6
- package/dist/store/queue-jobs.mjs +1 -1
- package/dist/store/records.d.mts +2 -2
- package/dist/store/records.mjs +22 -24
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +6 -6
- package/dist/store/repo-record.mjs +29 -12
- package/dist/store/reservations.mjs +35 -8
- package/dist/store/scopes.mjs +12 -5
- package/dist/store/topic-jobs.mjs +8 -8
- package/dist/sync/bound.d.mts +1 -3
- package/dist/sync/bound.mjs +30 -42
- package/dist/sync/github.d.mts +5 -6
- package/dist/sync/github.mjs +37 -42
- package/dist/sync/http.mjs +15 -0
- package/dist/sync/import.mjs +30 -19
- package/dist/sync/layer.d.mts +13 -0
- package/dist/sync/layer.mjs +73 -0
- package/dist/sync/mirror.mjs +137 -58
- package/dist/sync/publish.mjs +3 -6
- package/dist/sync/step.mjs +223 -85
- package/dist/sync/tries.mjs +22 -15
- package/dist/sync.d.mts +3 -6
- package/dist/sync.mjs +3 -6
- package/dist/topics/advance.mjs +210 -94
- package/dist/topics/calls.mjs +8 -8
- package/dist/topics/directory.mjs +35 -12
- package/dist/topics/host.d.mts +5 -8
- package/dist/topics/host.mjs +42 -19
- package/dist/topics/layer.d.mts +381 -0
- package/dist/topics/layer.mjs +62 -0
- package/dist/topics/members.mjs +39 -10
- package/dist/topics/namespace.d.mts +2 -0
- package/dist/topics/public.d.mts +6 -0
- package/dist/topics/public.mjs +13 -0
- package/dist/topics/rows.mjs +12 -3
- package/dist/topics/topic.mjs +11 -10
- package/package.json +8 -13
- package/dist/access.d.mts +0 -2
- package/dist/access.mjs +0 -1
- package/dist/core/hooks/post-receive.mjs +0 -216
- package/dist/core/hooks/pre-receive.d.mts +0 -12
- package/dist/core/hooks/pre-receive.mjs +0 -36
- package/dist/engine/merge-base-walk.d.mts +0 -3
- package/dist/server/extension.d.mts +0 -21
- package/dist/server/routes.d.mts +0 -32
- package/dist/server/routes.mjs +0 -69
- package/dist/sync/import.d.mts +0 -10
- package/dist/sync/jobs.d.mts +0 -9
- package/dist/sync/jobs.mjs +0 -75
- package/dist/sync/mirror.d.mts +0 -13
- package/dist/sync/publish.d.mts +0 -6
- /package/dist/core/{claim-rows.d.mts → registered-rows.d.mts} +0 -0
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import { gitError } from "../contracts/result.mjs";
|
|
2
2
|
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
3
3
|
import { oidBytes } from "../protocol/packs/idx.mjs";
|
|
4
|
-
import { checkTypesHeader, typeAt, typeCode } from "../protocol/packs/types-file.mjs";
|
|
5
4
|
import { bestEffort } from "../store/errors.mjs";
|
|
6
5
|
import { randomText } from "../store/random.mjs";
|
|
7
6
|
import { readerFloors, readerMost } from "./budget.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { readWhole } from "./calls.mjs";
|
|
8
|
+
import { putOnce } from "./index-build.mjs";
|
|
9
|
+
import { runKey } from "./layout.mjs";
|
|
10
|
+
import { pruneSeenBytes, upkeepMemoryOf, upkeepRuns, upkeepTooLarge } from "./memory-budget.mjs";
|
|
12
11
|
import { blockBytes, blocksHeld, indexBytes, packReader } from "./pack-reads.mjs";
|
|
13
|
-
import {
|
|
12
|
+
import { SeenSaved, seenSet } from "./prune-seen.mjs";
|
|
13
|
+
import { StoredRuns, dedupeTableBytes, dropRuns, mergeHeld, mergeRuns, narrowed, narrowedCalls, runWriter, writerHeld } from "./runs.mjs";
|
|
14
14
|
import { countedReads } from "./walk.mjs";
|
|
15
|
-
import * as Schema from "effect/Schema";
|
|
16
15
|
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Schema from "effect/Schema";
|
|
17
17
|
import * as Data from "effect/Data";
|
|
18
18
|
// src/storage/prune-walk.ts
|
|
19
|
-
/**
|
|
20
|
-
* The most history objects, commits and tags, a prune pass's walk holds in its table: about
|
|
21
|
-
* 34 MB at `historySlotBytes` (maintenance-1m, invariant 2). A repo past it is refused by name.
|
|
22
|
-
*/
|
|
23
|
-
const pruneCommitsMost = 1e6;
|
|
24
19
|
/** The tree IDs a level reads at once, in pack order, at `fetchEntryBytes` each: about 9.2 MB. */
|
|
25
20
|
const pruneTreesAtOnce = 131072;
|
|
26
21
|
/** The bytes of a reached run, and of a frontier's. */
|
|
@@ -46,8 +41,6 @@ const frontierDedupe = {
|
|
|
46
41
|
},
|
|
47
42
|
hash: (bytes, at) => (bytes[at] ?? 0) << 24 | (bytes[at + 1] ?? 0) << 16 | (bytes[at + 2] ?? 0) << 8 | (bytes[at + 3] ?? 0)
|
|
48
43
|
};
|
|
49
|
-
/** The history table's bytes a slot: a 20-byte ID, at most 60% full, so about 34 B an object. */
|
|
50
|
-
const historySlotBytes = 20;
|
|
51
44
|
/** `a`'s runs and `b`'s, of one width, as one: `kind` names where a merge of them narrows. */
|
|
52
45
|
const joined = (a, b, kind = a.kind) => {
|
|
53
46
|
const { keys, lengths, rows } = b;
|
|
@@ -90,33 +83,31 @@ const pruneWalkSizes = (objects, blocks) => {
|
|
|
90
83
|
/** A walk's sizes at its bounds, the most any repo's take. */
|
|
91
84
|
const boundSizes = /* @__PURE__ */ pruneWalkSizes(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
|
|
92
85
|
/**
|
|
93
|
-
* What a walk at `sizes` holds besides its
|
|
86
|
+
* What a walk at `sizes` holds besides its seen set and its reader's: its trees, its
|
|
94
87
|
* writers and the frontier's dedupe table, and its merge. At the bounds unless given.
|
|
95
88
|
*/
|
|
96
89
|
const pruneWalkTables = (sizes = boundSizes) => sizes.trees * 70 + 2 * writerHeld(rowBytes, sizes.runBytes) + dedupeTableBytes(sizes.runBytes, rowBytes) + mergeHeld(rowBytes, sizes.runs);
|
|
97
|
-
/** The slots a history table for `count` objects is made with, so it's at most 60% full. */
|
|
98
|
-
const historySlots = (count) => Math.max(1, Math.ceil(count * 5 / 3));
|
|
99
90
|
/**
|
|
100
|
-
* What a walk
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* invariant 2).
|
|
91
|
+
* What a walk at `sizes` holds at its most besides its seen set, the IDs it starts from and its
|
|
92
|
+
* reader's indexes: its tables, and its reader's blocks and cache at their most. At the bounds
|
|
93
|
+
* unless given.
|
|
104
94
|
*/
|
|
105
|
-
const pruneWalkHeld = (
|
|
95
|
+
const pruneWalkHeld = (sizes = boundSizes) => pruneWalkTables(sizes) + sizes.blocks + readerMost.cache;
|
|
106
96
|
/** A save's count, checked as a row's is, so a bad one is refused at its decode. */
|
|
107
97
|
const Count = /* @__PURE__ */ Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
108
98
|
/** The ID a save's merge stopped at, likewise. */
|
|
109
99
|
const LastId = /* @__PURE__ */ Schema.String.check(Schema.isPattern(/^[0-9a-f]{40}$/));
|
|
110
100
|
/**
|
|
111
101
|
* Where a walk stopped, for its next try to go on from, as `PruneStarted.walk` holds it: in its
|
|
112
|
-
* history, the runs it has put, the IDs it has yet to read
|
|
113
|
-
* level, the runs reached so far and the next level's
|
|
114
|
-
* level after it. `refs` holds the `start` its first
|
|
102
|
+
* history, the runs it has put, the IDs it has yet to read, how many history objects it has seen
|
|
103
|
+
* and its seen set's object; or after a tree level, the runs reached so far and the next level's
|
|
104
|
+
* frontier, and with `at` partway through the level after it. `refs` holds the `start` its first
|
|
115
105
|
* try was given, which a later try walks from whatever the refs are then.
|
|
116
106
|
*/
|
|
117
107
|
const WalkSaved = /* @__PURE__ */ Schema.Union([Schema.Struct({
|
|
118
108
|
phase: Schema.Literal("history"),
|
|
119
109
|
count: Count,
|
|
110
|
+
seen: SeenSaved,
|
|
120
111
|
refs: StoredRuns,
|
|
121
112
|
reached: StoredRuns,
|
|
122
113
|
frontier: StoredRuns,
|
|
@@ -142,67 +133,30 @@ const fits = (calls, needs) => {
|
|
|
142
133
|
const made = calls.made();
|
|
143
134
|
return made.bucket + needs < calls.most.bucket && made.subrequests + needs < calls.most.subrequests;
|
|
144
135
|
};
|
|
145
|
-
/**
|
|
146
|
-
* A walk refused: its history past `pruneCommitsMost`, its charge past its allotment, or one step
|
|
147
|
-
* past a whole try's calls.
|
|
148
|
-
*/
|
|
136
|
+
/** A walk refused: its charge past its allotment, or one step past a whole try's calls. */
|
|
149
137
|
var PruneWalkTooLarge = class extends Data.TaggedError("PruneWalkTooLarge") {};
|
|
150
|
-
/** The all-zero ID, which names no object: a free slot's. */
|
|
151
|
-
const empty = /* @__PURE__ */ new Uint8Array(20);
|
|
152
|
-
/** Whether the 20-byte IDs at `a`'s `at` and `b`'s `bt` are one. */
|
|
153
|
-
const sameId = (a, at, b, bt) => {
|
|
154
|
-
for (let i = 0; i < 20; i += 1) if (a[at + i] !== b[bt + i]) return false;
|
|
155
|
-
return true;
|
|
156
|
-
};
|
|
157
138
|
/**
|
|
158
|
-
* The
|
|
159
|
-
*
|
|
139
|
+
* The bucket keys `saved` names: its runs, and in its history its seen set's object, so a pass
|
|
140
|
+
* that drops what its walks left can keep what its mark still reads.
|
|
160
141
|
*/
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return {
|
|
178
|
-
add,
|
|
179
|
-
size: () => size
|
|
180
|
-
};
|
|
142
|
+
const walkKeys = (saved) => {
|
|
143
|
+
const keys = (saved.phase === "history" ? [
|
|
144
|
+
saved.refs,
|
|
145
|
+
saved.reached,
|
|
146
|
+
saved.frontier,
|
|
147
|
+
saved.pending,
|
|
148
|
+
saved.known
|
|
149
|
+
] : [
|
|
150
|
+
saved.refs,
|
|
151
|
+
saved.reached,
|
|
152
|
+
saved.frontier,
|
|
153
|
+
saved.at?.reached,
|
|
154
|
+
saved.at?.frontier,
|
|
155
|
+
saved.at?.trees
|
|
156
|
+
]).flatMap((each) => each?.keys ?? []);
|
|
157
|
+
return saved.phase === "history" ? [...keys, saved.seen.key] : keys;
|
|
181
158
|
};
|
|
182
159
|
/**
|
|
183
|
-
* The most history objects a walk from `refs` can reach: the commits and tags the listed packs'
|
|
184
|
-
* `.types` count, an object each tag names, each ref's own and each of `rows` object rows. Read
|
|
185
|
-
* by range, `typesRunRanks` bytes at a time.
|
|
186
|
-
*/
|
|
187
|
-
const historyCount = /* @__PURE__ */ Effect.fnUntraced(function* (input, refs, rows) {
|
|
188
|
-
const commit = typeCode("commit");
|
|
189
|
-
const tag = typeCode("tag");
|
|
190
|
-
let commits = 0;
|
|
191
|
-
let tags = 0;
|
|
192
|
-
for (const pack of input.listed.packs) {
|
|
193
|
-
const key = isPackId(pack.id) ? packFiles(pack.id).types : pack.id;
|
|
194
|
-
const head = yield* readExactly(input.bucket, key, 0, 12);
|
|
195
|
-
yield* Effect.mapError(checkTypesHeader(head, pack.objects), (error) => gitError("DATA_LOSS", `Pack ${pack.id}'s types: ${error.message}`));
|
|
196
|
-
for (let rank = 0; rank < pack.objects; rank += typesRunRanks) {
|
|
197
|
-
const length = Math.min(typesRunRanks, pack.objects - rank);
|
|
198
|
-
const types = yield* readExactly(input.bucket, key, typeAt(rank), length);
|
|
199
|
-
for (const byte of types) if (byte === commit) commits += 1;
|
|
200
|
-
else if (byte === tag) tags += 1;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return commits + 2 * tags + refs + rows;
|
|
204
|
-
});
|
|
205
|
-
/**
|
|
206
160
|
* `walk` in its own scope, a fresh walk's runs dropped once it's refused, so it keeps none. A walk
|
|
207
161
|
* that goes on from `saved` or `known` keeps them: the pass's mark names them, and the parked
|
|
208
162
|
* pass's retry goes on from there.
|
|
@@ -210,7 +164,8 @@ const historyCount = /* @__PURE__ */ Effect.fnUntraced(function* (input, refs, r
|
|
|
210
164
|
const droppedOnRefusal = (walk, input, pack, _start, _missing, options = {}) => Effect.tapError(Effect.scoped(walk), (error) => error instanceof PruneWalkTooLarge && options.saved === void 0 && options.known === void 0 ? bestEffort(dropRuns(input.bucket, pack)) : Effect.void);
|
|
211
165
|
/**
|
|
212
166
|
* Every object `start` reaches, as reached runs under `pack`: the history first, commits and tags
|
|
213
|
-
* in a
|
|
167
|
+
* each marked in a seen set of a bit an object of the listed packs; then the trees a level at a
|
|
168
|
+
* time, each level's
|
|
214
169
|
* frontier merged against the runs reached so far, which the merge carries on as the next
|
|
215
170
|
* level's, so a tree is read once and a blob put once, by the ID its tree names and never read.
|
|
216
171
|
* `missing` says what an object the repo doesn't hold does to the walk: a tree it passes over is
|
|
@@ -222,10 +177,10 @@ const droppedOnRefusal = (walk, input, pack, _start, _missing, options = {}) =>
|
|
|
222
177
|
* try given it as `saved` goes on from there, never from `start`. A batch reads as many objects as
|
|
223
178
|
* their delta chains' gets fit. A step that passes a whole try is refused by name.
|
|
224
179
|
* `known`'s rows, from an earlier walk, are reached already: a tree they hold isn't read again.
|
|
225
|
-
* A refused fresh walk drops its runs; one given `saved` or `known` keeps them. A test sets
|
|
226
|
-
*
|
|
180
|
+
* A refused fresh walk drops its runs; one given `saved` or `known` keeps them. A test sets
|
|
181
|
+
* `treesAtOnce` below its bound.
|
|
227
182
|
*/
|
|
228
|
-
const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, start, missing, { rows = 0,
|
|
183
|
+
const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, start, missing, { rows = 0, treesAtOnce = pruneTreesAtOnce, calls, saved, known } = {}) {
|
|
229
184
|
const { allotment, listed } = input;
|
|
230
185
|
const objects = listed.packs.reduce((sum, each) => sum + each.objects, 0) + rows;
|
|
231
186
|
const blocks = listed.packs.reduce((sum, each) => sum + Math.ceil(each.bytes / blockBytes), 0);
|
|
@@ -238,14 +193,14 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
238
193
|
const knownRuns = history?.known ?? known;
|
|
239
194
|
if (knownRuns !== void 0 && knownRuns.width !== rowBytes) return yield* Effect.fail(gitError("DATA_LOSS", `The known runs are not ${rowBytes}-byte rows`));
|
|
240
195
|
const named = new Set(start).size;
|
|
241
|
-
const
|
|
196
|
+
const outsideMost = rows + named;
|
|
242
197
|
const namesBytes = (saved === void 0 ? named : history?.pending.rows ?? 0) * 70;
|
|
243
|
-
const
|
|
198
|
+
const seenBytes = saved?.phase === "trees" ? 0 : pruneSeenBytes(listed.packs, outsideMost);
|
|
244
199
|
const indexes = listed.packs.reduce((sum, each) => sum + indexBytes(each), 0);
|
|
245
|
-
const charge = pruneWalkHeld(
|
|
200
|
+
const charge = pruneWalkHeld(sizes) + namesBytes + seenBytes + indexes;
|
|
246
201
|
if (charge - own > allotment.growable) return yield* new PruneWalkTooLarge({ message: `its walk charges ${charge} bytes with its packs' indexes, past the ${own + allotment.growable} its allotment holds: the repo is past what one prune walk holds` });
|
|
247
|
-
|
|
248
|
-
|
|
202
|
+
const heldBytes = namesBytes + seenBytes;
|
|
203
|
+
yield* Effect.acquireRelease(allotment.grow(heldBytes, upkeepTooLarge), () => Effect.sync(() => allotment.shrink(heldBytes)));
|
|
249
204
|
const reader = packReader({
|
|
250
205
|
...input,
|
|
251
206
|
memory
|
|
@@ -260,6 +215,25 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
260
215
|
allotment.shrink(bytes);
|
|
261
216
|
});
|
|
262
217
|
const reads = countedReads(reader, objects + 1e6, charged, void 0, release);
|
|
218
|
+
/** Where each of `oids` is for the seen set: its first listed pack and its rank there. */
|
|
219
|
+
const ranksOf = Effect.fnUntraced(function* (oids) {
|
|
220
|
+
const at = /* @__PURE__ */ new Map();
|
|
221
|
+
let left = [...oids];
|
|
222
|
+
for (const pack of listed.packs) {
|
|
223
|
+
if (left.length === 0) break;
|
|
224
|
+
const { index } = yield* reader.indexed(pack);
|
|
225
|
+
left = left.filter((oid) => {
|
|
226
|
+
const rank = index.rankOf(oid);
|
|
227
|
+
if (rank === void 0) return true;
|
|
228
|
+
at.set(oid, {
|
|
229
|
+
pack: pack.id,
|
|
230
|
+
rank
|
|
231
|
+
});
|
|
232
|
+
return false;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
return at;
|
|
236
|
+
});
|
|
263
237
|
/** Lets go of what `found` holds of `batch`, once each of it is put. */
|
|
264
238
|
const letGo = (found, batch) => {
|
|
265
239
|
for (const object of found.values()) reads.letGo(object);
|
|
@@ -388,9 +362,16 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
388
362
|
let names = [...new Set(start)];
|
|
389
363
|
let parents = [];
|
|
390
364
|
let prior;
|
|
365
|
+
let seenFrom;
|
|
391
366
|
if (history !== void 0) {
|
|
392
|
-
const rebuild =
|
|
367
|
+
const rebuild = narrowedCalls(history.reached.lengths, rowBytes, sizes.runs, input.bucket.multipart).calls + narrowedCalls(history.frontier.lengths, rowBytes, sizes.runs, input.bucket.multipart).calls + mergeCalls(history.pending) + 1;
|
|
393
368
|
if (!fits(calls, rebuild + 6)) return yield* tooMany("a history resume", rebuild + 6);
|
|
369
|
+
const bytes = yield* readWhole(input.bucket, history.seen.key);
|
|
370
|
+
if (bytes === void 0) return yield* Effect.fail(gitError("DATA_LOSS", `The walk's seen object ${history.seen.key} is gone`));
|
|
371
|
+
seenFrom = {
|
|
372
|
+
saved: history.seen,
|
|
373
|
+
bytes
|
|
374
|
+
};
|
|
394
375
|
const narrow = (runs, kind) => narrowed(input.bucket, pack, {
|
|
395
376
|
...runs,
|
|
396
377
|
kind: `${kind}.${tried}`
|
|
@@ -400,9 +381,12 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
400
381
|
frontier: yield* narrow(history.frontier, "frontier-h")
|
|
401
382
|
};
|
|
402
383
|
names = [];
|
|
403
|
-
yield* eachOf(prior.reached, (id) => void table.add(id));
|
|
404
384
|
yield* eachOf(history.pending, (id, tag) => (tag === tags.tree ? names : parents).push(hexOf(id)));
|
|
405
385
|
}
|
|
386
|
+
const seen = yield* seenSet(listed.packs, outsideMost, seenFrom === void 0 ? void 0 : {
|
|
387
|
+
...seenFrom,
|
|
388
|
+
place: ranksOf
|
|
389
|
+
});
|
|
406
390
|
const reached = writer("reached-0", sizes.runBytes);
|
|
407
391
|
const frontier = frontierWriter("frontier-0");
|
|
408
392
|
while (names.length > 0 || parents.length > 0) {
|
|
@@ -412,7 +396,7 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
412
396
|
else parents = [];
|
|
413
397
|
for (let at = 0; at < level.length;) {
|
|
414
398
|
const left = level.length - at + names.length + parents.length;
|
|
415
|
-
const { count: admits, needs } = yield* admitted(level.slice(at, at + 64),
|
|
399
|
+
const { count: admits, needs } = yield* admitted(level.slice(at, at + 64), 5 + putCalls(left));
|
|
416
400
|
if (admits === 0) {
|
|
417
401
|
if (!moved) return yield* tooMany("a history batch", needs);
|
|
418
402
|
const reachedRuns = yield* reached.finish;
|
|
@@ -421,9 +405,13 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
421
405
|
const rest = level.slice(at);
|
|
422
406
|
for (const oid of fromNames ? [...rest, ...names] : names) yield* put(pending, oidBytes(oid), tags.tree);
|
|
423
407
|
for (const oid of fromNames ? parents : [...rest, ...parents]) yield* put(pending, oidBytes(oid), tags.reached);
|
|
408
|
+
const key = runKey(pack, `seen.${tried}`, 0);
|
|
409
|
+
const { layout, bytes } = seen.saved(key);
|
|
410
|
+
yield* putOnce(input.bucket, key, bytes);
|
|
424
411
|
return { more: {
|
|
425
412
|
phase: "history",
|
|
426
|
-
count,
|
|
413
|
+
count: seen.size(),
|
|
414
|
+
seen: layout,
|
|
427
415
|
refs,
|
|
428
416
|
reached: after(prior?.reached, reachedRuns),
|
|
429
417
|
frontier: after(prior?.frontier, frontierRuns),
|
|
@@ -435,12 +423,12 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
435
423
|
const slice = level.slice(at, at + admits);
|
|
436
424
|
at += admits;
|
|
437
425
|
const blobs = fromNames ? yield* reader.wholeBlobs(slice) : /* @__PURE__ */ new Set();
|
|
426
|
+
const ranked = yield* ranksOf(slice);
|
|
438
427
|
const batch = [];
|
|
439
428
|
for (const oid of slice) {
|
|
440
429
|
const id = oidBytes(oid);
|
|
441
|
-
const added =
|
|
442
|
-
if (added === "full"
|
|
443
|
-
if (added === "full") return yield* Effect.fail(gitError("DATA_LOSS", `The packs' types count ${count} history objects: the walk reaches more`));
|
|
430
|
+
const added = seen.add(oid, ranked.get(oid));
|
|
431
|
+
if (added === "full") return yield* Effect.fail(gitError("DATA_LOSS", `The walk reaches more than ${outsideMost} objects no listed pack holds: past its rows and refs`));
|
|
444
432
|
if (!added) continue;
|
|
445
433
|
if (blobs.has(oid)) yield* put(reached, id, tags.reached);
|
|
446
434
|
else batch.push(oid);
|
|
@@ -465,7 +453,7 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
465
453
|
runs = after(prior?.reached, yield* reached.finish);
|
|
466
454
|
next = after(prior?.frontier, yield* frontier.finish);
|
|
467
455
|
if (knownRuns !== void 0) runs = joined(runs, knownRuns);
|
|
468
|
-
commits =
|
|
456
|
+
commits = seen.size();
|
|
469
457
|
}
|
|
470
458
|
let within = saved?.phase === "trees" ? saved.at : void 0;
|
|
471
459
|
for (let depth = from + 1; next.rows > 0; depth += 1) {
|
|
@@ -575,4 +563,4 @@ const pruneWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, star
|
|
|
575
563
|
refs
|
|
576
564
|
};
|
|
577
565
|
}, droppedOnRefusal);
|
|
578
|
-
export { PruneWalkTooLarge, WalkSaved,
|
|
566
|
+
export { PruneWalkTooLarge, WalkSaved, pruneTreesAtOnce, pruneWalk, pruneWalkHeld, pruneWalkSizes, pruneWalkTables, reachedRunBytes, walkKeys };
|
package/dist/storage/prune.mjs
CHANGED
|
@@ -12,16 +12,16 @@ import { decodeRefused, refusedRead } from "./merge-fence.mjs";
|
|
|
12
12
|
import { decodeMerges, droppedStep, mergeKey, mergeRead, takenOf, writtenOf } from "./merge-row.mjs";
|
|
13
13
|
import { mergeInputsMost } from "./merge-most.mjs";
|
|
14
14
|
import { opensWithin, resumeMerge, streamMerge } from "./merge-stream.mjs";
|
|
15
|
-
import { objectKey } from "./object-rows.mjs";
|
|
15
|
+
import { noRows, objectKey, rowsMoved } from "./object-rows.mjs";
|
|
16
16
|
import { bitsBytes, hasBit, keepBits, keptAt, setBit } from "./prune-keep.mjs";
|
|
17
|
-
import { WalkSaved, pruneWalk } from "./prune-walk.mjs";
|
|
17
|
+
import { WalkSaved, pruneWalk, walkKeys } from "./prune-walk.mjs";
|
|
18
18
|
import { defaultRepack, leavingRows, loadAll, mergeWith, namedOf, replacing, wholeRows } from "./repack.mjs";
|
|
19
19
|
import { decodeHeld, pruneFloor, pruneWait } from "./rows.mjs";
|
|
20
20
|
import { StoredRuns, dropRuns, mergeHeld, mergeRuns } from "./runs.mjs";
|
|
21
21
|
import { lost } from "./walk.mjs";
|
|
22
|
-
import * as Schema from "effect/Schema";
|
|
23
22
|
import * as Effect from "effect/Effect";
|
|
24
23
|
import * as Option from "effect/Option";
|
|
24
|
+
import * as Schema from "effect/Schema";
|
|
25
25
|
import * as DateTime from "effect/DateTime";
|
|
26
26
|
// src/storage/prune.ts
|
|
27
27
|
/** A cruft pack's row, by its pack: when a prune pass found its objects unreached. */
|
|
@@ -143,10 +143,33 @@ const cruftOf = (read, pack) => isPackId(pack.id) ? read.cruft.get(pack.id) : vo
|
|
|
143
143
|
const pruneWhole = /* @__PURE__ */ WholeRepo.mint();
|
|
144
144
|
/**
|
|
145
145
|
* The scratch pack a pass's walk of `kind` puts its runs under: `r` for what the refs reach, `n`
|
|
146
|
-
* for what the unreached objects name. One a pass, by its mark's time, so a try that
|
|
147
|
-
* runs the next try's step drops before it walks again
|
|
146
|
+
* for what the unreached objects name. One a pass, by its repo and its mark's time, so a try that
|
|
147
|
+
* dies leaves runs the next try's step drops before it walks again, and two repos whose passes
|
|
148
|
+
* are marked at one moment, in the one bucket every repo's packs share, never share one.
|
|
149
|
+
*/
|
|
150
|
+
const walkPackOf = (repo, at, kind) => `p_${kind}${repo.slice(2)}${at.toString(36).padStart(15, "0")}`;
|
|
151
|
+
/**
|
|
152
|
+
* The scratch packs of the pass marked at `at` dropped, pages at most each, once its commit is
|
|
153
|
+
* in: `'more'` while keys are left, for the next step to drop. The next pass's first step drops
|
|
154
|
+
* them, or a deleted repo's step, which no pass follows.
|
|
148
155
|
*/
|
|
149
|
-
const
|
|
156
|
+
const passScratch = (input, at) => Effect.map(Effect.all([dropRuns(input.bucket, walkPackOf(input.listed.repo, at, "r")), dropRuns(input.bucket, walkPackOf(input.listed.repo, at, "n"))]), (drops) => drops.includes("more") ? "more" : "done");
|
|
157
|
+
/**
|
|
158
|
+
* The bucket keys `started` names under its pass's scratch packs: each walk's runs, saved or
|
|
159
|
+
* done, and its classes object. Bounded by the mark's record, so a drop of them takes one call.
|
|
160
|
+
*/
|
|
161
|
+
const markKeys = (started, repo, at) => {
|
|
162
|
+
const keys = /* @__PURE__ */ new Set();
|
|
163
|
+
const carries = [started?.walks?.r, started?.walks?.n];
|
|
164
|
+
for (const carry of carries) {
|
|
165
|
+
if (carry === void 0) continue;
|
|
166
|
+
for (const key of carry.refs?.keys ?? []) keys.add(key);
|
|
167
|
+
if ("done" in carry) for (const key of carry.done.keys) keys.add(key);
|
|
168
|
+
else for (const key of walkKeys(carry.saved)) keys.add(key);
|
|
169
|
+
}
|
|
170
|
+
if (started?.classes !== void 0) keys.add(classesKey(repo, at, started.classes.n));
|
|
171
|
+
return keys;
|
|
172
|
+
};
|
|
150
173
|
/**
|
|
151
174
|
* A pass's reach, as a set: an ID is in it when the bits' rows hold it, or its first pack among
|
|
152
175
|
* `packs` keeps it at its rank, as D3's `keptAt` says. Its IDs run each pack's set bits, then the
|
|
@@ -273,7 +296,7 @@ const sameIds = (a, b) => {
|
|
|
273
296
|
return a.length === b.length && b.every((id) => named.has(id));
|
|
274
297
|
};
|
|
275
298
|
/** The key of a pass's classes object `n`, under its `r` walk's scratch, which its last step drops. */
|
|
276
|
-
const classesKey = (at, n) => runKey(walkPackOf(at, "r"), "classes", n);
|
|
299
|
+
const classesKey = (repo, at, n) => runKey(walkPackOf(repo, at, "r"), "classes", n);
|
|
277
300
|
const ClassesHeader = /* @__PURE__ */ Schema.fromJsonString(Schema.Struct({ packs: Schema.Array(Schema.Struct({
|
|
278
301
|
pack: Schema.String.pipe(Schema.refine(isPackId)),
|
|
279
302
|
count: Schema.Int.check(Schema.isBetween({
|
|
@@ -371,7 +394,8 @@ const cruftListing = (landed) => Effect.fnUntraced(function* (input, merge) {
|
|
|
371
394
|
...cruftKey(pack.id),
|
|
372
395
|
value: { since: input.at }
|
|
373
396
|
})),
|
|
374
|
-
delete: [...quarantines, mergeKey(merge.pack)]
|
|
397
|
+
delete: [...quarantines, mergeKey(merge.pack)],
|
|
398
|
+
rows: noRows
|
|
375
399
|
},
|
|
376
400
|
more: true,
|
|
377
401
|
quarantine: first,
|
|
@@ -399,7 +423,8 @@ const keptListing = (read, seen, rows, landed) => Effect.fnUntraced(function* (i
|
|
|
399
423
|
...quarantines,
|
|
400
424
|
...dropped.map((pack) => cruftKey(pack.id)),
|
|
401
425
|
mergeKey(merge.pack)
|
|
402
|
-
]
|
|
426
|
+
],
|
|
427
|
+
rows: noRows
|
|
403
428
|
},
|
|
404
429
|
more: true,
|
|
405
430
|
quarantine: first,
|
|
@@ -455,7 +480,8 @@ const rowsCruft = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, most
|
|
|
455
480
|
...cruftKey(id),
|
|
456
481
|
value: { since: input.at }
|
|
457
482
|
}],
|
|
458
|
-
delete: [merged.quarantine]
|
|
483
|
+
delete: [merged.quarantine],
|
|
484
|
+
rows: noRows
|
|
459
485
|
},
|
|
460
486
|
more: true,
|
|
461
487
|
quarantine: merged.quarantine
|
|
@@ -470,7 +496,10 @@ const rowsStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, keep,
|
|
|
470
496
|
});
|
|
471
497
|
if (merged === "too big") return { waits: "its rows pack is past the pack size" };
|
|
472
498
|
const step = {
|
|
473
|
-
change: merged === void 0 ? {
|
|
499
|
+
change: merged === void 0 ? {
|
|
500
|
+
delete: rows.map((row) => objectKey(row.oid)),
|
|
501
|
+
rows: rowsMoved(rows, "deleted")
|
|
502
|
+
} : replacing(input, merged, [], rows),
|
|
474
503
|
more: true
|
|
475
504
|
};
|
|
476
505
|
if (merged !== void 0) step.quarantine = merged.quarantine;
|
|
@@ -478,7 +507,9 @@ const rowsStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, keep,
|
|
|
478
507
|
});
|
|
479
508
|
/**
|
|
480
509
|
* The step that unlists each pack of `emptied`, whose every object the pass drops, with no merge:
|
|
481
|
-
* each a `leaving` row, and an old cruft pack's `cruft` row ended, so the step `drops`.
|
|
510
|
+
* each a `leaving` row, and an old cruft pack's `cruft` row ended, so the step `drops`. It makes
|
|
511
|
+
* the `repack` row due, whose clean-up deletes the packs' bytes once their rows are, so on a repo
|
|
512
|
+
* that takes no push they don't wait for the row's next run.
|
|
482
513
|
*/
|
|
483
514
|
const emptiedStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, emptied) {
|
|
484
515
|
const ids = new Set(emptied.map((each) => each.pack));
|
|
@@ -488,9 +519,11 @@ const emptiedStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, em
|
|
|
488
519
|
change: {
|
|
489
520
|
remove: removed.map((pack) => pack.id),
|
|
490
521
|
put: leavingRows(input, removed),
|
|
491
|
-
delete: dropped.map((pack) => cruftKey(pack.id))
|
|
522
|
+
delete: dropped.map((pack) => cruftKey(pack.id)),
|
|
523
|
+
rows: noRows
|
|
492
524
|
},
|
|
493
|
-
more: true
|
|
525
|
+
more: true,
|
|
526
|
+
repack: input.at
|
|
494
527
|
};
|
|
495
528
|
if (dropped.length > 0) step.drops = true;
|
|
496
529
|
return step;
|
|
@@ -528,10 +561,10 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
528
561
|
const carried = read.started?.walks ?? {};
|
|
529
562
|
const classes = read.started?.classes;
|
|
530
563
|
const redos = read.started?.redos ?? 0;
|
|
531
|
-
const scratch = walkPackOf(at, "r");
|
|
564
|
+
const scratch = walkPackOf(input.listed.repo, at, "r");
|
|
532
565
|
const saving = (walks) => ({
|
|
533
566
|
step: {
|
|
534
|
-
change: {},
|
|
567
|
+
change: { rows: noRows },
|
|
535
568
|
more: true
|
|
536
569
|
},
|
|
537
570
|
mark: { walks }
|
|
@@ -575,7 +608,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
575
608
|
};
|
|
576
609
|
if (classes.kind === "cruft" || merge.value.pass !== "commit" || seenHolds(classes)) return went(yield* resumeMerge(input, merge, most, calls, listingOf(classes)), classes.kind);
|
|
577
610
|
}
|
|
578
|
-
const chosen = merge === void 0 && classes !== void 0 && (classes.kind === "cruft" ? sameIds(classes.packs, ids) : seenHolds(classes)) ? yield* readClasses(input, classesKey(at, classes.n), classes.bytes) : void 0;
|
|
611
|
+
const chosen = merge === void 0 && classes !== void 0 && (classes.kind === "cruft" ? sameIds(classes.packs, ids) : seenHolds(classes)) ? yield* readClasses(input, classesKey(input.listed.repo, at, classes.n), classes.bytes) : void 0;
|
|
579
612
|
if (chosen !== void 0 && classes !== void 0 && !chosen.some((each) => youngIds.has(each.pack))) return went(yield* classMerge(input, read, chosen, most, calls, listingOf(classes)), classes.kind);
|
|
580
613
|
const reachedRuns = carry.done;
|
|
581
614
|
const bits = yield* keepBits(input, scratch, reachedRuns, rowOids, lost);
|
|
@@ -627,7 +660,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
627
660
|
const copies = (yield* classBits(input, fresh, (indexed, rank) => !reachedAt(indexed, rank) && !apart(indexed.index.oidAt(rank)))).filter((each) => each.set > 0);
|
|
628
661
|
if (copies.length === 0) return { start };
|
|
629
662
|
const n = (classes?.n ?? -1) + 1;
|
|
630
|
-
const bytes = yield* putClasses(input, classesKey(at, n), copies);
|
|
663
|
+
const bytes = yield* putClasses(input, classesKey(input.listed.repo, at, n), copies);
|
|
631
664
|
return { classes: {
|
|
632
665
|
kind: "cruft",
|
|
633
666
|
n,
|
|
@@ -639,12 +672,12 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
639
672
|
if ("cruft" in first) return first.cruft;
|
|
640
673
|
if ("classes" in first) return {
|
|
641
674
|
step: {
|
|
642
|
-
change: {},
|
|
675
|
+
change: { rows: noRows },
|
|
643
676
|
more: true
|
|
644
677
|
},
|
|
645
678
|
mark: { classes: first.classes }
|
|
646
679
|
};
|
|
647
|
-
const named = walkPackOf(at, "n");
|
|
680
|
+
const named = walkPackOf(input.listed.repo, at, "n");
|
|
648
681
|
const neededCarry = carried.n;
|
|
649
682
|
if (packs.old.length > 0 && (neededCarry === void 0 || "saved" in neededCarry)) {
|
|
650
683
|
const start = neededCarry === void 0 ? first.start : [];
|
|
@@ -676,7 +709,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
676
709
|
const inRows = new Set(rowOids);
|
|
677
710
|
const keep = (oid) => reached.has(oid) || !apart(oid) && (inFresh(oid) || inRows.has(oid) || needed.has(oid));
|
|
678
711
|
if (merge !== void 0 && classes !== void 0) {
|
|
679
|
-
const before = yield* readClasses(input, classesKey(at, classes.n), classes.bytes);
|
|
712
|
+
const before = yield* readClasses(input, classesKey(input.listed.repo, at, classes.n), classes.bytes);
|
|
680
713
|
const byPack = new Map((before ?? []).map((each) => [each.pack, each.bits]));
|
|
681
714
|
const inputs = new Set(merge.value.inputs);
|
|
682
715
|
if (!merging.some(({ pack, index }) => {
|
|
@@ -709,28 +742,37 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
709
742
|
if (emptied.length > 0) return { step: yield* emptiedStep(input, read, emptied) };
|
|
710
743
|
if (rewrites.length > 0) {
|
|
711
744
|
const n = (classes?.n ?? -1) + 1;
|
|
745
|
+
const value = {
|
|
746
|
+
kind: "kept",
|
|
747
|
+
n,
|
|
748
|
+
packs: ids,
|
|
749
|
+
reads: digest,
|
|
750
|
+
bytes: yield* putClasses(input, classesKey(input.listed.repo, at, n), rewrites)
|
|
751
|
+
};
|
|
712
752
|
return {
|
|
713
753
|
step: {
|
|
714
|
-
change: {},
|
|
754
|
+
change: { rows: noRows },
|
|
715
755
|
more: true
|
|
716
756
|
},
|
|
717
|
-
mark: { classes:
|
|
718
|
-
kind: "kept",
|
|
719
|
-
n,
|
|
720
|
-
packs: ids,
|
|
721
|
-
reads: digest,
|
|
722
|
-
bytes: yield* putClasses(input, classesKey(at, n), rewrites)
|
|
723
|
-
} }
|
|
757
|
+
mark: { classes: value }
|
|
724
758
|
};
|
|
725
759
|
}
|
|
726
760
|
const held = carry.refs === void 0 || (yield* refsHeld(input, scratch, carry.refs, refs));
|
|
727
|
-
|
|
728
|
-
yield* dropRuns(input.bucket,
|
|
761
|
+
const marked = markKeys(read.started, input.listed.repo, at);
|
|
762
|
+
const scratchDropped = yield* dropRuns(input.bucket, scratch, marked);
|
|
763
|
+
const namedDropped = yield* dropRuns(input.bucket, named, marked);
|
|
764
|
+
if (scratchDropped === "more" || namedDropped === "more") return { step: {
|
|
765
|
+
change: { rows: noRows },
|
|
766
|
+
more: true
|
|
767
|
+
} };
|
|
729
768
|
const step = {
|
|
730
|
-
change: {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
769
|
+
change: {
|
|
770
|
+
put: [{
|
|
771
|
+
...prunePassKey,
|
|
772
|
+
value: { at: input.at }
|
|
773
|
+
}],
|
|
774
|
+
rows: noRows
|
|
775
|
+
},
|
|
734
776
|
more: false
|
|
735
777
|
};
|
|
736
778
|
const whole = (oid) => keep(oid) || inFenced(oid);
|
|
@@ -814,12 +856,23 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
814
856
|
next: after
|
|
815
857
|
};
|
|
816
858
|
}
|
|
859
|
+
const ended = read.started?.at;
|
|
860
|
+
if (ended !== void 0 && last !== void 0 && ended <= last && (yield* passScratch(input, ended)) === "more") return {
|
|
861
|
+
step: {
|
|
862
|
+
change: { rows: noRows },
|
|
863
|
+
more: true
|
|
864
|
+
},
|
|
865
|
+
next
|
|
866
|
+
};
|
|
817
867
|
if (markHeld && read.cruft.size === 0 && merge === void 0) return {
|
|
818
868
|
step: {
|
|
819
|
-
change: {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
869
|
+
change: {
|
|
870
|
+
put: [{
|
|
871
|
+
...prunePassKey,
|
|
872
|
+
value: { at: input.at }
|
|
873
|
+
}],
|
|
874
|
+
rows: noRows
|
|
875
|
+
},
|
|
823
876
|
more: true
|
|
824
877
|
},
|
|
825
878
|
next: input.at + pruneWait(prune)
|
|
@@ -842,10 +895,13 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
842
895
|
const { started } = read;
|
|
843
896
|
if (!(started !== void 0 && (last === void 0 || started.at > last))) return {
|
|
844
897
|
step: {
|
|
845
|
-
change: {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
898
|
+
change: {
|
|
899
|
+
put: [{
|
|
900
|
+
...pruneStartedKey,
|
|
901
|
+
value: { at: input.at }
|
|
902
|
+
}],
|
|
903
|
+
rows: noRows
|
|
904
|
+
},
|
|
849
905
|
more: true
|
|
850
906
|
},
|
|
851
907
|
next
|
|
@@ -863,9 +919,13 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
863
919
|
}
|
|
864
920
|
};
|
|
865
921
|
const step = {
|
|
866
|
-
change: merge === void 0 ? {
|
|
922
|
+
change: merge === void 0 ? {
|
|
923
|
+
put: [mark],
|
|
924
|
+
rows: noRows
|
|
925
|
+
} : {
|
|
867
926
|
put: [mark],
|
|
868
|
-
delete: [mergeKey(merge.pack)]
|
|
927
|
+
delete: [mergeKey(merge.pack)],
|
|
928
|
+
rows: noRows
|
|
869
929
|
},
|
|
870
930
|
more: true
|
|
871
931
|
};
|
|
@@ -890,10 +950,13 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
890
950
|
}
|
|
891
951
|
};
|
|
892
952
|
if ("last" in stepped) {
|
|
893
|
-
const rewalk = {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
953
|
+
const rewalk = {
|
|
954
|
+
put: [{
|
|
955
|
+
...pruneStartedKey,
|
|
956
|
+
value: { at: started.at }
|
|
957
|
+
}],
|
|
958
|
+
rows: noRows
|
|
959
|
+
};
|
|
897
960
|
return {
|
|
898
961
|
step: {
|
|
899
962
|
...step.reaches === true ? {
|
|
@@ -910,4 +973,4 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
910
973
|
next
|
|
911
974
|
};
|
|
912
975
|
});
|
|
913
|
-
export { CruftRow, PassClasses, PruneCleared, PrunePass, PruneStarted, bitsOf, cruftOf, mergesAlone, passDue, pruneClearedKey, prunePassKey, pruneStartedKey, pruneStep, reachesOnly, readPrune, walkPackOf };
|
|
976
|
+
export { CruftRow, PassClasses, PruneCleared, PrunePass, PruneStarted, bitsOf, cruftOf, mergesAlone, passDue, passScratch, pruneClearedKey, prunePassKey, pruneStartedKey, pruneStep, reachesOnly, readPrune, walkPackOf };
|