@ref0/git 0.20.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/private-refs.mjs +1 -1
- package/dist/auth/access-jwt.mjs +3 -3
- package/dist/auth/auth-namespace.d.mts +3 -3
- package/dist/auth/auth-namespace.mjs +3 -2
- package/dist/auth/auth.d.mts +3 -3
- package/dist/auth/auth.mjs +9 -8
- package/dist/auth/authorize.mjs +1 -1
- package/dist/auth/fences.d.mts +1 -1
- package/dist/auth/host-function.mjs +1 -1
- package/dist/auth/host-services.mjs +4 -6
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +6 -0
- package/dist/auth/token-cleanup.mjs +2 -2
- package/dist/auth/token-rows.mjs +6 -1
- package/dist/auth/token-text.mjs +1 -1
- package/dist/auth/tokens-base.d.mts +1 -1
- package/dist/auth/tokens.d.mts +1 -1
- package/dist/auth/tokens.mjs +1 -1
- package/dist/client/client.d.mts +15 -7
- package/dist/client/client.mjs +21 -12
- package/dist/client/git-http.mjs +1 -1
- package/dist/client/local.mjs +60 -24
- package/dist/client/negotiate.mjs +3 -3
- package/dist/client/push-upload.mjs +26 -10
- package/dist/client/remote.mjs +4 -3
- package/dist/client/run-remote-helper.d.mts +2 -2
- package/dist/client/run-remote-helper.mjs +6 -6
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +3 -3
- package/dist/contracts/blobs.d.mts +3 -3
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/calls-spent.mjs +5 -33
- package/dist/contracts/client.d.mts +15 -14
- package/dist/contracts/commits.d.mts +4 -4
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +2 -2
- package/dist/contracts/events.d.mts +1 -1
- package/dist/contracts/events.mjs +1 -1
- package/dist/contracts/files.d.mts +4 -4
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +4 -4
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-hooks.d.mts +1 -1
- package/dist/contracts/git.d.mts +9 -5
- package/dist/contracts/grants.d.mts +1 -1
- package/dist/contracts/merges.d.mts +1 -1
- package/dist/contracts/object-values.d.mts +1 -0
- package/dist/contracts/object-values.mjs +16 -1
- package/dist/contracts/objects.d.mts +20 -17
- package/dist/contracts/opaque.mjs +1 -1
- package/dist/contracts/operations.mjs +1 -1
- package/dist/contracts/queue.d.mts +208 -44
- package/dist/contracts/queue.mjs +5 -5
- package/dist/contracts/refs.d.mts +5 -5
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +3 -6
- package/dist/contracts/repos.d.mts +3 -3
- package/dist/contracts/repos.mjs +1 -1
- package/dist/contracts/result.d.mts +10 -7
- package/dist/contracts/result.mjs +8 -3
- package/dist/contracts/rules.d.mts +2 -2
- package/dist/contracts/server.d.mts +8 -10
- package/dist/contracts/services.d.mts +6 -9
- package/dist/contracts/services.mjs +1 -2
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/store.d.mts +2 -2
- package/dist/contracts/sync.d.mts +63 -6
- package/dist/contracts/sync.mjs +3 -2
- package/dist/contracts/tags.d.mts +3 -3
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/tokens.d.mts +2 -2
- package/dist/contracts/tokens.mjs +1 -1
- package/dist/contracts/topics.d.mts +9 -9
- package/dist/contracts/trees.d.mts +4 -4
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +4 -4
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +1 -1
- package/dist/core/ancestry.mjs +30 -34
- package/dist/core/{promise.mjs → call-groups.mjs} +7 -30
- package/dist/core/call-services.mjs +1 -1
- package/dist/core/events/deliver.d.mts +2 -2
- package/dist/core/events/deliver.mjs +3 -3
- package/dist/core/events/retired.mjs +1 -1
- package/dist/core/forks.mjs +5 -5
- package/dist/core/hooks/groups.mjs +2 -2
- package/dist/core/imports.mjs +101 -21
- package/dist/core/index-job.mjs +14 -9
- package/dist/core/index-lost.d.mts +1 -1
- package/dist/core/loose-tally.mjs +38 -15
- package/dist/core/merge-parts.d.mts +17 -4
- package/dist/core/merge-parts.mjs +7 -2
- package/dist/core/mirror-rows.mjs +31 -1
- package/dist/core/objects/blobs.mjs +8 -10
- package/dist/core/objects/files.mjs +20 -17
- package/dist/core/objects/objects-layer.mjs +1 -1
- package/dist/core/objects/peel.mjs +1 -7
- package/dist/core/objects/reading.mjs +19 -18
- package/dist/core/objects/tree-edits.mjs +1 -1
- package/dist/core/objects/trees.mjs +257 -58
- package/dist/core/objects/writing.mjs +3 -9
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +8 -1
- package/dist/core/parts.mjs +8 -4
- package/dist/core/purge.mjs +31 -18
- package/dist/core/push.d.mts +2 -2
- package/dist/core/push.mjs +125 -94
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +9 -2
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +74 -31
- package/dist/core/refs.mjs +3 -3
- package/dist/core/repack.mjs +25 -30
- package/dist/core/repo-info.mjs +1 -1
- package/dist/core/repos.mjs +1 -1
- package/dist/core/rules/changes.mjs +18 -40
- package/dist/core/rules/check.mjs +6 -5
- package/dist/core/rules/commit-changes.mjs +3 -15
- package/dist/core/rules/context.d.mts +3 -3
- package/dist/core/rules/context.mjs +18 -14
- package/dist/core/rules/fetch.mjs +1 -1
- package/dist/core/rules/protect.mjs +30 -17
- package/dist/core/saved-caller-views.d.mts +1 -1
- package/dist/core/saved-caller-views.mjs +3 -3
- package/dist/core/saved-callers.d.mts +1 -1
- package/dist/core/saved-callers.mjs +1 -1
- package/dist/core/seam.d.mts +1 -2
- package/dist/core/view.d.mts +6 -3
- package/dist/core/view.mjs +11 -10
- package/dist/core/work.mjs +2 -2
- package/dist/engine/allotted-xdiff.mjs +3 -16
- package/dist/engine/combined.d.mts +3 -0
- package/dist/engine/combined.mjs +200 -185
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/merge.mjs +7 -9
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +22 -14
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +1 -1
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +2 -2
- package/dist/event-streams/stream.mjs +3 -3
- package/dist/extend.d.mts +2 -6
- package/dist/extend.mjs +1 -5
- package/dist/http/core-parts.mjs +83 -26
- package/dist/http/handler.mjs +54 -9
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +138 -24
- package/dist/http/push-uploads.mjs +2 -2
- package/dist/http/receive-pack.mjs +14 -53
- package/dist/http/request-snapshot.mjs +258 -0
- package/dist/http/upload-pack.mjs +23 -18
- package/dist/index.d.mts +29 -21
- package/dist/index.mjs +11 -2
- package/dist/lfs/base.d.mts +1 -1
- package/dist/lfs/copy.d.mts +49 -1
- package/dist/lfs/copy.mjs +135 -22
- package/dist/lfs/layer.d.mts +4 -3
- package/dist/lfs/layer.mjs +4 -5
- package/dist/lfs/locks.mjs +2 -2
- package/dist/lfs/objects.d.mts +1 -1
- package/dist/lfs/objects.mjs +3 -3
- package/dist/lfs/pointers.mjs +1 -1
- package/dist/lfs/rows.d.mts +1 -1
- package/dist/lfs/rows.mjs +11 -4
- package/dist/lfs/upkeep.mjs +40 -9
- package/dist/lfs/uploaded.mjs +1 -1
- package/dist/lfs/wire.mjs +1 -1
- package/dist/merges/merges.mjs +17 -2
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +1 -1
- package/dist/protocol/bytes/deflate.d.mts +1 -1
- package/dist/protocol/bytes/deflate.mjs +1 -1
- package/dist/protocol/bytes/inflate.d.mts +1 -1
- package/dist/protocol/bytes/inflate.mjs +1 -1
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +1 -1
- package/dist/protocol/diff/read.d.mts +2 -1
- package/dist/protocol/diff/read.mjs +102 -8
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +1 -1
- package/dist/protocol/packs/idx.mjs +1 -1
- package/dist/protocol/packs/parts.mjs +1 -1
- package/dist/protocol/packs/reader.d.mts +1 -1
- package/dist/protocol/packs/reader.mjs +1 -1
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +1 -1
- package/dist/protocol/packs/writer.mjs +3 -3
- package/dist/protocol/wire/advertisement.d.mts +1 -1
- package/dist/protocol/wire/advertisement.mjs +3 -2
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +9 -1
- package/dist/protocol/wire/lines.mjs +28 -1
- package/dist/protocol/wire/push-uploads.mjs +10 -7
- package/dist/protocol/wire/receive-pack.d.mts +1 -1
- package/dist/protocol/wire/receive-pack.mjs +1 -1
- package/dist/protocol/wire/report-status.d.mts +1 -1
- package/dist/protocol/wire/report-status.mjs +1 -1
- package/dist/protocol/wire/v2.d.mts +1 -1
- package/dist/protocol/wire/v2.mjs +1 -1
- package/dist/queue/advance.mjs +31 -24
- package/dist/queue/base.d.mts +5 -3
- package/dist/queue/calls.mjs +5 -5
- package/dist/queue/commit.mjs +1 -1
- package/dist/queue/host.d.mts +1 -1
- package/dist/queue/layer.d.mts +0 -1
- package/dist/queue/layer.mjs +9 -5
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +1 -1
- package/dist/queue/state.mjs +1 -1
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/client.d.mts +1 -1
- package/dist/rest/client.mjs +6 -6
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/handler.mjs +2 -2
- package/dist/rest/handlers.mjs +16 -6
- package/dist/rest/layer.mjs +1 -1
- package/dist/rest/listen.mjs +2 -2
- package/dist/rest/refs.mjs +1 -1
- package/dist/server/edge.mjs +27 -3
- package/dist/server/git-layer.d.mts +1 -2
- package/dist/server/git-layer.mjs +4 -5
- package/dist/server/lifecycle.mjs +1 -1
- package/dist/server/registry.mjs +2 -8
- package/dist/server/server.mjs +62 -43
- package/dist/signin/context.d.mts +1 -1
- package/dist/signin/context.mjs +1 -1
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -2
- package/dist/signin/grants.mjs +1 -1
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/allotted.mjs +4 -9
- package/dist/storage/batch-upkeep.mjs +31 -12
- package/dist/storage/batches.d.mts +2 -3
- package/dist/storage/batches.mjs +52 -49
- package/dist/storage/budget.mjs +23 -1
- package/dist/storage/calls.d.mts +1 -1
- package/dist/storage/calls.mjs +41 -43
- package/dist/storage/charged-cache.mjs +180 -0
- package/dist/storage/chunks.d.mts +3 -3
- package/dist/storage/chunks.mjs +121 -8
- package/dist/storage/counted-bucket.mjs +32 -10
- package/dist/storage/fetch-row-cache.d.mts +6 -0
- package/dist/storage/fetch-row-cache.mjs +211 -0
- package/dist/storage/fetch.d.mts +1 -0
- package/dist/storage/fetch.mjs +54 -242
- package/dist/storage/held-types.d.mts +0 -1
- package/dist/storage/host-bucket.mjs +9 -4
- package/dist/storage/index-bitmaps.mjs +77 -49
- package/dist/storage/index-build.d.mts +2 -3
- package/dist/storage/index-build.mjs +248 -48
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +60 -21
- package/dist/storage/index-graph.mjs +1 -1
- package/dist/storage/index-layers.mjs +55 -25
- package/dist/storage/index-reach.mjs +15 -22
- package/dist/storage/index-whole.d.mts +7 -0
- package/dist/storage/index-whole.mjs +145 -37
- package/dist/storage/largest-files.mjs +1 -7
- package/dist/storage/layout.mjs +17 -1
- package/dist/storage/lfs-pointers.mjs +1 -6
- package/dist/storage/link-join.mjs +55 -16
- package/dist/storage/list-source.d.mts +7 -0
- package/dist/storage/list-source.mjs +288 -0
- package/dist/storage/loose.d.mts +8 -8
- package/dist/storage/loose.mjs +157 -91
- package/dist/storage/memory-budget.mjs +226 -22
- package/dist/storage/merge-cut.mjs +9 -6
- package/dist/storage/merge-fence.mjs +1 -1
- package/dist/storage/merge-row.mjs +1 -1
- package/dist/storage/merge.d.mts +2 -3
- package/dist/storage/merge.mjs +2 -2
- package/dist/storage/object-rows.d.mts +3 -3
- package/dist/storage/object-rows.mjs +179 -38
- package/dist/storage/pack-order.mjs +97 -44
- package/dist/storage/pack-ranges.mjs +44 -16
- package/dist/storage/pack-reads.d.mts +5 -3
- package/dist/storage/pack-reads.mjs +236 -72
- package/dist/storage/pack-receive.d.mts +1 -2
- package/dist/storage/pack-receive.mjs +21 -17
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +477 -116
- package/dist/storage/placed-reads.mjs +33 -16
- package/dist/storage/prune-seen.mjs +1 -1
- package/dist/storage/prune-walk.mjs +1 -1
- package/dist/storage/prune.mjs +4 -31
- package/dist/storage/push-allotment.mjs +26 -14
- package/dist/storage/push-uploads.mjs +195 -57
- package/dist/storage/pushed-commits.mjs +20 -1
- package/dist/storage/quarantine.d.mts +2 -3
- package/dist/storage/range-cache.mjs +175 -40
- package/dist/storage/raw-ids.mjs +39 -10
- package/dist/storage/ready.d.mts +2 -3
- package/dist/storage/ready.mjs +114 -38
- package/dist/storage/receive-bounds.mjs +31 -9
- package/dist/storage/receive-cache.d.mts +7 -0
- package/dist/storage/receive-cache.mjs +147 -0
- package/dist/storage/receive-files.mjs +1 -1
- package/dist/storage/receive-links.mjs +1 -1
- package/dist/storage/receive-state.d.mts +2 -2
- package/dist/storage/receive-state.mjs +6 -8
- package/dist/storage/receive-steps.d.mts +20 -0
- package/dist/storage/receive-steps.mjs +298 -13
- package/dist/storage/repack-backlog.mjs +1 -6
- package/dist/storage/repack-contained.mjs +2 -2
- package/dist/storage/repack-job.mjs +1 -1
- package/dist/storage/repack.d.mts +2 -3
- package/dist/storage/repack.mjs +54 -9
- package/dist/storage/request-cache.mjs +57 -0
- package/dist/storage/roots.mjs +1 -24
- package/dist/storage/rows.d.mts +2 -2
- package/dist/storage/rows.mjs +1 -1
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +1 -1
- package/dist/storage/send-list.mjs +62 -25
- package/dist/storage/stream-whole.mjs +84 -63
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +878 -450
- package/dist/storage/visible.mjs +110 -32
- package/dist/storage/walk.mjs +1 -0
- package/dist/storage/wants.mjs +22 -58
- package/dist/store/call-count.d.mts +2 -2
- package/dist/store/call-count.mjs +24 -11
- package/dist/store/catalogue.d.mts +1 -1
- package/dist/store/catalogue.mjs +19 -7
- package/dist/store/crossing.mjs +1 -7
- package/dist/store/cursor-seal.d.mts +1 -1
- package/dist/store/cursor-seal.mjs +1 -1
- package/dist/store/door.mjs +9 -4
- package/dist/store/errors.d.mts +2 -2
- package/dist/store/errors.mjs +107 -19
- package/dist/store/git-store.mjs +7 -2
- package/dist/store/job-try.mjs +90 -9
- package/dist/store/list-job.mjs +10 -34
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +2 -2
- package/dist/store/queue-jobs.mjs +6 -12
- package/dist/store/records.d.mts +2 -2
- package/dist/store/records.mjs +2 -2
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +2 -2
- package/dist/store/repo-record.d.mts +2 -2
- package/dist/store/repo-record.mjs +3 -3
- package/dist/store/request-snapshot.mjs +5 -0
- package/dist/store/reservations.mjs +2 -2
- package/dist/store/topic-jobs.mjs +5 -11
- package/dist/sync/bound.d.mts +3 -3
- package/dist/sync/bound.mjs +10 -7
- package/dist/sync/github.mjs +65 -67
- package/dist/sync/http.mjs +1 -1
- package/dist/sync/import.mjs +201 -66
- package/dist/sync/layer.d.mts +1 -1
- package/dist/sync/layer.mjs +6 -6
- package/dist/sync/lfs-batch.mjs +1 -1
- package/dist/sync/lfs-copy.mjs +175 -15
- package/dist/sync/mirror.mjs +5 -10
- package/dist/sync/said.mjs +1 -1
- package/dist/sync/step.mjs +268 -86
- package/dist/sync/tries.mjs +25 -6
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +3 -3
- package/dist/topics/calls.mjs +1 -1
- package/dist/topics/layer.d.mts +15 -14
- package/dist/topics/members.mjs +1 -1
- package/dist/topics/topic.mjs +1 -1
- package/package.json +3 -13
- package/dist/auth/helpers.mjs +0 -17
- package/dist/auth.d.mts +0 -5
- package/dist/auth.mjs +0 -5
- package/dist/core/rules/commit-changes.d.mts +0 -12
- package/dist/effect.d.mts +0 -9
- package/dist/effect.mjs +0 -7
- package/dist/server/joined.d.mts +0 -70
- package/dist/server/joined.mjs +0 -41
|
@@ -4,7 +4,7 @@ import { bitmapWords } from "./ewah.mjs";
|
|
|
4
4
|
import { basesBlock, openBases } from "./index-files.mjs";
|
|
5
5
|
import { indexFiles } from "./layout.mjs";
|
|
6
6
|
import { indexBytes, loadedLookup, rangedLookup } from "./pack-reads.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { placedEntries, placedEntriesBytes, placedEntriesGets, placedTablesOf, searchReads } from "./pack-ranges.mjs";
|
|
8
8
|
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
9
9
|
import { stepEffect } from "../protocol/packs/step.mjs";
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
@@ -236,7 +236,7 @@ const readPlaces = /* @__PURE__ */ Effect.fnUntraced(function* (input, pack, pla
|
|
|
236
236
|
if (places.length === 0) return;
|
|
237
237
|
const held = placedHeldBytes(places.length, pack.table.places.length);
|
|
238
238
|
yield* input.ahead({
|
|
239
|
-
bucket: placedEntriesGets(pack.count, pack.pack.bytes, places),
|
|
239
|
+
bucket: (pack.tables.headerChecked ? 0 : 1) + placedEntriesGets(pack.count, pack.pack.bytes, places),
|
|
240
240
|
store: 0
|
|
241
241
|
});
|
|
242
242
|
yield* input.read.hold(held);
|
|
@@ -287,26 +287,35 @@ const listOf = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
287
287
|
const indexed = read.indexed;
|
|
288
288
|
const sizesAt = read.sizesAt;
|
|
289
289
|
if (indexed === void 0 || sizesAt === void 0) return yield* Effect.die(/* @__PURE__ */ new Error("a send list needs the reader to have loaded its packs"));
|
|
290
|
-
const
|
|
291
|
-
const ranged = [];
|
|
290
|
+
const active = [];
|
|
292
291
|
for (const ranges of input.ranges) {
|
|
293
292
|
const places = placesIn(send, ranges.base, ranges.count);
|
|
294
293
|
if (places.length === 0) continue;
|
|
295
294
|
const pack = input.listed.packs.find(({ id }) => id === ranges.pack.id);
|
|
296
295
|
if (pack === void 0) return yield* Effect.fail(loss(`Pack ${ranges.pack.id} isn't listed`));
|
|
296
|
+
active.push({
|
|
297
|
+
ranges,
|
|
298
|
+
places,
|
|
299
|
+
pack
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
const loadedPacks = yield* Effect.forEach(active, Effect.fnUntraced(function* ({ ranges, places, pack }) {
|
|
297
303
|
if (ranges.reverse !== void 0 || indexBytes(pack) <= placedHeldBytes(places.length, 0)) {
|
|
298
|
-
|
|
299
|
-
|
|
304
|
+
const from = input.indexHeld === true ? input.bucket : void 0;
|
|
305
|
+
return {
|
|
306
|
+
pack: loadedPack(ranges.base, yield* indexed(pack, from)),
|
|
307
|
+
ranged: void 0
|
|
308
|
+
};
|
|
300
309
|
}
|
|
301
|
-
|
|
302
|
-
bucket: 1,
|
|
303
|
-
store: 0
|
|
304
|
-
});
|
|
305
|
-
const placed = new RangedPack(ranges, yield* openPlacedTables(input.bucket, ranges.pack, ranges.count), indexAheadOf(input));
|
|
310
|
+
const placed = new RangedPack(ranges, placedTablesOf(input.bucket, ranges.pack, ranges.count), indexAheadOf(input));
|
|
306
311
|
yield* readPlaces(input, placed, places);
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
312
|
+
return {
|
|
313
|
+
pack: placed,
|
|
314
|
+
ranged: placed
|
|
315
|
+
};
|
|
316
|
+
}), { concurrency: 5 });
|
|
317
|
+
const packs = loadedPacks.map(({ pack }) => pack);
|
|
318
|
+
const ranged = loadedPacks.flatMap(({ ranged }) => ranged === void 0 ? [] : [ranged]);
|
|
310
319
|
/** The size of each of `list`'s objects `wanted` picks, by its header, a pack's batch at a time. */
|
|
311
320
|
const headerSizes = Effect.fnUntraced(function* (list, wanted, sized) {
|
|
312
321
|
const cursor = new ListCursor(list);
|
|
@@ -386,7 +395,10 @@ const listOf = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
386
395
|
bases,
|
|
387
396
|
chains
|
|
388
397
|
};
|
|
389
|
-
|
|
398
|
+
yield* Effect.forEach(ranged, (pack) => readChains(input, list, pack), {
|
|
399
|
+
concurrency: 5,
|
|
400
|
+
discard: true
|
|
401
|
+
});
|
|
390
402
|
for (const cursor = new ListCursor(list); !cursor.done; cursor.next()) if (isSet(copied, cursor.ordinal)) sized(cursor.ordinal, cursor.inPack.at(cursor.position).bytes);
|
|
391
403
|
yield* headerSizes(list, (ordinal) => !isSet(copied, ordinal) && !isBlob(ordinal), sized);
|
|
392
404
|
let bytes = 0;
|
|
@@ -464,10 +476,26 @@ const copiesOf = /* @__PURE__ */ Effect.fnUntraced(function* (input, list) {
|
|
|
464
476
|
const end = layer.first + layer.positions;
|
|
465
477
|
if (cursor.done || cursor.position >= end) continue;
|
|
466
478
|
const runs = layer.deltas === 0 ? [] : basesRuns((block) => anySet(send, block * basesBlock, (block + 1) * basesBlock), layer.first, end);
|
|
479
|
+
const batchOfRun = new Int32Array(runs.length);
|
|
480
|
+
const batches = [];
|
|
481
|
+
for (const [at, reading] of runs.entries()) {
|
|
482
|
+
const last = batches.at(-1);
|
|
483
|
+
const lastPositions = last?.reduce((sum, item) => sum + (item.to - item.from), 0) ?? Number.POSITIVE_INFINITY;
|
|
484
|
+
if (last !== void 0 && last.length < 16 && lastPositions + (reading.to - reading.from) <= basesRun * 4096) {
|
|
485
|
+
last.push(reading);
|
|
486
|
+
batchOfRun[at] = batches.length - 1;
|
|
487
|
+
} else {
|
|
488
|
+
batches.push([reading]);
|
|
489
|
+
batchOfRun[at] = batches.length - 1;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
467
492
|
let rows = /* @__PURE__ */ new Uint32Array(0);
|
|
468
493
|
let row = 0;
|
|
469
494
|
let run = 0;
|
|
470
495
|
let readRun = -1;
|
|
496
|
+
let readBatch = -1;
|
|
497
|
+
let batchRows = [];
|
|
498
|
+
let batchStart = 0;
|
|
471
499
|
let chainsBefore = 0;
|
|
472
500
|
for (; !cursor.done && cursor.position < end; cursor.next()) {
|
|
473
501
|
const { position, ordinal } = cursor;
|
|
@@ -476,12 +504,19 @@ const copiesOf = /* @__PURE__ */ Effect.fnUntraced(function* (input, list) {
|
|
|
476
504
|
if (reading !== void 0 && reading.from <= position && run !== readRun) {
|
|
477
505
|
const done = runs[readRun];
|
|
478
506
|
if (done !== void 0 && pending.length > chainsBefore) yield* keepRun(layer, done, rows);
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
507
|
+
const batchIndex = batchOfRun[run] ?? 0;
|
|
508
|
+
if (batchIndex !== readBatch) {
|
|
509
|
+
const bases = yield* basesOf(layer);
|
|
510
|
+
const batch = batches[batchIndex] ?? [];
|
|
511
|
+
yield* ahead({
|
|
512
|
+
bucket: batch.length,
|
|
513
|
+
store: 0
|
|
514
|
+
});
|
|
515
|
+
batchRows = yield* Effect.forEach(batch, (each) => bases.rowsOf(each.from, each.to), { concurrency: 16 });
|
|
516
|
+
readBatch = batchIndex;
|
|
517
|
+
batchStart = run;
|
|
518
|
+
}
|
|
519
|
+
rows = batchRows[run - batchStart] ?? /* @__PURE__ */ new Uint32Array(0);
|
|
485
520
|
row = 0;
|
|
486
521
|
readRun = run;
|
|
487
522
|
chainsBefore = pending.length;
|
|
@@ -514,15 +549,17 @@ const copiesOf = /* @__PURE__ */ Effect.fnUntraced(function* (input, list) {
|
|
|
514
549
|
const blocks = new Set(inLayer.map((base) => Math.floor(base / basesBlock)));
|
|
515
550
|
const bases = yield* basesOf(layer);
|
|
516
551
|
const unread = (block) => blocks.has(block) && !rows.has(block);
|
|
517
|
-
|
|
518
|
-
|
|
552
|
+
const readings = basesRuns(unread, layer.first, end);
|
|
553
|
+
if (readings.length > 0) {
|
|
554
|
+
const bytes = readings.reduce((sum, reading) => sum + basesReadBytes(reading.to - reading.from), 0);
|
|
519
555
|
yield* read.hold(bytes);
|
|
520
556
|
keptBytes += bytes;
|
|
521
557
|
yield* ahead({
|
|
522
|
-
bucket:
|
|
558
|
+
bucket: readings.length,
|
|
523
559
|
store: 0
|
|
524
560
|
});
|
|
525
|
-
|
|
561
|
+
const fetched = yield* Effect.forEach(readings, (reading) => bases.rowsOf(reading.from, reading.to), { concurrency: 16 });
|
|
562
|
+
for (const [at, reading] of readings.entries()) keepBlocks(rows, reading, fetched[at] ?? /* @__PURE__ */ new Uint32Array(0));
|
|
526
563
|
}
|
|
527
564
|
for (const position of inLayer) {
|
|
528
565
|
const found = rows.get(Math.floor(position / 4096)) ?? /* @__PURE__ */ new Uint32Array(0);
|
|
@@ -3,8 +3,7 @@ import { deflateWhole } from "../protocol/bytes/deflate.mjs";
|
|
|
3
3
|
import { nativeSha1Hasher } from "../protocol/bytes/sha1-hasher.mjs";
|
|
4
4
|
import { entryHeader } from "../protocol/packs/writer.mjs";
|
|
5
5
|
import { thrownError } from "../store/errors.mjs";
|
|
6
|
-
import { callsAhead } from "./fetch.mjs";
|
|
7
|
-
import { repoScope } from "../store/scopes.mjs";
|
|
6
|
+
import { callsAhead, fetchTooLarge } from "./fetch.mjs";
|
|
8
7
|
import { bodyAcross, bodyThrown, bucketStream } from "./calls.mjs";
|
|
9
8
|
import { noCall, runIn } from "../store/crossing.mjs";
|
|
10
9
|
import { isPackId, objectCollections, packFiles } from "./layout.mjs";
|
|
@@ -12,6 +11,7 @@ import { eachPageAt, objectOfRow } from "./object-rows.mjs";
|
|
|
12
11
|
import { entryEnd, indexBytes, readInto } from "./pack-reads.mjs";
|
|
13
12
|
import { rowsBytes } from "./repack.mjs";
|
|
14
13
|
import * as Effect from "effect/Effect";
|
|
14
|
+
import * as Exit from "effect/Exit";
|
|
15
15
|
import * as Hex from "effect/encoding/Hex";
|
|
16
16
|
// src/storage/stream-whole.ts
|
|
17
17
|
/**
|
|
@@ -154,70 +154,91 @@ const copies = /* @__PURE__ */ Effect.fnUntraced(function* (packs, rows, charge)
|
|
|
154
154
|
* object stored twice goes once, its first copy in plan order, as `copies` says. Its packs' bytes
|
|
155
155
|
* and its rows' count toward `limits`, as a plan's would, each copy counted: so the check, made
|
|
156
156
|
* before the indexes load, is stricter than the stream by the copies. `undefined` when the repo
|
|
157
|
-
* moved since `listed` was read, when it holds more rows than `wholeRowsMost`,
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
157
|
+
* moved since `listed` was read, when it holds more rows than `wholeRowsMost`, when a charge
|
|
158
|
+
* doesn't fit the fetch's allotment (`fetchTooLarge`), or when the clone is past `limits`: then
|
|
159
|
+
* `release` gives back everything charged and the clone builds, as before. Refused by
|
|
160
|
+
* `tooManyCalls` when the calls it made, through `store` and `bucket`, and a ranged get a pack
|
|
161
|
+
* still to come pass `calls`, checked before each index load and once loaded, so it stops before
|
|
162
|
+
* the stream's first byte. Each page of rows is charged before it's kept, its values and the
|
|
163
|
+
* objects decoded from them, each pack's indexes before they load, and each later copy as `copies`
|
|
164
|
+
* finds it, so what it holds is within the fetch's allotment.
|
|
164
165
|
*/
|
|
165
|
-
const wholePlan = /* @__PURE__ */ Effect.fnUntraced(function* (store, bucket, indexes, listed, input, calls, charge = () => Effect.void) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
const wholePlan = /* @__PURE__ */ Effect.fnUntraced(function* (store, bucket, indexes, listed, input, calls, charge = () => Effect.void, release = () => Effect.void) {
|
|
167
|
+
let charged = 0;
|
|
168
|
+
let returned = false;
|
|
169
|
+
const giveBack = () => Effect.suspend(() => {
|
|
170
|
+
if (returned) return Effect.void;
|
|
171
|
+
returned = true;
|
|
172
|
+
const held = charged;
|
|
173
|
+
charged = 0;
|
|
174
|
+
return held === 0 ? Effect.void : release(held);
|
|
169
175
|
});
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const kept = listed.packs.filter(({ id }) => !cruft.has(id));
|
|
179
|
-
const rows = yield* Effect.forEach(objectRows, (row) => objectOfRow(row));
|
|
180
|
-
const objects = kept.reduce((sum, pack) => sum + pack.objects, rows.length);
|
|
181
|
-
const packBytes = kept.reduce((sum, pack) => sum + pack.bytes, 0);
|
|
182
|
-
const bytes = rows.reduce((sum, row) => sum + row.bytes.byteLength, packBytes);
|
|
183
|
-
const { limits } = input;
|
|
184
|
-
if (objects > limits.objects || bytes > limits.bytes) return void 0;
|
|
185
|
-
const gets = callsAhead(calls, {
|
|
186
|
-
bucket: kept.length,
|
|
187
|
-
store: 0
|
|
188
|
-
}, true);
|
|
189
|
-
const load = (pack) => gets.pipe(Effect.andThen(charge(indexBytes(pack))), Effect.andThen(indexes.load(bucket, pack)));
|
|
190
|
-
const held = packBytes <= heldBodiesMost;
|
|
191
|
-
const body = ({ id, bytes }) => isPackId(id) ? charge(bodyBytes({ bytes })).pipe(Effect.andThen(readInto(bucket, packFiles(id).pack, bodyBytes({ bytes }), `Pack ${id}`, {
|
|
192
|
-
offset: headerBytes,
|
|
193
|
-
length: bodyBytes({ bytes })
|
|
194
|
-
}))) : Effect.succeed(void 0);
|
|
195
|
-
if (held) yield* callsAhead(calls, {
|
|
196
|
-
bucket: kept.length * 4,
|
|
197
|
-
store: 0
|
|
198
|
-
}, true);
|
|
199
|
-
const [packs, bodies] = held ? yield* Effect.all([Effect.forEach(kept, load, { concurrency: "unbounded" }), Effect.forEach(kept, body, { concurrency: "unbounded" })], { concurrency: "unbounded" }) : [yield* Effect.forEach(kept, load), void 0];
|
|
200
|
-
yield* held ? callsAhead(calls, {
|
|
201
|
-
bucket: 0,
|
|
202
|
-
store: 0
|
|
203
|
-
}, true) : gets;
|
|
204
|
-
const streamed = yield* copies(packs, rows, charge);
|
|
205
|
-
const unique = {
|
|
206
|
-
...streamed,
|
|
207
|
-
packs: streamed.packs.map((pack, at) => ({
|
|
208
|
-
...pack,
|
|
209
|
-
body: bodies?.[at]
|
|
210
|
-
}))
|
|
211
|
-
};
|
|
212
|
-
const spans = unique.packs.reduce((sum, { cut }) => sum + cut.length / 2, 0);
|
|
213
|
-
const skipped = rows.length - unique.rows.length + spans;
|
|
214
|
-
const rowIds = (input.roots?.length ?? 0) === 0 ? void 0 : new Set(rows.map(({ oid }) => oid));
|
|
215
|
-
const roots = (input.roots ?? []).filter((oid) => rowIds?.has(oid) === true || packs.some(({ index }) => index.find(oid) !== void 0));
|
|
216
|
-
return {
|
|
217
|
-
...unique,
|
|
218
|
-
objects: objects - skipped,
|
|
219
|
-
roots
|
|
176
|
+
const take = (bytes) => {
|
|
177
|
+
let counted = false;
|
|
178
|
+
const count = () => {
|
|
179
|
+
if (counted) return;
|
|
180
|
+
counted = true;
|
|
181
|
+
if (!returned) charged += bytes;
|
|
182
|
+
};
|
|
183
|
+
return charge(bytes, count).pipe(Effect.tap(() => Effect.sync(count)), Effect.ensuring(Effect.suspend(() => counted && returned && bytes > 0 ? release(bytes) : Effect.void)));
|
|
220
184
|
};
|
|
185
|
+
return yield* Effect.gen(function* () {
|
|
186
|
+
const objectRows = [];
|
|
187
|
+
let cruftRows = [];
|
|
188
|
+
if ((yield* eachPageAt(store, listed.repo, listed.version, (page) => {
|
|
189
|
+
if (objectRows.length + page.length > 1e3) return Effect.succeed(false);
|
|
190
|
+
return take(2 * rowsBytes(page)).pipe(Effect.tap(() => Effect.sync(() => void objectRows.push(...page))), Effect.as(true));
|
|
191
|
+
}, {
|
|
192
|
+
reads: [{ collection: objectCollections.cruft }],
|
|
193
|
+
take: ([rows]) => {
|
|
194
|
+
cruftRows = rows ?? [];
|
|
195
|
+
}
|
|
196
|
+
}, 1e3).pipe(Effect.catchIf((error) => error === fetchTooLarge, () => Effect.succeed("too-large")))) !== "done") return void 0;
|
|
197
|
+
const cruft = new Set(cruftRows.map(({ id }) => id));
|
|
198
|
+
const kept = listed.packs.filter(({ id }) => !cruft.has(id));
|
|
199
|
+
const rows = yield* Effect.forEach(objectRows, (row) => objectOfRow(row));
|
|
200
|
+
const objects = kept.reduce((sum, pack) => sum + pack.objects, rows.length);
|
|
201
|
+
const packBytes = kept.reduce((sum, pack) => sum + pack.bytes, 0);
|
|
202
|
+
const bytes = rows.reduce((sum, row) => sum + row.bytes.byteLength, packBytes);
|
|
203
|
+
const { limits } = input;
|
|
204
|
+
if (objects > limits.objects || bytes > limits.bytes) return void 0;
|
|
205
|
+
const gets = callsAhead(calls, {
|
|
206
|
+
bucket: kept.length,
|
|
207
|
+
store: 0
|
|
208
|
+
}, true);
|
|
209
|
+
const load = (pack) => gets.pipe(Effect.andThen(take(indexBytes(pack))), Effect.andThen(indexes.load(bucket, pack)));
|
|
210
|
+
const held = packBytes <= heldBodiesMost;
|
|
211
|
+
const body = ({ id, bytes }) => isPackId(id) ? take(bodyBytes({ bytes })).pipe(Effect.andThen(readInto(bucket, packFiles(id).pack, bodyBytes({ bytes }), `Pack ${id}`, {
|
|
212
|
+
offset: headerBytes,
|
|
213
|
+
length: bodyBytes({ bytes })
|
|
214
|
+
}))) : Effect.succeed(void 0);
|
|
215
|
+
if (held) yield* callsAhead(calls, {
|
|
216
|
+
bucket: kept.length * 4,
|
|
217
|
+
store: 0
|
|
218
|
+
}, true);
|
|
219
|
+
const [packs, bodies] = held ? yield* Effect.all([Effect.forEach(kept, load, { concurrency: "unbounded" }), Effect.forEach(kept, body, { concurrency: "unbounded" })], { concurrency: "unbounded" }) : [yield* Effect.forEach(kept, load), void 0];
|
|
220
|
+
yield* held ? callsAhead(calls, {
|
|
221
|
+
bucket: 0,
|
|
222
|
+
store: 0
|
|
223
|
+
}, true) : gets;
|
|
224
|
+
const streamed = yield* copies(packs, rows, take);
|
|
225
|
+
const unique = {
|
|
226
|
+
...streamed,
|
|
227
|
+
packs: streamed.packs.map((pack, at) => ({
|
|
228
|
+
...pack,
|
|
229
|
+
body: bodies?.[at]
|
|
230
|
+
}))
|
|
231
|
+
};
|
|
232
|
+
const spans = unique.packs.reduce((sum, { cut }) => sum + cut.length / 2, 0);
|
|
233
|
+
const skipped = rows.length - unique.rows.length + spans;
|
|
234
|
+
const rowIds = (input.roots?.length ?? 0) === 0 ? void 0 : new Set(rows.map(({ oid }) => oid));
|
|
235
|
+
const roots = (input.roots ?? []).filter((oid) => rowIds?.has(oid) === true || packs.some(({ index }) => index.find(oid) !== void 0));
|
|
236
|
+
return {
|
|
237
|
+
...unique,
|
|
238
|
+
objects: objects - skipped,
|
|
239
|
+
roots
|
|
240
|
+
};
|
|
241
|
+
}).pipe(Effect.onExit((exit) => Exit.isSuccess(exit) && exit.value !== void 0 ? Effect.void : giveBack()));
|
|
221
242
|
});
|
|
222
243
|
/**
|
|
223
244
|
* The parts of `piece`, at `from` in its pack, outside `cut`'s spans, from the span at `next.span`
|
|
@@ -7,8 +7,8 @@ import { openIndexRanges, readExactly } from "./pack-ranges.mjs";
|
|
|
7
7
|
import { compareIds } from "./raw-ids.mjs";
|
|
8
8
|
import { containedRanks } from "./repack-contained.mjs";
|
|
9
9
|
import { namedOf } from "./repack.mjs";
|
|
10
|
-
import * as Effect from "effect/Effect";
|
|
11
10
|
import * as Schema from "effect/Schema";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
12
|
// src/storage/swap-walk.ts
|
|
13
13
|
/** What one holder's walk holds at most: the IDs of the packs it names, and a piece of its own. */
|
|
14
14
|
const swapHeldBytes = 4194304;
|