@ref0/git 0.7.0 → 0.9.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 +0 -2
- package/dist/auth/authorize.mjs +31 -24
- package/dist/auth/bridge.mjs +8 -8
- package/dist/auth/fences.d.mts +0 -1
- package/dist/auth/fences.mjs +1 -1
- package/dist/auth/grants.d.mts +0 -1
- package/dist/auth/grants.mjs +2 -2
- package/dist/auth/host-function.d.mts +1 -7
- package/dist/auth/host-function.mjs +38 -38
- package/dist/auth/identify.d.mts +0 -1
- package/dist/auth/identify.mjs +1 -1
- package/dist/auth/policy.d.mts +7 -4
- package/dist/auth/policy.mjs +13 -10
- package/dist/auth/token-rows.mjs +2 -5
- package/dist/auth/tokens-layer.d.mts +0 -2
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens-public.mjs +4 -2
- package/dist/auth/tokens.d.mts +6 -1
- package/dist/auth/tokens.mjs +7 -1
- package/dist/client/client.d.mts +22 -15
- package/dist/client/client.mjs +31 -27
- package/dist/client/git-http.mjs +22 -5
- package/dist/client/local.mjs +1 -1
- package/dist/client/namespace.d.mts +2 -0
- package/dist/client/push-upload.d.mts +1 -0
- package/dist/client/push-upload.mjs +169 -2
- package/dist/client/remote-helper.mjs +2 -4
- package/dist/client/remote.mjs +37 -15
- package/dist/client/run-remote-helper.mjs +4 -4
- package/dist/client/transport.mjs +26 -19
- package/dist/contracts/actors.d.mts +57 -28
- package/dist/contracts/actors.mjs +38 -2
- package/dist/contracts/authorize.d.mts +21 -15
- package/dist/contracts/callers.mjs +40 -0
- package/dist/contracts/calls-spent.d.mts +2 -12
- package/dist/contracts/calls-spent.mjs +4 -5
- package/dist/contracts/client.d.mts +16 -9
- package/dist/contracts/events.d.mts +82 -14
- package/dist/contracts/events.mjs +35 -9
- package/dist/contracts/files.d.mts +42 -42
- package/dist/contracts/forks.d.mts +0 -24
- package/dist/contracts/git-hooks.d.mts +217 -0
- package/dist/contracts/git-hooks.mjs +3 -1
- package/dist/contracts/git.d.mts +13 -3
- package/dist/contracts/grants.d.mts +46 -27
- package/dist/contracts/lfs.d.mts +17 -4
- package/dist/contracts/merges.d.mts +7 -7
- package/dist/contracts/objects.d.mts +38 -4
- package/dist/contracts/opaque.mjs +19 -1
- package/dist/contracts/operations.d.mts +8 -1
- package/dist/contracts/operations.mjs +209 -0
- package/dist/contracts/queue.d.mts +6 -5
- package/dist/contracts/queue.mjs +9 -20
- package/dist/contracts/remote.d.mts +13 -4
- package/dist/contracts/remote.mjs +3 -3
- package/dist/contracts/repos.d.mts +11 -40
- package/dist/contracts/repos.mjs +11 -10
- package/dist/contracts/result.d.mts +28 -11
- package/dist/contracts/result.mjs +32 -2
- package/dist/contracts/rules.d.mts +706 -46
- package/dist/contracts/rules.mjs +81 -2
- package/dist/contracts/server.d.mts +5 -275
- package/dist/contracts/services.d.mts +0 -3
- package/dist/contracts/services.mjs +1 -3
- package/dist/contracts/signin.d.mts +2 -2
- package/dist/contracts/signin.mjs +4 -5
- package/dist/contracts/sync.d.mts +1 -4
- package/dist/contracts/tokens.d.mts +29 -17
- package/dist/contracts/tokens.mjs +14 -3
- package/dist/contracts/topics.d.mts +38 -11
- package/dist/contracts/topics.mjs +8 -2
- package/dist/core/access.d.mts +0 -2
- package/dist/core/access.mjs +15 -4
- package/dist/core/ancestry.mjs +5 -4
- package/dist/core/events/deliver.mjs +19 -1
- package/dist/core/forks.mjs +30 -11
- package/dist/core/hooks/groups.d.mts +0 -1
- package/dist/core/hooks/groups.mjs +8 -9
- package/dist/core/index-job.mjs +23 -1
- package/dist/core/index-lost.d.mts +11 -0
- package/dist/core/index-lost.mjs +55 -0
- package/dist/core/loose-tally.mjs +46 -0
- package/dist/core/objects/commit-writes.mjs +1 -1
- package/dist/core/objects/commits.mjs +10 -9
- package/dist/core/objects/merges.mjs +1 -1
- package/dist/core/objects/reading.mjs +28 -13
- package/dist/core/objects/trees.mjs +1 -1
- package/dist/core/objects/writing.mjs +1 -0
- package/dist/core/parts.d.mts +7 -0
- package/dist/core/promise.mjs +1 -15
- package/dist/core/publish.mjs +9 -5
- package/dist/core/purge.mjs +30 -12
- package/dist/core/push.mjs +39 -16
- package/dist/core/ref-view.mjs +14 -6
- package/dist/core/repack.mjs +54 -27
- package/dist/core/repo-info.mjs +8 -6
- package/dist/core/repos.mjs +1 -0
- package/dist/core/rules/check.mjs +10 -10
- package/dist/core/rules/context.d.mts +3 -1
- package/dist/core/rules/context.mjs +16 -13
- package/dist/core/rules/fetch.mjs +17 -23
- package/dist/core/tokens.mjs +2 -1
- package/dist/core/view.d.mts +10 -1
- package/dist/core/view.mjs +15 -6
- package/dist/effect.d.mts +3 -6
- package/dist/effect.mjs +3 -6
- package/dist/engine/commits.mjs +23 -50
- package/dist/engine/failures.d.mts +1 -2
- package/dist/engine/failures.mjs +1 -3
- package/dist/engine/merge-base-walk.mjs +57 -142
- package/dist/engine/merge-bases.mjs +9 -7
- package/dist/engine/merge.mjs +20 -17
- package/dist/engine/parts.d.mts +1 -0
- package/dist/engine/parts.mjs +1 -1
- package/dist/engine/walk.mjs +15 -11
- package/dist/extend.d.mts +1 -2
- package/dist/extend.mjs +1 -2
- package/dist/http/core-parts.mjs +18 -10
- package/dist/http/handler.mjs +11 -31
- package/dist/http/parts.d.mts +0 -1
- package/dist/index.d.mts +29 -22
- package/dist/index.mjs +5 -2
- package/dist/lfs/base.d.mts +6 -3
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/layer.d.mts +4 -3
- package/dist/lfs/layer.mjs +23 -9
- package/dist/lfs/objects.mjs +93 -41
- package/dist/lfs/pointers.mjs +69 -18
- package/dist/lfs/purge.mjs +6 -2
- package/dist/lfs/rows.mjs +24 -7
- package/dist/lfs/service.d.mts +6 -3
- package/dist/lfs/service.mjs +8 -2
- package/dist/lfs/upkeep.mjs +47 -28
- package/dist/lfs/upload-most.mjs +47 -0
- package/dist/lfs/uploaded.mjs +59 -0
- package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
- package/dist/protocol/bytes/streams.mjs +84 -2
- package/dist/protocol/bytes/text.mjs +6 -1
- package/dist/protocol/diff/read.d.mts +1 -0
- package/dist/protocol/diff/read.mjs +5 -2
- package/dist/protocol/objects/commit.d.mts +7 -0
- package/dist/protocol/objects/commit.mjs +5 -1
- package/dist/protocol/objects/fsck.mjs +6 -3
- package/dist/queue/advance.mjs +77 -18
- package/dist/queue/calls.mjs +4 -14
- package/dist/queue/host.d.mts +4 -0
- package/dist/queue/lanes.mjs +1 -1
- package/dist/queue/layer.mjs +4 -2
- package/dist/queue/limits.mjs +18 -2
- package/dist/queue/rows.mjs +10 -1
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +3 -4
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/client-namespace.d.mts +2 -0
- package/dist/rest/client.d.mts +32 -8
- package/dist/rest/client.mjs +308 -382
- package/dist/rest/commits.d.mts +150 -150
- package/dist/rest/files.d.mts +18 -18
- package/dist/rest/forks.d.mts +77 -89
- package/dist/rest/handlers.mjs +2 -1
- package/dist/rest/listen.d.mts +8 -6
- package/dist/rest/listen.mjs +31 -75
- package/dist/rest/me.d.mts +2 -2
- package/dist/rest/merges.d.mts +7 -7
- package/dist/rest/refs.d.mts +27 -27
- package/dist/rest/repos.d.mts +40 -52
- package/dist/rest/tokens.d.mts +12 -12
- package/dist/rest/topics.d.mts +13 -13
- package/dist/rest/trees.d.mts +66 -66
- package/dist/rest/wire.d.mts +20 -2
- package/dist/rest/work.d.mts +39 -39
- package/dist/rest.d.mts +1 -7
- package/dist/rest.mjs +1 -5
- package/dist/server/git-layer.d.mts +10 -2
- package/dist/server/git-layer.mjs +29 -10
- package/dist/server/joined.d.mts +12 -6
- package/dist/server/joined.mjs +3 -2
- package/dist/server/registry.mjs +11 -5
- package/dist/server/server.d.mts +0 -1
- package/dist/server/server.mjs +42 -49
- package/dist/signin/context.d.mts +0 -1
- package/dist/signin/context.mjs +5 -9
- package/dist/storage/clean-up.mjs +3 -1
- package/dist/storage/fsck.mjs +12 -2
- package/dist/storage/graph-rebuild.mjs +262 -0
- package/dist/storage/index-bitmaps.mjs +16 -10
- package/dist/storage/index-build.mjs +160 -24
- package/dist/storage/index-graph.d.mts +1 -0
- package/dist/storage/index-graph.mjs +29 -5
- package/dist/storage/index-layers.d.mts +1 -0
- package/dist/storage/index-layers.mjs +5 -2
- package/dist/storage/index-reach.mjs +7 -5
- package/dist/storage/index-remap.mjs +5 -5
- package/dist/storage/index-visible.mjs +16 -5
- package/dist/storage/lfs-pointers.d.mts +5 -5
- package/dist/storage/lfs-pointers.mjs +37 -11
- package/dist/storage/links.mjs +3 -3
- package/dist/storage/loose.mjs +4 -1
- package/dist/storage/memory-budget.mjs +1 -1
- package/dist/storage/merge-fence.mjs +81 -19
- package/dist/storage/merge-most.mjs +1 -0
- package/dist/storage/merge-row.mjs +16 -4
- package/dist/storage/merge-stream.mjs +9 -6
- package/dist/storage/object-rows.mjs +17 -1
- package/dist/storage/pack-order.d.mts +1 -0
- package/dist/storage/pack-order.mjs +18 -1
- package/dist/storage/pack-receive.mjs +10 -6
- package/dist/storage/packs.mjs +58 -27
- package/dist/storage/prune-walk.mjs +5 -2
- package/dist/storage/prune.mjs +168 -70
- package/dist/storage/ready.d.mts +1 -1
- package/dist/storage/ready.mjs +12 -3
- package/dist/storage/receive-bounds.mjs +3 -2
- package/dist/storage/receive-state.mjs +1 -1
- package/dist/storage/repack-contained.mjs +22 -14
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/repack.mjs +3 -2
- package/dist/storage/unpack.mjs +7 -0
- package/dist/storage/visible.mjs +3 -2
- package/dist/storage/walk.d.mts +1 -0
- package/dist/storage/walk.mjs +9 -5
- package/dist/storage/wants.mjs +17 -11
- package/dist/store/call-count.d.mts +31 -3
- package/dist/store/call-count.mjs +51 -20
- package/dist/store/errors.d.mts +7 -1
- package/dist/store/errors.mjs +7 -1
- package/dist/store/job-try.mjs +3 -1
- package/dist/store/records.mjs +26 -5
- package/dist/store/repo-record.mjs +36 -12
- package/dist/store/scopes.mjs +15 -2
- package/dist/sync/bound.d.mts +1 -1
- package/dist/sync/import.mjs +15 -3
- package/dist/sync/layer.d.mts +5 -1
- package/dist/sync/layer.mjs +11 -9
- package/dist/sync/mirror.mjs +1 -1
- package/dist/sync/step.mjs +15 -15
- package/dist/topics/advance.mjs +11 -10
- package/dist/topics/layer.mjs +1 -1
- package/dist/topics/members.mjs +38 -9
- package/package.json +3 -3
- package/dist/engine/merge-base-walk.d.mts +0 -3
- package/dist/server/routes.d.mts +0 -32
- package/dist/server/routes.mjs +0 -69
- package/dist/sync/bridge.d.mts +0 -6
- package/dist/sync/bridge.mjs +0 -29
package/dist/storage/prune.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { fail } from "../contracts/result.mjs";
|
|
2
2
|
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
3
|
+
import { rootsOf } from "../store/repo-record.mjs";
|
|
3
4
|
import { decodeRow } from "../store/errors.mjs";
|
|
4
5
|
import { WholeRepo, wholeRef } from "../store/ref-rows.mjs";
|
|
5
6
|
import { ReachedMark, markHolds } from "../store/records.mjs";
|
|
6
|
-
import { collections, reachedKey, repoScope } from "../store/scopes.mjs";
|
|
7
|
+
import { collections, reachedKey, repoRootsKey, repoScope } from "../store/scopes.mjs";
|
|
7
8
|
import { bucketDeleteMany, readWhole } from "./calls.mjs";
|
|
8
9
|
import { putOnce } from "./index-build.mjs";
|
|
9
10
|
import { isPackId, objectCollections, runKey } from "./layout.mjs";
|
|
@@ -12,7 +13,7 @@ import { decodeRefused, refusedRead } from "./merge-fence.mjs";
|
|
|
12
13
|
import { decodeMerges, droppedStep, mergeKey, mergeRead, takenOf, writtenOf } from "./merge-row.mjs";
|
|
13
14
|
import { mergeInputsMost } from "./merge-most.mjs";
|
|
14
15
|
import { opensWithin, resumeMerge, streamMerge } from "./merge-stream.mjs";
|
|
15
|
-
import { objectKey } from "./object-rows.mjs";
|
|
16
|
+
import { noRows, objectKey, rowsMoved } from "./object-rows.mjs";
|
|
16
17
|
import { bitsBytes, hasBit, keepBits, keptAt, setBit } from "./prune-keep.mjs";
|
|
17
18
|
import { WalkSaved, pruneWalk, walkKeys } from "./prune-walk.mjs";
|
|
18
19
|
import { defaultRepack, leavingRows, loadAll, mergeWith, namedOf, replacing, wholeRows } from "./repack.mjs";
|
|
@@ -70,7 +71,8 @@ const PassClasses = /* @__PURE__ */ Schema.Struct({
|
|
|
70
71
|
* scratch pack, till the pass's last step drops them. `classes` names the classes object its
|
|
71
72
|
* merges read, and `redos` counts the rewrites it dropped as pushes moved its refs onto what they
|
|
72
73
|
* were about to drop: the third waits for the next period, as `pruneStep` says, and that period's
|
|
73
|
-
* walks start again with none (#1660).
|
|
74
|
+
* walks start again with none (#1660). `periods` counts the periods in a row the pass has waited
|
|
75
|
+
* so, which a wait for any other reason ends, as `ObjectsStep.busy` says (#2233).
|
|
74
76
|
*/
|
|
75
77
|
const PruneStarted = /* @__PURE__ */ Schema.Struct({
|
|
76
78
|
at: Schema.Int,
|
|
@@ -80,7 +82,8 @@ const PruneStarted = /* @__PURE__ */ Schema.Struct({
|
|
|
80
82
|
n: Schema.optional(WalkCarry)
|
|
81
83
|
})),
|
|
82
84
|
classes: Schema.optional(PassClasses),
|
|
83
|
-
redos: Schema.optional(Schema.Int)
|
|
85
|
+
redos: Schema.optional(Schema.Int),
|
|
86
|
+
periods: Schema.optional(Schema.Int)
|
|
84
87
|
});
|
|
85
88
|
const pruneStartedKey = {
|
|
86
89
|
collection: objectCollections.prune,
|
|
@@ -150,7 +153,8 @@ const pruneWhole = /* @__PURE__ */ WholeRepo.mint();
|
|
|
150
153
|
const walkPackOf = (repo, at, kind) => `p_${kind}${repo.slice(2)}${at.toString(36).padStart(15, "0")}`;
|
|
151
154
|
/**
|
|
152
155
|
* The scratch packs of the pass marked at `at` dropped, pages at most each, once its commit is
|
|
153
|
-
* in: `'more'` while keys are left, for the next step to drop.
|
|
156
|
+
* in: `'more'` while keys are left, for the next step to drop. The next pass's first step drops
|
|
157
|
+
* them, or a deleted repo's step, which no pass follows.
|
|
154
158
|
*/
|
|
155
159
|
const passScratch = (input, at) => Effect.map(Effect.all([dropRuns(input.bucket, walkPackOf(input.listed.repo, at, "r")), dropRuns(input.bucket, walkPackOf(input.listed.repo, at, "n"))]), (drops) => drops.includes("more") ? "more" : "done");
|
|
156
160
|
/**
|
|
@@ -201,13 +205,14 @@ const bitsOf = (bits, packs) => {
|
|
|
201
205
|
* `start` with `known` reached already, as D2's walk carries it. A new walk, with neither, drops
|
|
202
206
|
* what a pass that died left under `scratch` first. With `more`, where it stopped, for the mark.
|
|
203
207
|
*/
|
|
204
|
-
const walkOn = /* @__PURE__ */ Effect.fnUntraced(function* (input, scratch, start, rows, missing, calls, saved, known) {
|
|
208
|
+
const walkOn = /* @__PURE__ */ Effect.fnUntraced(function* (input, scratch, start, rows, missing, calls, roots, saved, known) {
|
|
205
209
|
if (saved === void 0 && known === void 0) yield* dropRuns(input.bucket, scratch);
|
|
206
210
|
const walked = yield* pruneWalk(input, scratch, start, missing, {
|
|
207
211
|
rows: rows.length,
|
|
208
212
|
calls,
|
|
209
213
|
saved,
|
|
210
|
-
known
|
|
214
|
+
known,
|
|
215
|
+
roots
|
|
211
216
|
});
|
|
212
217
|
return "more" in walked ? { more: walked.more } : {
|
|
213
218
|
runs: walked.reached,
|
|
@@ -232,14 +237,29 @@ const refsHeld = /* @__PURE__ */ Effect.fnUntraced(function* (input, scratch, wa
|
|
|
232
237
|
}, upkeepRuns);
|
|
233
238
|
return held;
|
|
234
239
|
}, Effect.scoped);
|
|
235
|
-
/**
|
|
240
|
+
/** Each object `rows`, ref rows, name, once each. */
|
|
241
|
+
const refIdsIn = (rows) => Effect.map(Effect.forEach(rows ?? [], (row) => wholeRef(pruneWhole, row)), (refs) => [...new Set(refs)]);
|
|
242
|
+
/**
|
|
243
|
+
* Every ref's object, once each, and the repo's roots in the same read: a walk from the refs
|
|
244
|
+
* follows no root's parents, so what only they reach is no ref's.
|
|
245
|
+
*/
|
|
236
246
|
const refsOf = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
247
|
+
const snapshot = yield* input.store.read({
|
|
248
|
+
scope: repoScope(input.listed.repo),
|
|
249
|
+
reads: [{ collection: collections.refs }, repoRootsKey]
|
|
250
|
+
});
|
|
251
|
+
return {
|
|
252
|
+
refs: yield* refIdsIn(snapshot.results[0]),
|
|
253
|
+
roots: yield* rootsOf(snapshot.results[1])
|
|
254
|
+
};
|
|
255
|
+
});
|
|
256
|
+
/** Every ref's object, once each, with no roots: what a listing checks its bits were read at. */
|
|
257
|
+
const refIdsOf = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
237
258
|
const snapshot = yield* input.store.read({
|
|
238
259
|
scope: repoScope(input.listed.repo),
|
|
239
260
|
reads: [{ collection: collections.refs }]
|
|
240
261
|
});
|
|
241
|
-
|
|
242
|
-
return [...new Set(refs)];
|
|
262
|
+
return yield* refIdsIn(snapshot.results[0]);
|
|
243
263
|
});
|
|
244
264
|
/** The objects of `packs` and `rows` that `reached` leaves out: where the needed walk starts. */
|
|
245
265
|
const unreachedOf = (packs, rows, reached) => [...new Set([...oidsOf(packs), ...rows.map((row) => row.oid)].filter((oid) => !reached.has(oid)))];
|
|
@@ -393,7 +413,8 @@ const cruftListing = (landed) => Effect.fnUntraced(function* (input, merge) {
|
|
|
393
413
|
...cruftKey(pack.id),
|
|
394
414
|
value: { since: input.at }
|
|
395
415
|
})),
|
|
396
|
-
delete: [...quarantines, mergeKey(merge.pack)]
|
|
416
|
+
delete: [...quarantines, mergeKey(merge.pack)],
|
|
417
|
+
rows: noRows
|
|
397
418
|
},
|
|
398
419
|
more: true,
|
|
399
420
|
quarantine: first,
|
|
@@ -407,7 +428,7 @@ const cruftListing = (landed) => Effect.fnUntraced(function* (input, merge) {
|
|
|
407
428
|
* merge waits at its commit pass, and the pass catches up first.
|
|
408
429
|
*/
|
|
409
430
|
const keptListing = (read, seen, rows, landed) => Effect.fnUntraced(function* (input, merge) {
|
|
410
|
-
if ((yield* readsDigest(yield*
|
|
431
|
+
if ((yield* readsDigest(yield* refIdsOf(input), rows)) !== seen.reads || !sameIds(seen.packs, classedIds(input, read))) return void 0;
|
|
411
432
|
const removed = yield* takenOf(input, merge);
|
|
412
433
|
const { packs, quarantines, first } = yield* writtenOf(merge);
|
|
413
434
|
const dropped = removed.filter((pack) => read.cruft.has(pack.id));
|
|
@@ -421,7 +442,8 @@ const keptListing = (read, seen, rows, landed) => Effect.fnUntraced(function* (i
|
|
|
421
442
|
...quarantines,
|
|
422
443
|
...dropped.map((pack) => cruftKey(pack.id)),
|
|
423
444
|
mergeKey(merge.pack)
|
|
424
|
-
]
|
|
445
|
+
],
|
|
446
|
+
rows: noRows
|
|
425
447
|
},
|
|
426
448
|
more: true,
|
|
427
449
|
quarantine: first,
|
|
@@ -477,7 +499,8 @@ const rowsCruft = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, most
|
|
|
477
499
|
...cruftKey(id),
|
|
478
500
|
value: { since: input.at }
|
|
479
501
|
}],
|
|
480
|
-
delete: [merged.quarantine]
|
|
502
|
+
delete: [merged.quarantine],
|
|
503
|
+
rows: noRows
|
|
481
504
|
},
|
|
482
505
|
more: true,
|
|
483
506
|
quarantine: merged.quarantine
|
|
@@ -492,7 +515,10 @@ const rowsStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, keep,
|
|
|
492
515
|
});
|
|
493
516
|
if (merged === "too big") return { waits: "its rows pack is past the pack size" };
|
|
494
517
|
const step = {
|
|
495
|
-
change: merged === void 0 ? {
|
|
518
|
+
change: merged === void 0 ? {
|
|
519
|
+
delete: rows.map((row) => objectKey(row.oid)),
|
|
520
|
+
rows: rowsMoved(rows, "deleted")
|
|
521
|
+
} : replacing(input, merged, [], rows),
|
|
496
522
|
more: true
|
|
497
523
|
};
|
|
498
524
|
if (merged !== void 0) step.quarantine = merged.quarantine;
|
|
@@ -500,7 +526,9 @@ const rowsStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, keep,
|
|
|
500
526
|
});
|
|
501
527
|
/**
|
|
502
528
|
* The step that unlists each pack of `emptied`, whose every object the pass drops, with no merge:
|
|
503
|
-
* each a `leaving` row, and an old cruft pack's `cruft` row ended, so the step `drops`.
|
|
529
|
+
* each a `leaving` row, and an old cruft pack's `cruft` row ended, so the step `drops`. It makes
|
|
530
|
+
* the `repack` row due, whose clean-up deletes the packs' bytes once their rows are, so on a repo
|
|
531
|
+
* that takes no push they don't wait for the row's next run.
|
|
504
532
|
*/
|
|
505
533
|
const emptiedStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, emptied) {
|
|
506
534
|
const ids = new Set(emptied.map((each) => each.pack));
|
|
@@ -510,16 +538,52 @@ const emptiedStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, em
|
|
|
510
538
|
change: {
|
|
511
539
|
remove: removed.map((pack) => pack.id),
|
|
512
540
|
put: leavingRows(input, removed),
|
|
513
|
-
delete: dropped.map((pack) => cruftKey(pack.id))
|
|
541
|
+
delete: dropped.map((pack) => cruftKey(pack.id)),
|
|
542
|
+
rows: noRows
|
|
514
543
|
},
|
|
515
|
-
more: true
|
|
544
|
+
more: true,
|
|
545
|
+
repack: input.at
|
|
516
546
|
};
|
|
517
547
|
if (dropped.length > 0) step.drops = true;
|
|
518
548
|
return step;
|
|
519
549
|
});
|
|
520
|
-
/** `started` with `
|
|
550
|
+
/** A mark at `started`'s start, with its `periods`, if any: what each new mark of the pass keeps. */
|
|
551
|
+
const periodsOf = (started) => started.periods === void 0 ? { at: started.at } : {
|
|
552
|
+
at: started.at,
|
|
553
|
+
periods: started.periods
|
|
554
|
+
};
|
|
555
|
+
/**
|
|
556
|
+
* The pass's mark with its count of periods pushes held it ended, when an underway pass's mark
|
|
557
|
+
* has one: what a wait for anything but pushes puts, its walks and its wait kept (#2233).
|
|
558
|
+
*/
|
|
559
|
+
const countEnded = (read) => {
|
|
560
|
+
const { started } = read;
|
|
561
|
+
const last = read.pass?.at;
|
|
562
|
+
if (started?.periods === void 0 || last !== void 0 && started.at <= last) return void 0;
|
|
563
|
+
const value = { ...started };
|
|
564
|
+
delete value.periods;
|
|
565
|
+
return {
|
|
566
|
+
...pruneStartedKey,
|
|
567
|
+
value
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
/** `step`, or a step of its own when there's none, putting `row` too. */
|
|
571
|
+
const alsoPuts = (step, row) => {
|
|
572
|
+
const base = step ?? {
|
|
573
|
+
change: { rows: noRows },
|
|
574
|
+
more: true
|
|
575
|
+
};
|
|
576
|
+
return {
|
|
577
|
+
...base,
|
|
578
|
+
change: {
|
|
579
|
+
...base.change,
|
|
580
|
+
put: [...base.change.put ?? [], row]
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
/** `started` with `patch` laid over it, its `waits` ended and its `periods` kept. */
|
|
521
585
|
const remarked = (started, patch) => {
|
|
522
|
-
const value =
|
|
586
|
+
const value = periodsOf(started);
|
|
523
587
|
const walks = "walks" in patch ? patch.walks : started.walks;
|
|
524
588
|
const classes = "classes" in patch ? patch.classes : started.classes;
|
|
525
589
|
const redos = "redos" in patch ? patch.redos : started.redos;
|
|
@@ -553,17 +617,17 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
553
617
|
const scratch = walkPackOf(input.listed.repo, at, "r");
|
|
554
618
|
const saving = (walks) => ({
|
|
555
619
|
step: {
|
|
556
|
-
change: {},
|
|
620
|
+
change: { rows: noRows },
|
|
557
621
|
more: true
|
|
558
622
|
},
|
|
559
623
|
mark: { walks }
|
|
560
624
|
});
|
|
561
|
-
const refs = yield* refsOf(input);
|
|
625
|
+
const { refs, roots } = yield* refsOf(input);
|
|
562
626
|
const digest = yield* readsDigest(refs, rowOids);
|
|
563
627
|
const ids = classedIds(input, read);
|
|
564
628
|
const carry = carried.r;
|
|
565
629
|
if (carry === void 0 || "saved" in carry) {
|
|
566
|
-
const walked = yield* walkOn(input, scratch, refs, rows, lost, calls, carry?.saved);
|
|
630
|
+
const walked = yield* walkOn(input, scratch, refs, rows, lost, calls, roots, carry?.saved);
|
|
567
631
|
return saving({ r: "more" in walked ? {
|
|
568
632
|
saved: walked.more,
|
|
569
633
|
refs: carry?.refs
|
|
@@ -616,7 +680,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
616
680
|
});
|
|
617
681
|
const caught = yield* Effect.scoped(Effect.map(sides, ({ reached }) => refs.filter((oid) => !reached.has(oid))));
|
|
618
682
|
if (caught.length > 0) {
|
|
619
|
-
const walked = yield* walkOn(input, scratch, caught, rows, lost, calls, void 0, reachedRuns);
|
|
683
|
+
const walked = yield* walkOn(input, scratch, caught, rows, lost, calls, roots, void 0, reachedRuns);
|
|
620
684
|
return saving({
|
|
621
685
|
...carried,
|
|
622
686
|
r: "more" in walked ? {
|
|
@@ -661,7 +725,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
661
725
|
if ("cruft" in first) return first.cruft;
|
|
662
726
|
if ("classes" in first) return {
|
|
663
727
|
step: {
|
|
664
|
-
change: {},
|
|
728
|
+
change: { rows: noRows },
|
|
665
729
|
more: true
|
|
666
730
|
},
|
|
667
731
|
mark: { classes: first.classes }
|
|
@@ -670,7 +734,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
670
734
|
const neededCarry = carried.n;
|
|
671
735
|
if (packs.old.length > 0 && (neededCarry === void 0 || "saved" in neededCarry)) {
|
|
672
736
|
const start = neededCarry === void 0 ? first.start : [];
|
|
673
|
-
const walked = yield* walkOn(input, named, start, rows, () => void 0, calls, neededCarry?.saved, neededCarry === void 0 ? reachedRuns : void 0);
|
|
737
|
+
const walked = yield* walkOn(input, named, start, rows, () => void 0, calls, roots, neededCarry?.saved, neededCarry === void 0 ? reachedRuns : void 0);
|
|
674
738
|
return saving({
|
|
675
739
|
...carried,
|
|
676
740
|
n: "more" in walked ? { saved: walked.more } : { done: walked.runs }
|
|
@@ -683,7 +747,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
683
747
|
return first.start.filter((oid) => !needed.has(oid));
|
|
684
748
|
}));
|
|
685
749
|
if (neededDone !== void 0 && behind.length > 0) {
|
|
686
|
-
const walked = yield* walkOn(input, named, behind, rows, () => void 0, calls, void 0, neededDone);
|
|
750
|
+
const walked = yield* walkOn(input, named, behind, rows, () => void 0, calls, roots, void 0, neededDone);
|
|
687
751
|
return saving({
|
|
688
752
|
...carried,
|
|
689
753
|
n: "more" in walked ? { saved: walked.more } : { done: walked.runs }
|
|
@@ -713,7 +777,10 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
713
777
|
}, rowOids, landed);
|
|
714
778
|
return went(yield* resumeMerge(input, merge, most, calls, listing), "kept");
|
|
715
779
|
}
|
|
716
|
-
if (redos + 1 >= 3) return {
|
|
780
|
+
if (redos + 1 >= 3) return {
|
|
781
|
+
waits: `pushes moved its refs onto what its rewrite was about to drop, 3 times in a row`,
|
|
782
|
+
busy: true
|
|
783
|
+
};
|
|
717
784
|
return {
|
|
718
785
|
step: droppedStep(merge),
|
|
719
786
|
mark: {
|
|
@@ -731,18 +798,19 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
731
798
|
if (emptied.length > 0) return { step: yield* emptiedStep(input, read, emptied) };
|
|
732
799
|
if (rewrites.length > 0) {
|
|
733
800
|
const n = (classes?.n ?? -1) + 1;
|
|
801
|
+
const value = {
|
|
802
|
+
kind: "kept",
|
|
803
|
+
n,
|
|
804
|
+
packs: ids,
|
|
805
|
+
reads: digest,
|
|
806
|
+
bytes: yield* putClasses(input, classesKey(input.listed.repo, at, n), rewrites)
|
|
807
|
+
};
|
|
734
808
|
return {
|
|
735
809
|
step: {
|
|
736
|
-
change: {},
|
|
810
|
+
change: { rows: noRows },
|
|
737
811
|
more: true
|
|
738
812
|
},
|
|
739
|
-
mark: { classes:
|
|
740
|
-
kind: "kept",
|
|
741
|
-
n,
|
|
742
|
-
packs: ids,
|
|
743
|
-
reads: digest,
|
|
744
|
-
bytes: yield* putClasses(input, classesKey(input.listed.repo, at, n), rewrites)
|
|
745
|
-
} }
|
|
813
|
+
mark: { classes: value }
|
|
746
814
|
};
|
|
747
815
|
}
|
|
748
816
|
const held = carry.refs === void 0 || (yield* refsHeld(input, scratch, carry.refs, refs));
|
|
@@ -750,14 +818,17 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
750
818
|
const scratchDropped = yield* dropRuns(input.bucket, scratch, marked);
|
|
751
819
|
const namedDropped = yield* dropRuns(input.bucket, named, marked);
|
|
752
820
|
if (scratchDropped === "more" || namedDropped === "more") return { step: {
|
|
753
|
-
change: {},
|
|
821
|
+
change: { rows: noRows },
|
|
754
822
|
more: true
|
|
755
823
|
} };
|
|
756
824
|
const step = {
|
|
757
|
-
change: {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
825
|
+
change: {
|
|
826
|
+
put: [{
|
|
827
|
+
...prunePassKey,
|
|
828
|
+
value: { at: input.at }
|
|
829
|
+
}],
|
|
830
|
+
rows: noRows
|
|
831
|
+
},
|
|
761
832
|
more: false
|
|
762
833
|
};
|
|
763
834
|
const whole = (oid) => keep(oid) || inFenced(oid);
|
|
@@ -816,8 +887,9 @@ const passDue = (input, prune, read, objectRows) => {
|
|
|
816
887
|
* that died or failed, waits for the next period, as does one whose walk is past what one walk
|
|
817
888
|
* holds or makes no step, and one whose rewrite pushes caught up with `redosMost` times: each
|
|
818
889
|
* writes the wait to its mark and drops its merge under way, with a log line. A pass that waits
|
|
819
|
-
* before its walk logs too, and writes nothing
|
|
820
|
-
*
|
|
890
|
+
* before its walk logs too, and writes nothing but its mark's end of a count of periods pushes
|
|
891
|
+
* held it, as every wait for anything but pushes does. `step` is `undefined` when no pass is
|
|
892
|
+
* due; `next` is when the next one is, and `undefined` for a repo that holds no object.
|
|
821
893
|
*/
|
|
822
894
|
const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, repack, read, objectRows, drops, holds, retried = false, calls) {
|
|
823
895
|
const due = passDue(input, prune, read, objectRows);
|
|
@@ -833,28 +905,33 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
833
905
|
const last = read.pass?.at;
|
|
834
906
|
const markHeld = markHolds(read.mark);
|
|
835
907
|
const merge = read.merges.prune;
|
|
908
|
+
const uncounted = countEnded(read);
|
|
909
|
+
const waitsElse = (step) => uncounted === void 0 ? step : alsoPuts(step, uncounted);
|
|
836
910
|
if (holds.length > 0) {
|
|
837
911
|
const after = input.at + pruneFloor;
|
|
838
912
|
yield* Effect.logWarning(`git.repack's prune pass of repo ${input.listed.repo}, due ${iso(next)}, waits until ${iso(after)}: held by ${holds.join(", ")}, as an import's segments are reached by no ref till it publishes`);
|
|
839
913
|
return {
|
|
840
|
-
step: merge === void 0 ? void 0 : droppedStep(merge),
|
|
914
|
+
step: waitsElse(merge === void 0 ? void 0 : droppedStep(merge)),
|
|
841
915
|
next: after
|
|
842
916
|
};
|
|
843
917
|
}
|
|
844
918
|
const ended = read.started?.at;
|
|
845
919
|
if (ended !== void 0 && last !== void 0 && ended <= last && (yield* passScratch(input, ended)) === "more") return {
|
|
846
920
|
step: {
|
|
847
|
-
change: {},
|
|
921
|
+
change: { rows: noRows },
|
|
848
922
|
more: true
|
|
849
923
|
},
|
|
850
924
|
next
|
|
851
925
|
};
|
|
852
926
|
if (markHeld && read.cruft.size === 0 && merge === void 0) return {
|
|
853
927
|
step: {
|
|
854
|
-
change: {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
928
|
+
change: {
|
|
929
|
+
put: [{
|
|
930
|
+
...prunePassKey,
|
|
931
|
+
value: { at: input.at }
|
|
932
|
+
}],
|
|
933
|
+
rows: noRows
|
|
934
|
+
},
|
|
858
935
|
more: true
|
|
859
936
|
},
|
|
860
937
|
next: input.at + pruneWait(prune)
|
|
@@ -862,7 +939,7 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
862
939
|
const most = (repack === false ? void 0 : repack.maxPackSize) ?? defaultRepack.maxPackSize;
|
|
863
940
|
const until = input.at + pruneWait(prune);
|
|
864
941
|
const later = (why) => Effect.as(Effect.logWarning(`git.repack's prune pass of repo ${input.listed.repo}, due ${iso(next)}, waits until ${iso(until)}: ${why}`), {
|
|
865
|
-
step: void 0,
|
|
942
|
+
step: waitsElse(void 0),
|
|
866
943
|
next: until
|
|
867
944
|
});
|
|
868
945
|
const { rows } = objectRows;
|
|
@@ -877,10 +954,13 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
877
954
|
const { started } = read;
|
|
878
955
|
if (!(started !== void 0 && (last === void 0 || started.at > last))) return {
|
|
879
956
|
step: {
|
|
880
|
-
change: {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
957
|
+
change: {
|
|
958
|
+
put: [{
|
|
959
|
+
...pruneStartedKey,
|
|
960
|
+
value: { at: input.at }
|
|
961
|
+
}],
|
|
962
|
+
rows: noRows
|
|
963
|
+
},
|
|
884
964
|
more: true
|
|
885
965
|
},
|
|
886
966
|
next
|
|
@@ -889,19 +969,34 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
889
969
|
step: void 0,
|
|
890
970
|
next: started.waits
|
|
891
971
|
};
|
|
892
|
-
const waits = (why) => {
|
|
972
|
+
const waits = (why, busy = false) => {
|
|
973
|
+
const periods = (started.periods ?? 0) + 1;
|
|
974
|
+
const value = busy ? {
|
|
975
|
+
at: started.at,
|
|
976
|
+
waits: until,
|
|
977
|
+
periods
|
|
978
|
+
} : {
|
|
979
|
+
at: started.at,
|
|
980
|
+
waits: until
|
|
981
|
+
};
|
|
893
982
|
const mark = {
|
|
894
983
|
...pruneStartedKey,
|
|
895
|
-
value
|
|
896
|
-
at: started.at,
|
|
897
|
-
waits: until
|
|
898
|
-
}
|
|
984
|
+
value
|
|
899
985
|
};
|
|
900
|
-
const
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
986
|
+
const change = merge === void 0 ? {
|
|
987
|
+
put: [mark],
|
|
988
|
+
rows: noRows
|
|
989
|
+
} : {
|
|
990
|
+
put: [mark],
|
|
991
|
+
delete: [mergeKey(merge.pack)],
|
|
992
|
+
rows: noRows
|
|
993
|
+
};
|
|
994
|
+
const step = busy ? {
|
|
995
|
+
change,
|
|
996
|
+
more: true,
|
|
997
|
+
busy: periods
|
|
998
|
+
} : {
|
|
999
|
+
change,
|
|
905
1000
|
more: true
|
|
906
1001
|
};
|
|
907
1002
|
return Effect.as(later(why), {
|
|
@@ -911,7 +1006,7 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
911
1006
|
};
|
|
912
1007
|
if (retried) return yield* waits("its last try died or failed with the pass under way");
|
|
913
1008
|
const stepped = yield* passSteps(input, read, packs, rows, most, calls).pipe(Effect.catchTag("PruneWalkTooLarge", (refused) => fail("RESOURCE_EXHAUSTED", `The prune pass is past what one walk holds: ${refused.message}`, { context: { reason: "prune-walk-too-large" } })));
|
|
914
|
-
if ("waits" in stepped) return yield* waits(stepped.waits);
|
|
1009
|
+
if ("waits" in stepped) return yield* waits(stepped.waits, "busy" in stepped);
|
|
915
1010
|
const { change } = stepped.step;
|
|
916
1011
|
const patch = "mark" in stepped ? stepped.mark : void 0;
|
|
917
1012
|
const step = patch === void 0 ? stepped.step : {
|
|
@@ -925,10 +1020,13 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
925
1020
|
}
|
|
926
1021
|
};
|
|
927
1022
|
if ("last" in stepped) {
|
|
928
|
-
const rewalk = {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1023
|
+
const rewalk = {
|
|
1024
|
+
put: [{
|
|
1025
|
+
...pruneStartedKey,
|
|
1026
|
+
value: periodsOf(started)
|
|
1027
|
+
}],
|
|
1028
|
+
rows: noRows
|
|
1029
|
+
};
|
|
932
1030
|
return {
|
|
933
1031
|
step: {
|
|
934
1032
|
...step.reaches === true ? {
|
|
@@ -945,4 +1043,4 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
945
1043
|
next
|
|
946
1044
|
};
|
|
947
1045
|
});
|
|
948
|
-
export { CruftRow, PassClasses, PruneCleared, PrunePass, PruneStarted, bitsOf, cruftOf, mergesAlone, passDue, pruneClearedKey, prunePassKey, pruneStartedKey, pruneStep, reachesOnly, readPrune, walkPackOf };
|
|
1046
|
+
export { CruftRow, PassClasses, PruneCleared, PrunePass, PruneStarted, bitsOf, cruftOf, mergesAlone, passDue, passScratch, pruneClearedKey, prunePassKey, pruneStartedKey, pruneStep, reachesOnly, readPrune, walkPackOf };
|
package/dist/storage/ready.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ import "./fetch.mjs";
|
|
|
8
8
|
import "./walk.mjs";
|
|
9
9
|
import "effect/Effect";
|
|
10
10
|
import "effect/Schema";
|
|
11
|
-
import { Key, Moment } from "@ref0/infra";
|
|
11
|
+
import { Key, Moment, Row } from "@ref0/infra";
|
|
12
12
|
import "effect/Scope";
|
|
13
13
|
/**
|
|
14
14
|
* `packs()`' pack kept ready for a shallow clone of the default branch: one with exactly `depth`,
|
package/dist/storage/ready.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { startPut } from "./merge.mjs";
|
|
|
8
8
|
import { readBusy, upkeepTooLarge } from "./memory-budget.mjs";
|
|
9
9
|
import { callsAhead, packOfPlan, planFetchWithin, planTooSlow, timeLeft, unreadPackMs } from "./fetch.mjs";
|
|
10
10
|
import { isPackId, objectCollections, packFiles } from "./layout.mjs";
|
|
11
|
+
import { noRows } from "./object-rows.mjs";
|
|
11
12
|
import { openQuarantine } from "./quarantine.mjs";
|
|
12
13
|
import { leavingRow, removeAt } from "./rows.mjs";
|
|
13
14
|
import * as Clock$1 from "effect/Clock";
|
|
@@ -80,6 +81,12 @@ const readOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, listed) {
|
|
|
80
81
|
if (row === void 0) return void 0;
|
|
81
82
|
return yield* decodeRow(ReadyRow, row, "The ready shallow pack's row");
|
|
82
83
|
});
|
|
84
|
+
/** The bytes of the ready pack `rows`, a read of `readyKey`, hold: 0 with none kept. */
|
|
85
|
+
const readyBytesOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows) {
|
|
86
|
+
const [row] = rows;
|
|
87
|
+
if (row === void 0) return 0;
|
|
88
|
+
return (yield* decodeRow(ReadyRow, row, "The ready shallow pack's row")).pack?.bytes ?? 0;
|
|
89
|
+
});
|
|
83
90
|
/**
|
|
84
91
|
* Whether a ready pack answers `input` exactly, as its plan would now: the one want its tip, no
|
|
85
92
|
* haves and no shallow commits, its depth, no `deepen-relative` and no filter, and `include-tag`
|
|
@@ -340,7 +347,8 @@ const readyStep = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
340
347
|
const removed = {
|
|
341
348
|
change: {
|
|
342
349
|
put,
|
|
343
|
-
delete: [readyKey]
|
|
350
|
+
delete: [readyKey],
|
|
351
|
+
rows: noRows
|
|
344
352
|
},
|
|
345
353
|
more: false
|
|
346
354
|
};
|
|
@@ -373,7 +381,8 @@ const readyStep = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
373
381
|
const change = {
|
|
374
382
|
change: {
|
|
375
383
|
put,
|
|
376
|
-
delete: del
|
|
384
|
+
delete: del,
|
|
385
|
+
rows: noRows
|
|
377
386
|
},
|
|
378
387
|
more: false
|
|
379
388
|
};
|
|
@@ -386,4 +395,4 @@ const readyStep = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
386
395
|
due
|
|
387
396
|
};
|
|
388
397
|
});
|
|
389
|
-
export { ReadyRow, defaultShallow, readyAnswer, readyBytesMost, readyKey, readyRequest, readyShallowsMost, readyStep, tagsDigest, untilEnded };
|
|
398
|
+
export { ReadyRow, defaultShallow, readyAnswer, readyBytesMost, readyBytesOf, readyKey, readyRequest, readyShallowsMost, readyStep, tagsDigest, untilEnded };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { millis } from "../contracts/promises.mjs";
|
|
2
|
+
import { repoRootsMost } from "../store/records.mjs";
|
|
2
3
|
import { graphBytes } from "../protocol/packs/graph.mjs";
|
|
3
4
|
import { packIndexBytes } from "../protocol/packs/idx.mjs";
|
|
4
5
|
import { packPositionsBytes } from "../protocol/packs/pos.mjs";
|
|
@@ -66,9 +67,9 @@ const receiveTableMost = /* @__PURE__ */ Math.floor((2 ** 22 - 1) * 3 / 4);
|
|
|
66
67
|
* The most boundary commits an import segment's receive takes, 10,000, as `readyShallowsMost`
|
|
67
68
|
* bounds a shallow pack's: each is held as an ID in a set, with its parents the pack leaves out.
|
|
68
69
|
* Past it the receive is refused `too-large` before its pack is read, and the import halves its
|
|
69
|
-
* step.
|
|
70
|
+
* step. It's `repoRootsMost`, since a last segment's boundary becomes the repo's roots.
|
|
70
71
|
*/
|
|
71
|
-
const receiveBoundaryMost =
|
|
72
|
+
const receiveBoundaryMost = repoRootsMost;
|
|
72
73
|
/**
|
|
73
74
|
* The most parents of its boundary commits an import holds at once, 20,000, two for each of
|
|
74
75
|
* `receiveBoundaryMost`, as a frontier of merges needs: halving a step doesn't narrow a frontier.
|
|
@@ -135,7 +135,7 @@ const readStepState = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, keys,
|
|
|
135
135
|
if (table === void 0) return yield* lost("table", keys.table);
|
|
136
136
|
if (state.pointers > 5e4 || state.checked.count > receiveCheckedLimits.most) return yield* cut("records", keys.state);
|
|
137
137
|
yield* pointers.carrying(state.pointers);
|
|
138
|
-
yield* records("pointers", keys.pointers, [
|
|
138
|
+
yield* records("pointers", keys.pointers, [57, state.pointers], (record) => {
|
|
139
139
|
pointers.carried(record);
|
|
140
140
|
return true;
|
|
141
141
|
});
|
|
@@ -2,6 +2,7 @@ import { packReadBytes } from "../protocol/packs/reader.mjs";
|
|
|
2
2
|
import { decodeRow } from "../store/errors.mjs";
|
|
3
3
|
import { repoScope } from "../store/scopes.mjs";
|
|
4
4
|
import { objectCollections } from "./layout.mjs";
|
|
5
|
+
import { noRows } from "./object-rows.mjs";
|
|
5
6
|
import { openIndexRanges } from "./pack-ranges.mjs";
|
|
6
7
|
import { compareIds } from "./raw-ids.mjs";
|
|
7
8
|
import { leavingRows, namedOf } from "./repack.mjs";
|
|
@@ -238,30 +239,37 @@ const containedWalk = /* @__PURE__ */ Effect.fnUntraced(function* (input, plan)
|
|
|
238
239
|
return {
|
|
239
240
|
change: {
|
|
240
241
|
remove: [smaller.id],
|
|
241
|
-
put
|
|
242
|
+
put,
|
|
243
|
+
rows: noRows
|
|
242
244
|
},
|
|
243
245
|
more: true
|
|
244
246
|
};
|
|
245
247
|
}
|
|
246
248
|
return {
|
|
247
|
-
change: {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
change: {
|
|
250
|
+
put: [{
|
|
251
|
+
...apartKey,
|
|
252
|
+
value: {
|
|
253
|
+
pairs: apart,
|
|
254
|
+
walking: {
|
|
255
|
+
pair,
|
|
256
|
+
...walked.walk
|
|
257
|
+
}
|
|
254
258
|
}
|
|
255
|
-
}
|
|
256
|
-
|
|
259
|
+
}],
|
|
260
|
+
rows: noRows
|
|
261
|
+
},
|
|
257
262
|
more: true
|
|
258
263
|
};
|
|
259
264
|
}
|
|
260
265
|
return {
|
|
261
|
-
change: {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
266
|
+
change: {
|
|
267
|
+
put: [{
|
|
268
|
+
...apartKey,
|
|
269
|
+
value: { pairs: apart }
|
|
270
|
+
}],
|
|
271
|
+
rows: noRows
|
|
272
|
+
},
|
|
265
273
|
more: true
|
|
266
274
|
};
|
|
267
275
|
}).pipe(Effect.ensuring(Effect.sync(() => allotment.shrink(containedHeldBytes))));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../index.mjs";
|
|
2
2
|
import "./pack-reads.mjs";
|
|
3
3
|
import "./merge.mjs";
|
|
4
|
-
import "../contracts/promises.mjs";
|
|
5
4
|
import "../contracts/objects.mjs";
|
|
5
|
+
import "../contracts/promises.mjs";
|
|
6
6
|
import { RepoStats } from "../contracts/repos.mjs";
|
|
7
7
|
import "../contracts/services.mjs";
|
|
8
8
|
import "../contracts/store.mjs";
|
package/dist/storage/repack.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { backlogPacksMost } from "./repack-backlog.mjs";
|
|
|
5
5
|
import { foldedRows } from "./merge-choose.mjs";
|
|
6
6
|
import "./merge-cut.mjs";
|
|
7
7
|
import { writeMerged } from "./merge.mjs";
|
|
8
|
-
import { largeBatch, objectKey, objectOfRow, tooLargeRead } from "./object-rows.mjs";
|
|
8
|
+
import { largeBatch, objectKey, objectOfRow, rowsMoved, tooLargeRead } from "./object-rows.mjs";
|
|
9
9
|
import { indexBytes } from "./pack-reads.mjs";
|
|
10
10
|
import { leavingRow, pruneFloor } from "./rows.mjs";
|
|
11
11
|
import * as Effect from "effect/Effect";
|
|
@@ -180,7 +180,8 @@ const replacing = (input, merged, removed, rows) => ({
|
|
|
180
180
|
add: [merged.pack],
|
|
181
181
|
remove: removed.map((pack) => pack.id),
|
|
182
182
|
put: leavingRows(input, removed),
|
|
183
|
-
delete: [merged.quarantine, ...rows.map((row) => objectKey(row.oid))]
|
|
183
|
+
delete: [merged.quarantine, ...rows.map((row) => objectKey(row.oid))],
|
|
184
|
+
rows: rowsMoved(rows, "deleted")
|
|
184
185
|
});
|
|
185
186
|
/**
|
|
186
187
|
* A member's share of a group (Q903; Coordinator: changed, 26 Nov): its bytes less what it shares
|