@ref0/git 0.0.0 → 0.3.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/LICENSE +202 -0
- package/dist/access/private-refs.d.mts +27 -0
- package/dist/access/private-refs.mjs +173 -0
- package/dist/access.d.mts +2 -0
- package/dist/access.mjs +1 -0
- package/dist/auth/access-jwt.d.mts +21 -0
- package/dist/auth/access-jwt.mjs +102 -0
- package/dist/auth/acting.mjs +15 -0
- package/dist/auth/authorize.d.mts +5 -0
- package/dist/auth/authorize.mjs +292 -0
- package/dist/auth/credentials.mjs +57 -0
- package/dist/auth/fences.d.mts +5 -0
- package/dist/auth/fences.mjs +65 -0
- package/dist/auth/grants.mjs +61 -0
- package/dist/auth/helpers.d.mts +17 -0
- package/dist/auth/helpers.mjs +25 -0
- package/dist/auth/host-function.d.mts +4 -0
- package/dist/auth/host-function.mjs +69 -0
- package/dist/auth/identify.d.mts +6 -0
- package/dist/auth/identify.mjs +97 -0
- package/dist/auth/token-rows.mjs +100 -0
- package/dist/auth/token-text.mjs +66 -0
- package/dist/auth/tokens.d.mts +10 -0
- package/dist/auth/tokens.mjs +347 -0
- package/dist/auth.d.mts +7 -0
- package/dist/auth.mjs +6 -0
- package/dist/client/answer.mjs +141 -0
- package/dist/client/client.d.mts +23 -0
- package/dist/client/client.mjs +50 -0
- package/dist/client/git-http.mjs +201 -0
- package/dist/client/helper-node.mjs +19 -0
- package/dist/client/local.mjs +170 -0
- package/dist/client/negotiate.mjs +170 -0
- package/dist/client/push-upload.mjs +53 -0
- package/dist/client/remote-helper.mjs +129 -0
- package/dist/client/remote.mjs +398 -0
- package/dist/client/run-remote-helper.d.mts +35 -0
- package/dist/client/run-remote-helper.mjs +259 -0
- package/dist/client/scrub.d.mts +18 -0
- package/dist/client/scrub.mjs +38 -0
- package/dist/client/transport.d.mts +2 -0
- package/dist/client/transport.mjs +211 -0
- package/dist/contracts/access.d.mts +87 -0
- package/dist/contracts/actors.d.mts +144 -0
- package/dist/contracts/blobs.d.mts +38 -0
- package/dist/contracts/calls-spent.d.mts +11 -0
- package/dist/contracts/calls-spent.mjs +151 -0
- package/dist/contracts/client.d.mts +90 -0
- package/dist/contracts/commits.d.mts +126 -0
- package/dist/contracts/engine.d.mts +134 -0
- package/dist/contracts/events.d.mts +276 -0
- package/dist/contracts/files.d.mts +75 -0
- package/dist/contracts/forks.d.mts +78 -0
- package/dist/contracts/grants.d.mts +60 -0
- package/dist/contracts/handlers.d.mts +11 -0
- package/dist/contracts/ids.d.mts +15 -0
- package/dist/contracts/ids.mjs +15 -0
- package/dist/contracts/lfs.d.mts +27 -0
- package/dist/contracts/merges.d.mts +33 -0
- package/dist/contracts/objects.d.mts +645 -0
- package/dist/contracts/objects.mjs +54 -0
- package/dist/contracts/operations.d.mts +133 -0
- package/dist/contracts/promises.d.mts +38 -0
- package/dist/contracts/promises.mjs +13 -0
- package/dist/contracts/push-uploads.d.mts +44 -0
- package/dist/contracts/queue.d.mts +402 -0
- package/dist/contracts/refs.d.mts +95 -0
- package/dist/contracts/remote.d.mts +50 -0
- package/dist/contracts/repos.d.mts +153 -0
- package/dist/contracts/result.d.mts +133 -0
- package/dist/contracts/result.mjs +34 -0
- package/dist/contracts/rules.d.mts +159 -0
- package/dist/contracts/server.d.mts +272 -0
- package/dist/contracts/services.d.mts +36 -0
- package/dist/contracts/services.mjs +13 -0
- package/dist/contracts/signin.d.mts +126 -0
- package/dist/contracts/store.d.mts +41 -0
- package/dist/contracts/sync.d.mts +210 -0
- package/dist/contracts/sync.mjs +8 -0
- package/dist/contracts/tags.d.mts +50 -0
- package/dist/contracts/tags.mjs +6 -0
- package/dist/contracts/tokens.d.mts +87 -0
- package/dist/contracts/tokens.mjs +15 -0
- package/dist/contracts/topics.d.mts +180 -0
- package/dist/contracts/trees.d.mts +84 -0
- package/dist/contracts/work.d.mts +31 -0
- package/dist/core/access.d.mts +22 -0
- package/dist/core/access.mjs +262 -0
- package/dist/core/ancestry.mjs +235 -0
- package/dist/core/call-names.d.mts +1 -0
- package/dist/core/call-names.mjs +93 -0
- package/dist/core/clock.mjs +18 -0
- package/dist/core/events/deliver.mjs +475 -0
- package/dist/core/events/stream.d.mts +19 -0
- package/dist/core/events/stream.mjs +297 -0
- package/dist/core/forks.mjs +1027 -0
- package/dist/core/hooks/post-receive.mjs +212 -0
- package/dist/core/hooks/pre-receive.d.mts +5 -0
- package/dist/core/hooks/pre-receive.mjs +34 -0
- package/dist/core/index-job.mjs +198 -0
- package/dist/core/names.mjs +30 -0
- package/dist/core/objects/blobs.mjs +60 -0
- package/dist/core/objects/commit-writes.mjs +185 -0
- package/dist/core/objects/commits.mjs +172 -0
- package/dist/core/objects/files.mjs +211 -0
- package/dist/core/objects/lines.mjs +42 -0
- package/dist/core/objects/merges.mjs +83 -0
- package/dist/core/objects/peel.mjs +166 -0
- package/dist/core/objects/reading.mjs +284 -0
- package/dist/core/objects/tags.mjs +96 -0
- package/dist/core/objects/tree-edits.mjs +266 -0
- package/dist/core/objects/trees.mjs +229 -0
- package/dist/core/objects/writing.mjs +266 -0
- package/dist/core/own-writes.mjs +94 -0
- package/dist/core/promise.mjs +64 -0
- package/dist/core/publish.mjs +142 -0
- package/dist/core/push-decide.mjs +206 -0
- package/dist/core/push.mjs +1070 -0
- package/dist/core/receipts.d.mts +7 -0
- package/dist/core/receipts.mjs +234 -0
- package/dist/core/ref-conflicts.mjs +27 -0
- package/dist/core/refs.mjs +359 -0
- package/dist/core/repack.mjs +521 -0
- package/dist/core/repos.mjs +752 -0
- package/dist/core/rules/changes.mjs +57 -0
- package/dist/core/rules/check.mjs +101 -0
- package/dist/core/rules/commit-changes.mjs +216 -0
- package/dist/core/rules/context.d.mts +9 -0
- package/dist/core/rules/context.mjs +120 -0
- package/dist/core/rules/define.d.mts +5 -0
- package/dist/core/rules/define.mjs +13 -0
- package/dist/core/rules/facts.mjs +13 -0
- package/dist/core/rules/fetch.d.mts +5 -0
- package/dist/core/rules/fetch.mjs +59 -0
- package/dist/core/rules/file-globs.mjs +55 -0
- package/dist/core/rules/files.mjs +142 -0
- package/dist/core/rules/patterns.mjs +23 -0
- package/dist/core/rules/protect.d.mts +9 -0
- package/dist/core/rules/protect.mjs +116 -0
- package/dist/core/seam.d.mts +26 -0
- package/dist/core/seam.mjs +54 -0
- package/dist/core/sight.mjs +99 -0
- package/dist/core/tokens.mjs +95 -0
- package/dist/core/view.d.mts +9 -0
- package/dist/core/view.mjs +221 -0
- package/dist/core/work.mjs +92 -0
- package/dist/effect.d.mts +20 -0
- package/dist/effect.mjs +18 -0
- package/dist/engine/allotted-xdiff.d.mts +4 -0
- package/dist/engine/allotted-xdiff.mjs +80 -0
- package/dist/engine/attribute-patterns.mjs +163 -0
- package/dist/engine/attributes.mjs +226 -0
- package/dist/engine/combined.mjs +653 -0
- package/dist/engine/commits.mjs +90 -0
- package/dist/engine/content.d.mts +4 -0
- package/dist/engine/content.mjs +221 -0
- package/dist/engine/diff.mjs +49 -0
- package/dist/engine/engine.d.mts +25 -0
- package/dist/engine/engine.mjs +49 -0
- package/dist/engine/failures.d.mts +4 -0
- package/dist/engine/failures.mjs +23 -0
- package/dist/engine/line-count.mjs +23 -0
- package/dist/engine/merge-base-walk.d.mts +2 -0
- package/dist/engine/merge-base-walk.mjs +265 -0
- package/dist/engine/merge-bases.mjs +27 -0
- package/dist/engine/merge-renames.mjs +165 -0
- package/dist/engine/merge.mjs +1125 -0
- package/dist/engine/parts.d.mts +8 -0
- package/dist/engine/parts.mjs +9 -0
- package/dist/engine/reads.d.mts +5 -0
- package/dist/engine/reads.mjs +105 -0
- package/dist/engine/walk.mjs +328 -0
- package/dist/engine/xdiff/NOTICE.md +63 -0
- package/dist/engine/xdiff/compiled.d.mts +7 -0
- package/dist/engine/xdiff/compiled.mjs +9 -0
- package/dist/engine/xdiff/embedded.mjs +4 -0
- package/dist/engine/xdiff/node.d.mts +7 -0
- package/dist/engine/xdiff/node.mjs +10 -0
- package/dist/engine/xdiff/upstream/LGPL-2.1 +511 -0
- package/dist/engine/xdiff/xdiff.wasm +0 -0
- package/dist/engine/xdiff.d.mts +34 -0
- package/dist/engine/xdiff.mjs +380 -0
- package/dist/engine.d.mts +3 -0
- package/dist/engine.mjs +3 -0
- package/dist/extend.d.mts +4 -0
- package/dist/extend.mjs +3 -0
- package/dist/http/answers.mjs +74 -0
- package/dist/http/bodies.mjs +143 -0
- package/dist/http/core-parts.mjs +252 -0
- package/dist/http/fetch-depth.mjs +26 -0
- package/dist/http/handler.mjs +94 -0
- package/dist/http/node.d.mts +70 -0
- package/dist/http/node.mjs +178 -0
- package/dist/http/paths.d.mts +9 -0
- package/dist/http/paths.mjs +118 -0
- package/dist/http/push-uploads.mjs +286 -0
- package/dist/http/receive-pack.mjs +235 -0
- package/dist/http/upload-pack.mjs +229 -0
- package/dist/index.d.mts +46 -0
- package/dist/index.mjs +16 -0
- package/dist/lfs/calls.mjs +16 -0
- package/dist/lfs/locks.mjs +161 -0
- package/dist/lfs/objects.mjs +370 -0
- package/dist/lfs/pointers.mjs +141 -0
- package/dist/lfs/repo.mjs +42 -0
- package/dist/lfs/rows.mjs +108 -0
- package/dist/lfs/service.mjs +34 -0
- package/dist/lfs/upkeep.mjs +162 -0
- package/dist/lfs/wire.mjs +102 -0
- package/dist/node.d.mts +3 -0
- package/dist/node.mjs +3 -0
- package/dist/protocol/bytes/buffers.d.mts +38 -0
- package/dist/protocol/bytes/buffers.mjs +62 -0
- package/dist/protocol/bytes/crc32.d.mts +4 -0
- package/dist/protocol/bytes/crc32.mjs +14 -0
- package/dist/protocol/bytes/deflate.d.mts +78 -0
- package/dist/protocol/bytes/deflate.mjs +175 -0
- package/dist/protocol/bytes/errors.d.mts +20 -0
- package/dist/protocol/bytes/errors.mjs +19 -0
- package/dist/protocol/bytes/hex.mjs +16 -0
- package/dist/protocol/bytes/hmac-sha256.mjs +91 -0
- package/dist/protocol/bytes/inflate.d.mts +40 -0
- package/dist/protocol/bytes/inflate.mjs +109 -0
- package/dist/protocol/bytes/joined.d.mts +2 -0
- package/dist/protocol/bytes/joined.mjs +25 -0
- package/dist/protocol/bytes/sha1-hasher.d.mts +20 -0
- package/dist/protocol/bytes/sha1-hasher.mjs +72 -0
- package/dist/protocol/bytes/sha1.d.mts +35 -0
- package/dist/protocol/bytes/sha1.mjs +409 -0
- package/dist/protocol/bytes/sha256.mjs +156 -0
- package/dist/protocol/bytes/streams.mjs +11 -0
- package/dist/protocol/bytes/text.mjs +19 -0
- package/dist/protocol/diff/diff-raw.d.mts +29 -0
- package/dist/protocol/diff/diff-raw.mjs +73 -0
- package/dist/protocol/diff/patch.mjs +92 -0
- package/dist/protocol/diff/paths.mjs +67 -0
- package/dist/protocol/diff/read.d.mts +62 -0
- package/dist/protocol/diff/read.mjs +342 -0
- package/dist/protocol/diff/rename-similarity.mjs +428 -0
- package/dist/protocol/diff/text.mjs +12 -0
- package/dist/protocol/diff/tree-diff.d.mts +41 -0
- package/dist/protocol/diff/tree-diff.mjs +607 -0
- package/dist/protocol/framing/band.d.mts +10 -0
- package/dist/protocol/framing/band.mjs +16 -0
- package/dist/protocol/framing/pkt-line.d.mts +48 -0
- package/dist/protocol/framing/pkt-line.mjs +92 -0
- package/dist/protocol/objects/checked-blobs.mjs +127 -0
- package/dist/protocol/objects/commit.d.mts +25 -0
- package/dist/protocol/objects/commit.mjs +138 -0
- package/dist/protocol/objects/fsck-gitmodules.mjs +296 -0
- package/dist/protocol/objects/fsck-names.mjs +189 -0
- package/dist/protocol/objects/fsck.mjs +297 -0
- package/dist/protocol/objects/headers.mjs +109 -0
- package/dist/protocol/objects/held.mjs +56 -0
- package/dist/protocol/objects/iconv.mjs +145 -0
- package/dist/protocol/objects/ident.mjs +111 -0
- package/dist/protocol/objects/lfs-pointer.d.mts +8 -0
- package/dist/protocol/objects/lfs-pointer.mjs +63 -0
- package/dist/protocol/objects/links-raw.mjs +89 -0
- package/dist/protocol/objects/object-rules.mjs +75 -0
- package/dist/protocol/objects/object.d.mts +16 -0
- package/dist/protocol/objects/object.mjs +29 -0
- package/dist/protocol/objects/tag.d.mts +21 -0
- package/dist/protocol/objects/tag.mjs +96 -0
- package/dist/protocol/objects/tree.d.mts +43 -0
- package/dist/protocol/objects/tree.mjs +162 -0
- package/dist/protocol/objects/utf8-verify.mjs +71 -0
- package/dist/protocol/packs/delta.d.mts +57 -0
- package/dist/protocol/packs/delta.mjs +229 -0
- package/dist/protocol/packs/graph.mjs +78 -0
- package/dist/protocol/packs/idx.d.mts +54 -0
- package/dist/protocol/packs/idx.mjs +274 -0
- package/dist/protocol/packs/indexer.d.mts +167 -0
- package/dist/protocol/packs/indexer.mjs +507 -0
- package/dist/protocol/packs/parts.d.mts +40 -0
- package/dist/protocol/packs/parts.mjs +89 -0
- package/dist/protocol/packs/pos.mjs +51 -0
- package/dist/protocol/packs/reader.d.mts +180 -0
- package/dist/protocol/packs/reader.mjs +414 -0
- package/dist/protocol/packs/rev.d.mts +32 -0
- package/dist/protocol/packs/rev.mjs +99 -0
- package/dist/protocol/packs/step.d.mts +10 -0
- package/dist/protocol/packs/step.mjs +12 -0
- package/dist/protocol/packs/write-error.d.mts +12 -0
- package/dist/protocol/packs/write-error.mjs +27 -0
- package/dist/protocol/packs/writer.d.mts +157 -0
- package/dist/protocol/packs/writer.mjs +353 -0
- package/dist/protocol/wire/advertisement.d.mts +72 -0
- package/dist/protocol/wire/advertisement.mjs +161 -0
- package/dist/protocol/wire/fetch.d.mts +155 -0
- package/dist/protocol/wire/fetch.mjs +458 -0
- package/dist/protocol/wire/lines.mjs +107 -0
- package/dist/protocol/wire/push-uploads.mjs +43 -0
- package/dist/protocol/wire/receive-pack.d.mts +71 -0
- package/dist/protocol/wire/receive-pack.mjs +157 -0
- package/dist/protocol/wire/report-status.d.mts +47 -0
- package/dist/protocol/wire/report-status.mjs +119 -0
- package/dist/protocol/wire/v2.d.mts +90 -0
- package/dist/protocol/wire/v2.mjs +185 -0
- package/dist/protocol.d.mts +31 -0
- package/dist/protocol.mjs +31 -0
- package/dist/queue/advance.mjs +1037 -0
- package/dist/queue/callers.mjs +134 -0
- package/dist/queue/calls.mjs +1154 -0
- package/dist/queue/commit.mjs +85 -0
- package/dist/queue/host.d.mts +15 -0
- package/dist/queue/host.mjs +88 -0
- package/dist/queue/ids.d.mts +5 -0
- package/dist/queue/ids.mjs +21 -0
- package/dist/queue/lanes.mjs +86 -0
- package/dist/queue/limits.mjs +99 -0
- package/dist/queue/pages.mjs +76 -0
- package/dist/queue/push-option.mjs +62 -0
- package/dist/queue/rows.mjs +206 -0
- package/dist/queue/schedule.mjs +132 -0
- package/dist/queue/search.mjs +315 -0
- package/dist/queue/state.mjs +325 -0
- package/dist/queue/steps.mjs +317 -0
- package/dist/remote-helper.d.mts +3 -0
- package/dist/remote-helper.mjs +3 -0
- package/dist/rest/api.d.mts +23 -0
- package/dist/rest/api.mjs +27 -0
- package/dist/rest/blobs.d.mts +58 -0
- package/dist/rest/blobs.mjs +41 -0
- package/dist/rest/caller.d.mts +102 -0
- package/dist/rest/caller.mjs +18 -0
- package/dist/rest/client.d.mts +18 -0
- package/dist/rest/client.mjs +587 -0
- package/dist/rest/commits.d.mts +435 -0
- package/dist/rest/commits.mjs +140 -0
- package/dist/rest/errors.d.mts +44 -0
- package/dist/rest/errors.mjs +186 -0
- package/dist/rest/events.d.mts +38 -0
- package/dist/rest/events.mjs +74 -0
- package/dist/rest/files.d.mts +179 -0
- package/dist/rest/files.mjs +92 -0
- package/dist/rest/forks.d.mts +205 -0
- package/dist/rest/forks.mjs +51 -0
- package/dist/rest/handler.d.mts +18 -0
- package/dist/rest/handler.mjs +129 -0
- package/dist/rest/handlers.d.mts +8 -0
- package/dist/rest/handlers.mjs +592 -0
- package/dist/rest/listen.d.mts +24 -0
- package/dist/rest/listen.mjs +142 -0
- package/dist/rest/me.d.mts +55 -0
- package/dist/rest/me.mjs +21 -0
- package/dist/rest/merges.d.mts +90 -0
- package/dist/rest/merges.mjs +39 -0
- package/dist/rest/paths.mjs +86 -0
- package/dist/rest/queue.d.mts +486 -0
- package/dist/rest/queue.mjs +228 -0
- package/dist/rest/refs.d.mts +232 -0
- package/dist/rest/refs.mjs +86 -0
- package/dist/rest/repos.d.mts +223 -0
- package/dist/rest/repos.mjs +93 -0
- package/dist/rest/tags.d.mts +153 -0
- package/dist/rest/tags.mjs +72 -0
- package/dist/rest/tokens.d.mts +297 -0
- package/dist/rest/tokens.mjs +88 -0
- package/dist/rest/topics.d.mts +257 -0
- package/dist/rest/topics.mjs +116 -0
- package/dist/rest/trees.d.mts +158 -0
- package/dist/rest/trees.mjs +118 -0
- package/dist/rest/wire.mjs +57 -0
- package/dist/rest/work.d.mts +107 -0
- package/dist/rest/work.mjs +77 -0
- package/dist/rest.d.mts +8 -0
- package/dist/rest.mjs +5 -0
- package/dist/server/extension.d.mts +17 -0
- package/dist/server/extension.mjs +93 -0
- package/dist/server/lifecycle.d.mts +3 -0
- package/dist/server/lifecycle.mjs +89 -0
- package/dist/server/routes.d.mts +28 -0
- package/dist/server/routes.mjs +60 -0
- package/dist/server/server.d.mts +8 -0
- package/dist/server/server.mjs +615 -0
- package/dist/signin/codes.mjs +47 -0
- package/dist/signin/context.d.mts +9 -0
- package/dist/signin/context.mjs +121 -0
- package/dist/signin/device.mjs +122 -0
- package/dist/signin/forms.mjs +157 -0
- package/dist/signin/grants.d.mts +5 -0
- package/dist/signin/grants.mjs +257 -0
- package/dist/signin/route.mjs +68 -0
- package/dist/signin/web.mjs +125 -0
- package/dist/signin/wire.d.mts +42 -0
- package/dist/signin/wire.mjs +43 -0
- package/dist/storage/allotted.mjs +102 -0
- package/dist/storage/bits.mjs +41 -0
- package/dist/storage/budget.mjs +96 -0
- package/dist/storage/calls.d.mts +18 -0
- package/dist/storage/calls.mjs +273 -0
- package/dist/storage/clean-up.mjs +124 -0
- package/dist/storage/distinct-ids.mjs +39 -0
- package/dist/storage/ewah.mjs +97 -0
- package/dist/storage/fetch.d.mts +15 -0
- package/dist/storage/fetch.mjs +998 -0
- package/dist/storage/fsck.mjs +77 -0
- package/dist/storage/held-memo.mjs +188 -0
- package/dist/storage/index-bitmaps.d.mts +4 -0
- package/dist/storage/index-bitmaps.mjs +654 -0
- package/dist/storage/index-build.d.mts +15 -0
- package/dist/storage/index-build.mjs +1447 -0
- package/dist/storage/index-fetch.d.mts +10 -0
- package/dist/storage/index-fetch.mjs +677 -0
- package/dist/storage/index-files.mjs +232 -0
- package/dist/storage/index-graph.d.mts +3 -0
- package/dist/storage/index-graph.mjs +1049 -0
- package/dist/storage/index-layers.mjs +317 -0
- package/dist/storage/index-reach.mjs +216 -0
- package/dist/storage/index-remap.d.mts +8 -0
- package/dist/storage/index-remap.mjs +592 -0
- package/dist/storage/layout.mjs +69 -0
- package/dist/storage/lfs-pointers.d.mts +21 -0
- package/dist/storage/lfs-pointers.mjs +175 -0
- package/dist/storage/link-join.mjs +106 -0
- package/dist/storage/links.mjs +105 -0
- package/dist/storage/loose.d.mts +15 -0
- package/dist/storage/loose.mjs +121 -0
- package/dist/storage/memory-budget.d.mts +8 -0
- package/dist/storage/memory-budget.mjs +546 -0
- package/dist/storage/merge.mjs +416 -0
- package/dist/storage/object-rows.d.mts +6 -0
- package/dist/storage/object-rows.mjs +211 -0
- package/dist/storage/pack-order.d.mts +8 -0
- package/dist/storage/pack-order.mjs +781 -0
- package/dist/storage/pack-ranges.d.mts +5 -0
- package/dist/storage/pack-ranges.mjs +284 -0
- package/dist/storage/pack-reads.d.mts +11 -0
- package/dist/storage/pack-reads.mjs +1007 -0
- package/dist/storage/pack-receive.d.mts +11 -0
- package/dist/storage/pack-receive.mjs +449 -0
- package/dist/storage/packs.d.mts +56 -0
- package/dist/storage/packs.mjs +603 -0
- package/dist/storage/prune.mjs +506 -0
- package/dist/storage/push-allotment.mjs +109 -0
- package/dist/storage/push-uploads.mjs +152 -0
- package/dist/storage/pushed-commits.mjs +136 -0
- package/dist/storage/quarantine.mjs +98 -0
- package/dist/storage/raw-ids.mjs +44 -0
- package/dist/storage/ready.d.mts +19 -0
- package/dist/storage/ready.mjs +328 -0
- package/dist/storage/receive-links.mjs +297 -0
- package/dist/storage/repack-job.mjs +48 -0
- package/dist/storage/repack.d.mts +31 -0
- package/dist/storage/repack.mjs +182 -0
- package/dist/storage/roots.mjs +42 -0
- package/dist/storage/rows.d.mts +4 -0
- package/dist/storage/rows.mjs +71 -0
- package/dist/storage/send-list.d.mts +8 -0
- package/dist/storage/send-list.mjs +319 -0
- package/dist/storage/shallow.d.mts +4 -0
- package/dist/storage/shallow.mjs +128 -0
- package/dist/storage/stream-whole.mjs +236 -0
- package/dist/storage/unpack.mjs +238 -0
- package/dist/storage/visible.mjs +137 -0
- package/dist/storage/walk.d.mts +8 -0
- package/dist/storage/walk.mjs +176 -0
- package/dist/storage/wants.mjs +362 -0
- package/dist/store/call-count.d.mts +47 -0
- package/dist/store/call-count.mjs +207 -0
- package/dist/store/catalogue.d.mts +7 -0
- package/dist/store/catalogue.mjs +643 -0
- package/dist/store/closed.d.mts +21 -0
- package/dist/store/closed.mjs +34 -0
- package/dist/store/crossing.mjs +69 -0
- package/dist/store/cursor-seal.d.mts +2 -0
- package/dist/store/cursor-seal.mjs +88 -0
- package/dist/store/errors.d.mts +12 -0
- package/dist/store/errors.mjs +135 -0
- package/dist/store/git-store.mjs +75 -0
- package/dist/store/list-job.mjs +35 -0
- package/dist/store/outbox.d.mts +7 -0
- package/dist/store/outbox.mjs +297 -0
- package/dist/store/promises.d.mts +5 -0
- package/dist/store/promises.mjs +258 -0
- package/dist/store/queue-jobs.mjs +43 -0
- package/dist/store/random.mjs +28 -0
- package/dist/store/records.d.mts +4 -0
- package/dist/store/records.mjs +192 -0
- package/dist/store/ref-rows.d.mts +4 -0
- package/dist/store/ref-rows.mjs +30 -0
- package/dist/store/repo-record.mjs +100 -0
- package/dist/store/reservations.mjs +82 -0
- package/dist/store/scopes.mjs +170 -0
- package/dist/store/settle.mjs +63 -0
- package/dist/store/topic-jobs.mjs +62 -0
- package/dist/sync/bound.d.mts +7 -0
- package/dist/sync/bound.mjs +34 -0
- package/dist/sync/github.d.mts +12 -0
- package/dist/sync/github.mjs +297 -0
- package/dist/sync/import.d.mts +8 -0
- package/dist/sync/import.mjs +154 -0
- package/dist/sync/jobs.d.mts +9 -0
- package/dist/sync/jobs.mjs +83 -0
- package/dist/sync/mirror.d.mts +9 -0
- package/dist/sync/mirror.mjs +227 -0
- package/dist/sync/publish.d.mts +5 -0
- package/dist/sync/publish.mjs +117 -0
- package/dist/sync/records.mjs +73 -0
- package/dist/sync/smart-http.d.mts +8 -0
- package/dist/sync/smart-http.mjs +23 -0
- package/dist/sync/step.mjs +334 -0
- package/dist/sync/tries.mjs +126 -0
- package/dist/sync.d.mts +8 -0
- package/dist/sync.mjs +8 -0
- package/dist/topics/advance.mjs +555 -0
- package/dist/topics/calls.mjs +346 -0
- package/dist/topics/directory.mjs +107 -0
- package/dist/topics/host.d.mts +11 -0
- package/dist/topics/host.mjs +71 -0
- package/dist/topics/members.mjs +177 -0
- package/dist/topics/rows.mjs +99 -0
- package/dist/topics/topic.mjs +141 -0
- package/package.json +86 -5
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
2
|
+
import { Sha1 } from "../protocol/bytes/sha1.mjs";
|
|
3
|
+
import { answerSpent, gitError, pastCallLimit } from "../store/errors.mjs";
|
|
4
|
+
import { copyHeldBytes, isMergeIncomplete, mergeIncomplete } from "./index-bitmaps.mjs";
|
|
5
|
+
import { belowGraphs, copyMergedBitmaps, coveredPacks, indexRowOf, mergeCallsAfterOpen, mergeChunk, newBuildId, putOnce, wordsOf } from "./index-build.mjs";
|
|
6
|
+
import { BasesWriter, TypesWriter, indexBasesBytes, indexTypesBytes, openBases, openTypes, typeCodes } from "./index-files.mjs";
|
|
7
|
+
import { mergeHeldBytes, mergeIndexGraphs } from "./index-graph.mjs";
|
|
8
|
+
import { openLayerBitmaps } from "./index-layers.mjs";
|
|
9
|
+
import { indexFiles, indexRowKey, isPackId } from "./layout.mjs";
|
|
10
|
+
import { joinBytes, joinIds } from "./link-join.mjs";
|
|
11
|
+
import { spentIn } from "../contracts/calls-spent.mjs";
|
|
12
|
+
import { startPut } from "./merge.mjs";
|
|
13
|
+
import { openRanges, rangeRanks, readExactly } from "./pack-ranges.mjs";
|
|
14
|
+
import { compareIds } from "./raw-ids.mjs";
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Exit from "effect/Exit";
|
|
17
|
+
// src/storage/index-remap.ts
|
|
18
|
+
/**
|
|
19
|
+
* The plan of a remap of `layers` once a merge takes `merged`'s packs, of `objects` objects in
|
|
20
|
+
* all: `undefined` when it can't remap, as when a merged pack isn't one the row covers, or a
|
|
21
|
+
* covered pack isn't listed. `listed` is the listing before the merge.
|
|
22
|
+
*/
|
|
23
|
+
const remapPlan = (layers, listed, merged, objects) => {
|
|
24
|
+
const counts = new Map(listed.packs.map((pack) => [pack.id, pack.objects]));
|
|
25
|
+
const prefixPacks = [];
|
|
26
|
+
const tail = [];
|
|
27
|
+
const runs = [];
|
|
28
|
+
let prefix;
|
|
29
|
+
let position = 0;
|
|
30
|
+
let next = 0;
|
|
31
|
+
for (const layer of layers) {
|
|
32
|
+
let row = 0;
|
|
33
|
+
for (const group of layer.groups) {
|
|
34
|
+
for (const id of group.packs) {
|
|
35
|
+
const count = counts.get(id);
|
|
36
|
+
if (count === void 0) return void 0;
|
|
37
|
+
if (prefix === void 0 && merged.has(id)) {
|
|
38
|
+
prefix = position;
|
|
39
|
+
next = position + objects;
|
|
40
|
+
}
|
|
41
|
+
if (prefix === void 0) prefixPacks.push(id);
|
|
42
|
+
else {
|
|
43
|
+
tail.push({
|
|
44
|
+
id,
|
|
45
|
+
objects: count,
|
|
46
|
+
old: position,
|
|
47
|
+
next: merged.has(id) ? void 0 : next
|
|
48
|
+
});
|
|
49
|
+
if (!merged.has(id)) next += count;
|
|
50
|
+
}
|
|
51
|
+
position += count;
|
|
52
|
+
}
|
|
53
|
+
if (group.rows === 0) continue;
|
|
54
|
+
if (prefix === void 0) {
|
|
55
|
+
prefix = position;
|
|
56
|
+
next = position + objects;
|
|
57
|
+
}
|
|
58
|
+
runs.push({
|
|
59
|
+
layer,
|
|
60
|
+
row,
|
|
61
|
+
first: position,
|
|
62
|
+
rows: group.rows
|
|
63
|
+
});
|
|
64
|
+
row += group.rows;
|
|
65
|
+
position += group.rows;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const taken = tail.filter((pack) => merged.has(pack.id)).length;
|
|
69
|
+
if (prefix === void 0 || taken !== merged.size) return void 0;
|
|
70
|
+
return {
|
|
71
|
+
prefix,
|
|
72
|
+
positions: position,
|
|
73
|
+
prefixPacks,
|
|
74
|
+
tail,
|
|
75
|
+
runs,
|
|
76
|
+
rows: runs.reduce((sum, run) => sum + run.rows, 0)
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/** The tail's objects after the remap: the merged pack's, the other packs' and the rows kept. */
|
|
80
|
+
const tailOf = (plan, objects, folded) => objects + plan.tail.reduce((sum, pack) => sum + (pack.next === void 0 ? 0 : pack.objects), 0) + plan.rows - folded;
|
|
81
|
+
/** What the remap holds of each row it keeps while it reads them: its ID's view and old position. */
|
|
82
|
+
const keptRowBytes = 64;
|
|
83
|
+
/**
|
|
84
|
+
* What a remap holds at its most beside its allotment's floor, once a merge of `objects` objects
|
|
85
|
+
* planned: the map, 4 bytes a tail position, with the tail's IDs, the rows kept and their join;
|
|
86
|
+
* then the map through the graph merge's and the copy's, with every bitmap's entry,
|
|
87
|
+
* `mergeEntryBytes`; or `.bases`' rows, the old and the new, with each row's code and a chunk of
|
|
88
|
+
* `.types`.
|
|
89
|
+
*/
|
|
90
|
+
const remapHeldMost = (plan, layers, objects) => {
|
|
91
|
+
const tail = plan.positions - plan.prefix;
|
|
92
|
+
const positions = plan.prefix + tail + objects;
|
|
93
|
+
const commits = layers.reduce((sum, layer) => sum + layer.commits, 0);
|
|
94
|
+
const bitmaps = layers.reduce((sum, layer) => sum + layer.bitmaps, 0);
|
|
95
|
+
const deltas = layers.reduce((sum, layer) => sum + layer.deltas, 0);
|
|
96
|
+
const files = layers.map((layer) => layer.first + layer.positions);
|
|
97
|
+
const map = tail * 4;
|
|
98
|
+
const phases = [
|
|
99
|
+
map + tail * 20 + joinBytes(tail) + plan.rows * keptRowBytes,
|
|
100
|
+
map + commits * 4 + mergeHeldBytes(layers.length),
|
|
101
|
+
map + bitmaps * 640 + copyHeldBytes(positions, bitmaps, files),
|
|
102
|
+
map + bitmaps * 640 + deltas * 16 + objects * 8 + plan.rows * 112 + mergeChunk * 9
|
|
103
|
+
];
|
|
104
|
+
return Math.max(...phases);
|
|
105
|
+
};
|
|
106
|
+
/** Where `layers` hold an old position: its layer and its place there. */
|
|
107
|
+
const layerAt = (layers, position) => layers.find((layer) => position >= layer.first && position < layer.first + layer.positions);
|
|
108
|
+
/** The `.types` parts `oldTypes` reads over old positions `[from, to)`: one a layer or chunk. */
|
|
109
|
+
const typesParts = (layers, from, to) => {
|
|
110
|
+
let parts = 0;
|
|
111
|
+
for (let at = from; at < to; parts += 1) {
|
|
112
|
+
const layer = layerAt(layers, at);
|
|
113
|
+
if (layer === void 0) return parts + 1;
|
|
114
|
+
at = Math.min(to, layer.first + layer.positions, at + mergeChunk);
|
|
115
|
+
}
|
|
116
|
+
return parts;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* The bucket calls a remap makes past its graphs' heads, at most: the tail's ranges read, ID and
|
|
120
|
+
* position chunks, and joined against the new tail's; the rows' regions; each layer's `.types`
|
|
121
|
+
* header, then its parts as `oldTypes` reads them, the prefix's, each kept tail pack's and each
|
|
122
|
+
* run's, apart at every layer's edge and chunk; then what a layer merge of the same layers makes
|
|
123
|
+
* with no tips, which reads more than the remap's graphs, bitmaps and `.bases`.
|
|
124
|
+
*/
|
|
125
|
+
const remapCalls = (plan, layers, objects, mergeCalls) => {
|
|
126
|
+
const chunks = (count) => 2 * Math.ceil(count / rangeRanks);
|
|
127
|
+
const stays = plan.tail.filter((pack) => pack.next !== void 0);
|
|
128
|
+
const read = plan.tail.reduce((sum, pack) => sum + 2 + chunks(pack.objects), 0);
|
|
129
|
+
const joined = 2 + chunks(objects) + stays.reduce((sum, pack) => sum + chunks(pack.objects), 0);
|
|
130
|
+
const ranges = [
|
|
131
|
+
{
|
|
132
|
+
from: 0,
|
|
133
|
+
to: plan.prefix
|
|
134
|
+
},
|
|
135
|
+
...stays.map((pack) => ({
|
|
136
|
+
from: pack.old,
|
|
137
|
+
to: pack.old + pack.objects
|
|
138
|
+
})),
|
|
139
|
+
...plan.runs.map((run) => ({
|
|
140
|
+
from: run.first,
|
|
141
|
+
to: run.first + run.rows
|
|
142
|
+
}))
|
|
143
|
+
];
|
|
144
|
+
const types = layers.length + ranges.reduce((sum, range) => sum + typesParts(layers, range.from, range.to), 0);
|
|
145
|
+
return read + joined + plan.runs.length + types + mergeCalls;
|
|
146
|
+
};
|
|
147
|
+
/** A remap's CPU at most by default, in ms: 10% of a Worker's 300 s `cpu_ms`. Past it, the repo rebuilds. */
|
|
148
|
+
const defaultRemapCpuMost = 3e4;
|
|
149
|
+
/** A remap's units: every bitmap of `layers`, each over the tail's positions. */
|
|
150
|
+
const remapUnits = (plan, layers) => layers.reduce((sum, layer) => sum + layer.bitmaps, 0) * (plan.positions - plan.prefix);
|
|
151
|
+
/** Whether a remap's CPU, its units at `remapNsPerUnit`, would pass `cpuMost` ms. */
|
|
152
|
+
const remapCpuPast = (units, cpuMost) => units * 13 > Math.round(cpuMost * 1e6);
|
|
153
|
+
/**
|
|
154
|
+
* The calls a remap makes past its graphs' heads: `remapCalls` with a layer merge's reads of
|
|
155
|
+
* graphs of `octopus` table entries each.
|
|
156
|
+
*/
|
|
157
|
+
const callsAfterHeads = (plan, layers, objects, octopus) => remapCalls(plan, layers, objects, mergeCallsAfterOpen({
|
|
158
|
+
layers,
|
|
159
|
+
octopus,
|
|
160
|
+
packs: [],
|
|
161
|
+
tips: 0
|
|
162
|
+
}));
|
|
163
|
+
/**
|
|
164
|
+
* The calls a remap makes at most, from the row alone: its graphs' heads, then `callsAfterHeads`
|
|
165
|
+
* of graphs that each hold an octopus table. Only the heads say how many entries a table holds,
|
|
166
|
+
* so the remap checks again once it has read them, before any other read.
|
|
167
|
+
*/
|
|
168
|
+
const remapCallsMost = (plan, layers, objects) => 2 * layers.length + callsAfterHeads(plan, layers, objects, layers.map(() => 1));
|
|
169
|
+
/**
|
|
170
|
+
* The most calls a remap's own handles may reach, on the try's count: the try's bound less the
|
|
171
|
+
* listing's commit's one subrequest, so a remap that runs past its forecast stops with
|
|
172
|
+
* `CallsSpent` before the commit's call, which it always keeps.
|
|
173
|
+
*/
|
|
174
|
+
const remapCallsBound = (most) => ({
|
|
175
|
+
bucket: most.bucket,
|
|
176
|
+
subrequests: Math.max(0, most.subrequests - 1)
|
|
177
|
+
});
|
|
178
|
+
/** Whether `needs` more calls, then the listing's commit, pass what the try has left. */
|
|
179
|
+
const pastCallsLeft = (calls, needs) => {
|
|
180
|
+
if (calls === void 0) return false;
|
|
181
|
+
const made = calls.made();
|
|
182
|
+
return made.bucket + needs > calls.most.bucket || made.subrequests + needs + 1 > calls.most.subrequests;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Whether a remap would pass a bound, chosen before it reads, from the row and the merge alone.
|
|
186
|
+
* Its CPU, its units at `remapNsPerUnit`, is held to `cpuMost`. Its files are first put after
|
|
187
|
+
* `at`, so with its try ending within `lease` of `at`, it commits before prune's `grace` has
|
|
188
|
+
* passed since their upload while `lease` is under `grace`. Its calls, the graphs' heads and
|
|
189
|
+
* `remapCalls` with every graph's octopus table, as a layer merge reads them, and the listing's
|
|
190
|
+
* commit, are held to what the try has left, then again with the heads' own octopus counts once
|
|
191
|
+
* `remapIndex` has read them. Last, what it holds at its most must fit the
|
|
192
|
+
* allotment at once: `tryGrow` it, then give it back.
|
|
193
|
+
*/
|
|
194
|
+
const remapPast = (input) => {
|
|
195
|
+
const { plan, row, merged } = input;
|
|
196
|
+
const layers = row.layers;
|
|
197
|
+
if (remapCpuPast(remapUnits(plan, layers), input.cpuMost)) return "cpu";
|
|
198
|
+
if (input.lease !== void 0 && input.lease >= input.grace) return "lease";
|
|
199
|
+
if (pastCallsLeft(input.calls, remapCallsMost(plan, layers, merged.pack.objects))) return "calls";
|
|
200
|
+
const held = remapHeldMost(plan, layers, merged.pack.objects);
|
|
201
|
+
if (!input.allotment.tryGrow(held)) return "memory";
|
|
202
|
+
input.allotment.shrink(held);
|
|
203
|
+
};
|
|
204
|
+
const lost = (message) => gitError("DATA_LOSS", message);
|
|
205
|
+
/**
|
|
206
|
+
* A remap's decline, one line in the log with its cause, so a bound it always passes shows as a
|
|
207
|
+
* pattern: then the merge commits alone, and the next `git.index` builds again.
|
|
208
|
+
*/
|
|
209
|
+
const declined = (repo, cause) => Effect.logWarning(`git.repack's remap of repo ${repo} declined, ${cause}`).pipe(Effect.as(void 0));
|
|
210
|
+
/** A remap's allotment's refusal to grow, its own, so `remapFailure` tells it from another's. */
|
|
211
|
+
const remapBusy = gitError("UNAVAILABLE", "A repack's remap couldn't grow its allotment", { context: { reason: "busy" } });
|
|
212
|
+
/**
|
|
213
|
+
* What a remap that started failed on of its own, when it did: its calls, as its handles' bound or
|
|
214
|
+
* the platform's cap stops them; its allotment's grow; or a stored file it read, lost or not as
|
|
215
|
+
* written. `remapRow` takes a merge found incomplete, `isMergeIncomplete`, before it asks: the
|
|
216
|
+
* merged pack's own files among it, as `mergedOwn` says.
|
|
217
|
+
*/
|
|
218
|
+
const remapFailure = (error) => {
|
|
219
|
+
if (spentIn(error) !== void 0 || pastCallLimit(error)) return "its calls ran out";
|
|
220
|
+
if (error === remapBusy) return "its allotment couldn't grow";
|
|
221
|
+
return error.code === "DATA_LOSS" ? "a file it read is lost or corrupt" : void 0;
|
|
222
|
+
};
|
|
223
|
+
/** The order a merged pack writes its kinds in, as `writeMerged` does. */
|
|
224
|
+
const kindOrder = [
|
|
225
|
+
"commit",
|
|
226
|
+
"tag",
|
|
227
|
+
"tree",
|
|
228
|
+
"blob"
|
|
229
|
+
];
|
|
230
|
+
/** `pack`'s ranges, its first position `base`. */
|
|
231
|
+
const rangesOf = (bucket, id, objects, bytes, base) => isPackId(id) ? openRanges(bucket, {
|
|
232
|
+
id,
|
|
233
|
+
bytes
|
|
234
|
+
}, objects, base) : Effect.fail(lost(`'${id}' isn't a pack's ID`));
|
|
235
|
+
/** `read` of the merged pack's own files: lost or corrupt, it's the merge's fault (`mergeIncomplete`). */
|
|
236
|
+
const mergedOwn = (read) => read.pipe(Effect.mapError((error) => error.code === "DATA_LOSS" && !isMergeIncomplete(error) ? mergeIncomplete(error.message) : error));
|
|
237
|
+
/**
|
|
238
|
+
* The merged pack's ranges, from `base`, each read of them the merge's own (`mergedOwn`). Its IDs
|
|
239
|
+
* are checked in order as `joinIds` reads them, from rank 0 up, so the merge's index out of order
|
|
240
|
+
* fails the step too, before `joinIds`' own check calls it a stored file's.
|
|
241
|
+
*/
|
|
242
|
+
const mergedRanges = (bucket, pack, base) => Effect.map(mergedOwn(rangesOf(bucket, pack.id, pack.objects, pack.bytes, base)), (ranges) => {
|
|
243
|
+
let last;
|
|
244
|
+
return {
|
|
245
|
+
...ranges,
|
|
246
|
+
offsets: (rank, length) => mergedOwn(ranges.offsets(rank, length)),
|
|
247
|
+
positions: (rank, length) => mergedOwn(ranges.positions(rank, length)),
|
|
248
|
+
ids: (rank, length) => Effect.flatMap(mergedOwn(ranges.ids(rank, length)), (ids) => {
|
|
249
|
+
if (rank === 0) last = void 0;
|
|
250
|
+
for (let at = 0; at < length; at += 1) {
|
|
251
|
+
const before = at === 0 ? last : ids.subarray((at - 1) * 20, at * 20);
|
|
252
|
+
if (before !== void 0 && compareIds(before, 0, ids, at * 20) >= 0) return Effect.fail(mergeIncomplete(`The merged pack ${pack.id}'s index isn't in ID order`));
|
|
253
|
+
}
|
|
254
|
+
if (length > 0) last = ids.subarray((length - 1) * 20, length * 20);
|
|
255
|
+
return Effect.succeed(ids);
|
|
256
|
+
})
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
/**
|
|
260
|
+
* Each tail position's ID, by its old position, and the rows the merge left: theirs from each
|
|
261
|
+
* run's region, by ID, each with its old position. `undefined` when a folded row isn't one the
|
|
262
|
+
* row held.
|
|
263
|
+
*/
|
|
264
|
+
const tailIds = (input, old) => Effect.gen(function* () {
|
|
265
|
+
const { bucket, listed, plan } = input;
|
|
266
|
+
const tail = plan.positions - plan.prefix;
|
|
267
|
+
const ids = new Uint8Array(tail * 20);
|
|
268
|
+
for (const ranges of old) for (let rank = 0; rank < ranges.count; rank += rangeRanks) {
|
|
269
|
+
const count = Math.min(rangeRanks, ranges.count - rank);
|
|
270
|
+
const chunk = yield* ranges.ids(rank, count);
|
|
271
|
+
const positions = yield* ranges.positions(rank, count);
|
|
272
|
+
for (let at = 0; at < count; at += 1) {
|
|
273
|
+
const place = ranges.base + (positions[at] ?? 0) - plan.prefix;
|
|
274
|
+
ids.set(chunk.subarray(at * 20, at * 20 + 20), place * 20);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const folded = new Set(input.folded);
|
|
278
|
+
const kept = [];
|
|
279
|
+
let found = 0;
|
|
280
|
+
for (const run of plan.runs) {
|
|
281
|
+
const key = indexFiles(listed.repo, run.layer.build).region;
|
|
282
|
+
const region = yield* readExactly(bucket, key, run.row * 20, run.rows * 20);
|
|
283
|
+
for (let at = 0; at < run.rows; at += 1) {
|
|
284
|
+
const id = region.subarray(at * 20, at * 20 + 20);
|
|
285
|
+
ids.set(id, (run.first + at - plan.prefix) * 20);
|
|
286
|
+
if (folded.has(hexOf(id))) found += 1;
|
|
287
|
+
else kept.push({
|
|
288
|
+
id,
|
|
289
|
+
old: run.first + at
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (found !== folded.size) return void 0;
|
|
294
|
+
kept.sort((a, b) => compareIds(a.id, 0, b.id, 0));
|
|
295
|
+
return {
|
|
296
|
+
ids,
|
|
297
|
+
kept
|
|
298
|
+
};
|
|
299
|
+
});
|
|
300
|
+
/** A bitmap's bits moved: the prefix's words as they were, each tail bit through `map`. */
|
|
301
|
+
const movedBits = (prefix, map) => (bits, into) => {
|
|
302
|
+
const whole = prefix >>> 5;
|
|
303
|
+
into.set(bits.subarray(0, Math.min(whole, into.length)));
|
|
304
|
+
for (let word = whole; word < bits.length; word += 1) {
|
|
305
|
+
let left = bits[word] ?? 0;
|
|
306
|
+
while (left !== 0) {
|
|
307
|
+
const low = left & -left;
|
|
308
|
+
left ^= low;
|
|
309
|
+
const position = word * 32 + (31 - Math.clz32(low));
|
|
310
|
+
const to = position < prefix ? position : map[position - prefix] ?? 4294967295;
|
|
311
|
+
if (to !== 4294967295) into[to >>> 5] = (into[to >>> 5] ?? 0) | 1 << (to & 31);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
/** Each layer's `.types`, its header read and checked once a remap, as a layer merge opens it. */
|
|
316
|
+
const layerTypes = (input) => {
|
|
317
|
+
const opened = /* @__PURE__ */ new Map();
|
|
318
|
+
return (layer) => Effect.gen(function* () {
|
|
319
|
+
const known = opened.get(layer.build);
|
|
320
|
+
if (known !== void 0) return known;
|
|
321
|
+
const key = indexFiles(input.listed.repo, layer.build).types;
|
|
322
|
+
const types = yield* openTypes(input.bucket, key, layer.positions);
|
|
323
|
+
opened.set(layer.build, types);
|
|
324
|
+
return types;
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* The codes of old positions `[from, to)`, read from the layers holding them, a chunk at a time,
|
|
329
|
+
* each chunk into `write`.
|
|
330
|
+
*/
|
|
331
|
+
const oldTypes = (input, typesOf, from, to, write) => Effect.gen(function* () {
|
|
332
|
+
for (let at = from; at < to;) {
|
|
333
|
+
const layer = layerAt(input.row.layers, at);
|
|
334
|
+
if (layer === void 0) return yield* Effect.fail(lost(`No layer holds position ${at}`));
|
|
335
|
+
const end = Math.min(to, layer.first + layer.positions, at + mergeChunk);
|
|
336
|
+
yield* write(yield* (yield* typesOf(layer)).codesOf(at - layer.first, end - layer.first), at);
|
|
337
|
+
at = end;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
/** The old `.bases` rows of every layer, in position order. */
|
|
341
|
+
const oldBases = (input) => Effect.gen(function* () {
|
|
342
|
+
const deltas = input.row.layers.reduce((sum, layer) => sum + layer.deltas, 0);
|
|
343
|
+
const rows = new Uint32Array(deltas * 2);
|
|
344
|
+
let at = 0;
|
|
345
|
+
for (const layer of input.row.layers) {
|
|
346
|
+
const key = indexFiles(input.listed.repo, layer.build).bases;
|
|
347
|
+
yield* openBases(input.bucket, key, layer.first + layer.positions);
|
|
348
|
+
for (let from = 0; from < layer.deltas; from += mergeChunk) {
|
|
349
|
+
const count = Math.min(layer.deltas - from, mergeChunk);
|
|
350
|
+
const bytes = yield* readExactly(input.bucket, key, 16 + from * 8, count * 8);
|
|
351
|
+
rows.set(wordsOf(bytes), at);
|
|
352
|
+
at += count * 2;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return rows;
|
|
356
|
+
});
|
|
357
|
+
/**
|
|
358
|
+
* The remapped `.bases` rows: the prefix's as they were; the merged pack's, from its own plan,
|
|
359
|
+
* past the prefix; and each other tail pack's, moved as its pack is. A row of a merged pack is
|
|
360
|
+
* gone, its pack's objects the merged pack's now.
|
|
361
|
+
*/
|
|
362
|
+
const remappedBases = (input, old) => {
|
|
363
|
+
const { plan, merged } = input;
|
|
364
|
+
const out = new Uint32Array(old.length + merged.bases.length);
|
|
365
|
+
let length = 0;
|
|
366
|
+
const push = (position, base) => {
|
|
367
|
+
out[length] = position;
|
|
368
|
+
out[length + 1] = base;
|
|
369
|
+
length += 2;
|
|
370
|
+
};
|
|
371
|
+
for (let at = 0; at < old.length && (old[at] ?? 0) < plan.prefix; at += 2) push(old[at] ?? 0, old[at + 1] ?? 0);
|
|
372
|
+
for (let at = 0; at < merged.bases.length; at += 2) push((merged.bases[at] ?? 0) + plan.prefix, (merged.bases[at + 1] ?? 0) + plan.prefix);
|
|
373
|
+
for (let at = 0; at < old.length; at += 2) {
|
|
374
|
+
const position = old[at] ?? 0;
|
|
375
|
+
const pack = plan.tail.find((each) => position >= each.old && position < each.old + each.objects);
|
|
376
|
+
if (pack?.next === void 0) continue;
|
|
377
|
+
const shift = pack.next - pack.old;
|
|
378
|
+
push(position + shift, (old[at + 1] ?? 0) + shift);
|
|
379
|
+
}
|
|
380
|
+
return out.subarray(0, length);
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* The remap: the row's layers laid again as one, under a new build, over the listing the merge
|
|
384
|
+
* leaves, every file put before the row is answered. `undefined` when it can't remap: it's past
|
|
385
|
+
* a bound, as `remapPast` chooses before it reads; its octopus tables, which only its graphs'
|
|
386
|
+
* heads count, would take more calls than the try has left; or a row the merge folded isn't one
|
|
387
|
+
* the row held. Then the listing commits without it, and the next `git.index` builds again, as
|
|
388
|
+
* #617 does.
|
|
389
|
+
*/
|
|
390
|
+
const remapIndex = (input) => Effect.gen(function* () {
|
|
391
|
+
const { bucket, listed, plan, merged, allotment, row } = input;
|
|
392
|
+
const layers = row.layers;
|
|
393
|
+
const past = remapPast(input);
|
|
394
|
+
if (past !== void 0) return yield* declined(listed.repo, `past its ${past} bound`);
|
|
395
|
+
const graphs = yield* belowGraphs(bucket, listed.repo, layers);
|
|
396
|
+
const octopus = graphs.map((graph) => graph.octopus);
|
|
397
|
+
if (pastCallsLeft(input.calls, callsAfterHeads(plan, layers, merged.pack.objects, octopus))) return yield* declined(listed.repo, "past its calls bound, with its graphs' octopus tables");
|
|
398
|
+
const build = newBuildId();
|
|
399
|
+
const files = indexFiles(listed.repo, build);
|
|
400
|
+
const objects = merged.pack.objects;
|
|
401
|
+
const positions = plan.prefix + tailOf(plan, objects, input.folded.length);
|
|
402
|
+
const tail = plan.positions - plan.prefix;
|
|
403
|
+
const bytesOf = new Map(listed.packs.map((pack) => [pack.id, pack.bytes]));
|
|
404
|
+
yield* allotment.grow(tail * 4);
|
|
405
|
+
yield* allotment.grow(tail * 20 + joinBytes(tail));
|
|
406
|
+
const old = yield* Effect.forEach(plan.tail, (pack) => rangesOf(bucket, pack.id, pack.objects, bytesOf.get(pack.id) ?? 0, pack.old));
|
|
407
|
+
const read = yield* tailIds(input, old);
|
|
408
|
+
if (read === void 0) {
|
|
409
|
+
allotment.shrink(tail * 24 + joinBytes(tail));
|
|
410
|
+
return yield* declined(listed.repo, "a row the merge folded isn't one the row held");
|
|
411
|
+
}
|
|
412
|
+
const rowsFirst = positions - read.kept.length;
|
|
413
|
+
const regionIds = new Uint8Array(read.kept.length * 20);
|
|
414
|
+
for (const [at, each] of read.kept.entries()) regionIds.set(each.id, at * 20);
|
|
415
|
+
const next = [yield* mergedRanges(bucket, merged.pack, plan.prefix), ...plan.tail.flatMap((pack, at) => {
|
|
416
|
+
const ranges = old[at];
|
|
417
|
+
return pack.next === void 0 || ranges === void 0 ? [] : [{
|
|
418
|
+
...ranges,
|
|
419
|
+
base: pack.next
|
|
420
|
+
}];
|
|
421
|
+
})];
|
|
422
|
+
const region = {
|
|
423
|
+
ids: regionIds,
|
|
424
|
+
positions: Uint32Array.from(read.kept, (_, at) => rowsFirst + at)
|
|
425
|
+
};
|
|
426
|
+
const map = yield* joinIds(read.ids, tail, next, region);
|
|
427
|
+
allotment.shrink(tail * 20 + joinBytes(tail));
|
|
428
|
+
if (map.includes(4294967295)) return yield* Effect.fail(mergeIncomplete("The merge left a tail object out"));
|
|
429
|
+
const { commits } = yield* mergeIndexGraphs({
|
|
430
|
+
bucket,
|
|
431
|
+
graphs,
|
|
432
|
+
key: files.graph,
|
|
433
|
+
allotment
|
|
434
|
+
});
|
|
435
|
+
const entries = layers.reduce((sum, layer) => sum + layer.bitmaps, 0) * 640;
|
|
436
|
+
yield* allotment.grow(entries);
|
|
437
|
+
const stored = yield* openLayerBitmaps(bucket, listed.repo, layers);
|
|
438
|
+
const move = {
|
|
439
|
+
bits: movedBits(plan.prefix, map),
|
|
440
|
+
position: (at) => {
|
|
441
|
+
const to = at < plan.prefix ? at : map[at - plan.prefix] ?? 4294967295;
|
|
442
|
+
return to === 4294967295 ? void 0 : to;
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
const bitmaps = yield* copyMergedBitmaps({
|
|
446
|
+
bucket,
|
|
447
|
+
graphs,
|
|
448
|
+
files,
|
|
449
|
+
positions,
|
|
450
|
+
kept: stored.entries,
|
|
451
|
+
allotment,
|
|
452
|
+
move
|
|
453
|
+
});
|
|
454
|
+
const filesBytes = layers.reduce((sum, layer) => sum + layer.deltas, 0) * 16 + objects * 8 + plan.rows * 112 + mergeChunk * 9;
|
|
455
|
+
yield* allotment.grow(filesBytes);
|
|
456
|
+
const types = Effect.gen(function* () {
|
|
457
|
+
const writer = new TypesWriter(positions);
|
|
458
|
+
const put = yield* startPut(bucket, files.types, { size: indexTypesBytes(positions) });
|
|
459
|
+
yield* Effect.addFinalizer((exit) => Exit.isFailure(exit) ? put.abort : Effect.void);
|
|
460
|
+
const write = (codes) => Effect.flatMap(writer.part(codes), put.write);
|
|
461
|
+
yield* put.write(writer.head());
|
|
462
|
+
const typesOf = layerTypes(input);
|
|
463
|
+
yield* oldTypes(input, typesOf, 0, plan.prefix, write);
|
|
464
|
+
for (const kind of kindOrder) for (let left = merged.kinds[kind]; left > 0; left -= mergeChunk) yield* write(new Uint8Array(Math.min(left, mergeChunk)).fill(typeCodes[kind]));
|
|
465
|
+
for (const pack of plan.tail) if (pack.next !== void 0) yield* oldTypes(input, typesOf, pack.old, pack.old + pack.objects, write);
|
|
466
|
+
const rowCodes = /* @__PURE__ */ new Map();
|
|
467
|
+
for (const run of plan.runs) yield* oldTypes(input, typesOf, run.first, run.first + run.rows, (codes, first) => Effect.sync(() => {
|
|
468
|
+
for (const [at, code] of codes.entries()) rowCodes.set(first + at, code);
|
|
469
|
+
}));
|
|
470
|
+
yield* write(Uint8Array.from(read.kept, (each) => rowCodes.get(each.old) ?? 0));
|
|
471
|
+
yield* put.write(yield* writer.end());
|
|
472
|
+
yield* put.finish;
|
|
473
|
+
});
|
|
474
|
+
const remapped = remappedBases(input, yield* oldBases(input));
|
|
475
|
+
const deltas = remapped.length / 2;
|
|
476
|
+
const bases = Effect.gen(function* () {
|
|
477
|
+
const writer = new BasesWriter(positions, deltas);
|
|
478
|
+
const put = yield* startPut(bucket, files.bases, { size: indexBasesBytes(positions, deltas) });
|
|
479
|
+
yield* Effect.addFinalizer((exit) => Exit.isFailure(exit) ? put.abort : Effect.void);
|
|
480
|
+
yield* put.write(writer.head());
|
|
481
|
+
for (let at = 0; at < remapped.length; at += mergeChunk * 2) yield* put.write(yield* writer.rows(remapped.subarray(at, at + mergeChunk * 2)));
|
|
482
|
+
yield* put.write(yield* writer.end());
|
|
483
|
+
yield* put.finish;
|
|
484
|
+
});
|
|
485
|
+
yield* Effect.scoped(types);
|
|
486
|
+
yield* Effect.scoped(bases);
|
|
487
|
+
allotment.shrink(filesBytes + entries + tail * 4);
|
|
488
|
+
const sha = new Sha1();
|
|
489
|
+
sha.update(regionIds);
|
|
490
|
+
if (regionIds.byteLength > 0) yield* putOnce(bucket, files.region, regionIds);
|
|
491
|
+
const layer = {
|
|
492
|
+
build,
|
|
493
|
+
groups: [{
|
|
494
|
+
packs: [
|
|
495
|
+
...plan.prefixPacks,
|
|
496
|
+
merged.pack.id,
|
|
497
|
+
...plan.tail.flatMap((pack) => pack.next === void 0 ? [] : [pack.id])
|
|
498
|
+
],
|
|
499
|
+
rows: read.kept.length
|
|
500
|
+
}],
|
|
501
|
+
region: hexOf(sha.digest()),
|
|
502
|
+
first: 0,
|
|
503
|
+
positions,
|
|
504
|
+
graphFirst: 0,
|
|
505
|
+
commits,
|
|
506
|
+
deltas,
|
|
507
|
+
bitmaps: bitmaps.count,
|
|
508
|
+
table: bitmaps.table
|
|
509
|
+
};
|
|
510
|
+
return {
|
|
511
|
+
rounds: row.rounds,
|
|
512
|
+
layers: [layer],
|
|
513
|
+
replaced: [...row.replaced.filter((each) => each.at + input.grace > input.at), ...layers.map((each) => ({
|
|
514
|
+
build: each.build,
|
|
515
|
+
at: input.at
|
|
516
|
+
}))]
|
|
517
|
+
};
|
|
518
|
+
});
|
|
519
|
+
/**
|
|
520
|
+
* The `index` row a geometric step's merge leaves, laid again over its pack, or `undefined` when
|
|
521
|
+
* it can't be: the row isn't built, is a refusal for spent tries, or doesn't cover the listing
|
|
522
|
+
* before the merge; the merge took a pack it doesn't cover; the remap declines, as `remapIndex`
|
|
523
|
+
* says; or it fails of its own, its calls run out, its allotment can't grow, or a stored file it
|
|
524
|
+
* reads is lost or corrupt, each logged with its cause. Then the listing commits without it, and
|
|
525
|
+
* the next `git.index` builds again. A merge it finds incomplete, the merged pack's own files lost
|
|
526
|
+
* or corrupt among it, fails the step, an error in the log; so do an interruption, a defect and
|
|
527
|
+
* any other failure.
|
|
528
|
+
*/
|
|
529
|
+
const remapRow = (parts, input) => Effect.scoped(Effect.gen(function* () {
|
|
530
|
+
const row = indexRowOf({
|
|
531
|
+
...indexRowKey,
|
|
532
|
+
value: parts.row
|
|
533
|
+
});
|
|
534
|
+
if (row === void 0 || "refused" in row || row.refusal !== void 0) return void 0;
|
|
535
|
+
if (!coversListing(row.layers, input.listed)) return void 0;
|
|
536
|
+
const plan = remapPlan(row.layers, input.listed, input.taken, input.merged.pack.objects);
|
|
537
|
+
if (plan === void 0) return void 0;
|
|
538
|
+
const { calls } = parts;
|
|
539
|
+
const built = yield* remapIndex({
|
|
540
|
+
bucket: calls === void 0 ? input.bucket : calls.within(remapCallsBound(calls.most)).bucket,
|
|
541
|
+
listed: input.listed,
|
|
542
|
+
row,
|
|
543
|
+
plan,
|
|
544
|
+
merged: input.merged,
|
|
545
|
+
folded: input.folded,
|
|
546
|
+
allotment: yield* parts.budget.allot(0, remapBusy),
|
|
547
|
+
at: input.at,
|
|
548
|
+
grace: parts.grace,
|
|
549
|
+
cpuMost: parts.cpuMost,
|
|
550
|
+
lease: parts.lease,
|
|
551
|
+
calls: calls === void 0 ? void 0 : {
|
|
552
|
+
made: calls.made,
|
|
553
|
+
most: calls.most
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
return built === void 0 ? void 0 : {
|
|
557
|
+
...indexRowKey,
|
|
558
|
+
value: built
|
|
559
|
+
};
|
|
560
|
+
})).pipe(answerSpent, Effect.catch((error) => {
|
|
561
|
+
if (isMergeIncomplete(error)) return Effect.logError(`git.repack's remap of repo ${input.listed.repo} found its merge incomplete: ${error.message}`).pipe(Effect.andThen(Effect.fail(error)));
|
|
562
|
+
const cause = remapFailure(error);
|
|
563
|
+
if (cause === void 0) return Effect.fail(error);
|
|
564
|
+
const line = `git.repack's remap of repo ${input.listed.repo} declined, ${cause}: ${error.message}`;
|
|
565
|
+
return (error.code === "DATA_LOSS" ? Effect.logError(line) : Effect.logWarning(line)).pipe(Effect.as(void 0));
|
|
566
|
+
}));
|
|
567
|
+
/**
|
|
568
|
+
* `row`, a remap's laid row, with the builds it replaced at the try's `at` stamped `now`, when its
|
|
569
|
+
* commit lands: a read of the row before it may start until then, and prune keeps a replaced
|
|
570
|
+
* build's files for a grace past its stamp.
|
|
571
|
+
*/
|
|
572
|
+
const replacedAtCommit = (row, at, now) => {
|
|
573
|
+
const built = indexRowOf(row);
|
|
574
|
+
if (now <= at || built === void 0 || "refused" in built) return row;
|
|
575
|
+
const replaced = built.replaced.map((each) => each.at === at ? {
|
|
576
|
+
...each,
|
|
577
|
+
at: now
|
|
578
|
+
} : each);
|
|
579
|
+
return {
|
|
580
|
+
...row,
|
|
581
|
+
value: {
|
|
582
|
+
...built,
|
|
583
|
+
replaced
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
};
|
|
587
|
+
/** Whether every pack `layers` cover is one of `listed`'s, and every listed one covered. */
|
|
588
|
+
const coversListing = (layers, listed) => {
|
|
589
|
+
const covered = coveredPacks(layers);
|
|
590
|
+
return covered.size === listed.packs.length && listed.packs.every((pack) => covered.has(pack.id));
|
|
591
|
+
};
|
|
592
|
+
export { coversListing, defaultRemapCpuMost, movedBits, remapCalls, remapCallsBound, remapCallsMost, remapCpuPast, remapHeldMost, remapIndex, remapPast, remapPlan, remapRow, remapUnits, replacedAtCommit };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { randomText } from "../store/random.mjs";
|
|
2
|
+
// src/storage/layout.ts
|
|
3
|
+
const newPackId = () => `p_${randomText(12)}`;
|
|
4
|
+
const isPackId = (text) => /^p_[A-Za-z0-9_-]{16}$/.test(text);
|
|
5
|
+
/** The rows `loose()` and `packs()` keep in a repo's scope, beside C's `refs` and `packs`. */
|
|
6
|
+
const objectCollections = {
|
|
7
|
+
/** A pack being written, by its ID, added before any byte: `QuarantineRow`. */
|
|
8
|
+
quarantine: "quarantine",
|
|
9
|
+
/** A pack no list names any more, by its ID, kept until its bytes are cleaned: `LeavingRow`. */
|
|
10
|
+
leaving: "leaving",
|
|
11
|
+
/** One object as a row, by its ID: every object `loose()` holds, and a small push's. */
|
|
12
|
+
objects: "objects",
|
|
13
|
+
/** A cruft pack, by its ID: when a prune pass found its objects unreached, `CruftRow`. */
|
|
14
|
+
cruft: "cruft",
|
|
15
|
+
/** The last prune pass, `pass`: when it ran, `PrunePass`. */
|
|
16
|
+
prune: "prune",
|
|
17
|
+
/** The pack kept ready for a shallow clone of the default branch, by `shallow`: `ReadyRow`. */
|
|
18
|
+
ready: "ready",
|
|
19
|
+
/** The reachability index, `current`: `IndexRow`, its build's files under `index/<repo>/`. */
|
|
20
|
+
index: "index"
|
|
21
|
+
};
|
|
22
|
+
/** The repo's `index` row: a commit that moves a ref where it's missing saves `git.index`. */
|
|
23
|
+
const indexRowKey = {
|
|
24
|
+
collection: objectCollections.index,
|
|
25
|
+
id: "current"
|
|
26
|
+
};
|
|
27
|
+
/** Where one repo's index files are. */
|
|
28
|
+
const indexPrefix = (repo) => `index/${repo}/`;
|
|
29
|
+
/** One build's files: a layer's, since each layer of an index is a build of its own. */
|
|
30
|
+
const indexFiles = (repo, build) => {
|
|
31
|
+
const at = `${indexPrefix(repo)}${build}`;
|
|
32
|
+
return {
|
|
33
|
+
graph: `${at}.graph`,
|
|
34
|
+
bitmaps: `${at}.bitmaps`,
|
|
35
|
+
types: `${at}.types`,
|
|
36
|
+
bases: `${at}.bases`,
|
|
37
|
+
region: `${at}.region`,
|
|
38
|
+
regionGraph: `${at}/region.graph`,
|
|
39
|
+
edges: (slice) => `${at}/edges/${slice}`,
|
|
40
|
+
typesPart: (slice) => `${at}/types/${slice}`,
|
|
41
|
+
basesPart: (slice) => `${at}/bases/${slice}`
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const packFiles = (pack) => ({
|
|
45
|
+
pack: `packs/${pack}.pack`,
|
|
46
|
+
idx: `packs/${pack}.idx`,
|
|
47
|
+
rev: `packs/${pack}.rev`,
|
|
48
|
+
pos: `packs/${pack}.pos`,
|
|
49
|
+
graph: `packs/${pack}.graph`
|
|
50
|
+
});
|
|
51
|
+
/** Every file of one pack, in the order a writer puts them. */
|
|
52
|
+
const packFileKeys = (pack) => {
|
|
53
|
+
const { pack: bytes, idx, rev, pos, graph } = packFiles(pack);
|
|
54
|
+
return [
|
|
55
|
+
bytes,
|
|
56
|
+
idx,
|
|
57
|
+
rev,
|
|
58
|
+
pos,
|
|
59
|
+
graph
|
|
60
|
+
];
|
|
61
|
+
};
|
|
62
|
+
/** Under it, a key per repo incarnation that may still list the pack. */
|
|
63
|
+
const markerPrefix = (pack) => `packs/${pack}/by/`;
|
|
64
|
+
/**
|
|
65
|
+
* The marker that keeps a pack's bytes for one repo, named by its internal ID, never the host's:
|
|
66
|
+
* a host's ID can be made again after a delete, and the new repo would keep the old one's bytes.
|
|
67
|
+
*/
|
|
68
|
+
const markerKey = (pack, repo) => `${markerPrefix(pack)}${repo}`;
|
|
69
|
+
export { indexFiles, indexPrefix, indexRowKey, isPackId, markerKey, markerPrefix, newPackId, objectCollections, packFileKeys, packFiles };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Oid } from "../contracts/ids.mjs";
|
|
2
|
+
import { LfsPointers } from "../contracts/objects.mjs";
|
|
3
|
+
import { GitError } from "../contracts/result.mjs";
|
|
4
|
+
import "./object-rows.mjs";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
/** Builds a push's `LfsPointers`, as a receive finds them among its blobs. */
|
|
7
|
+
export interface LfsPointersBuilder {
|
|
8
|
+
/**
|
|
9
|
+
* Lists the blob `blob` as a pointer to the LFS object `oid`, its SHA-256, both in lowercase hex.
|
|
10
|
+
* Past `lfsPointersMost` it fails `too-many-pointers`, and a malformed ID fails
|
|
11
|
+
* `INVALID_ARGUMENT`.
|
|
12
|
+
*/
|
|
13
|
+
readonly add: (blob: Oid, oid: string) => Effect.Effect<void, GitError>;
|
|
14
|
+
/** The pointers listed, sorted by blob. Nothing more may be added once it's called. */
|
|
15
|
+
readonly finish: () => LfsPointers;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A builder of a push's pointers. Its pages hold `lfsPointersMost` entries at most, the last cut to
|
|
19
|
+
* fit, so they never pass `budget.ts`'s `lfsPointersBytes`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const lfsPointers: () => LfsPointersBuilder;
|