@ref0/git 0.27.0 → 0.29.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/client/git-http.mjs +29 -12
- package/dist/client/push-upload.mjs +13 -12
- package/dist/client/remote-helper.mjs +1 -1
- package/dist/client/remote.mjs +1 -1
- package/dist/client/run-remote-helper.mjs +7 -14
- package/dist/client/slice-push.d.mts +13 -9
- package/dist/client/slice-push.mjs +16 -5
- package/dist/client/slice-report.mjs +6 -8
- package/dist/client/transport.mjs +27 -5
- package/dist/contracts/git.d.mts +17 -2
- package/dist/contracts/store.d.mts +1 -1
- package/dist/core/forks.mjs +1 -1
- package/dist/core/purge.mjs +1 -1
- package/dist/http/push-uploads.mjs +10 -15
- package/dist/lfs/copy.d.mts +4 -1
- package/dist/lfs/copy.mjs +7 -6
- package/dist/lfs/layer.mjs +1 -1
- package/dist/lfs/objects.mjs +127 -8
- package/dist/lfs/upload-most.mjs +19 -3
- package/dist/merges/merges.d.mts +3 -2
- package/dist/protocol/bytes/buffers.mjs +5 -5
- package/dist/protocol/bytes/crc32.mjs +39 -6
- package/dist/protocol/bytes/deflate.d.mts +11 -31
- package/dist/protocol/bytes/deflate.mjs +133 -72
- package/dist/protocol/bytes/inflate.mjs +2 -2
- package/dist/protocol/bytes/sha1-hasher.mjs +12 -12
- package/dist/protocol/bytes/zlib-ng/README.md +65 -38
- package/dist/protocol/bytes/zlib-ng/compile.d.mts +5 -4
- package/dist/protocol/bytes/zlib-ng/compile.mjs +5 -4
- package/dist/protocol/bytes/zlib-ng/embedded.mjs +1 -1
- package/dist/protocol/bytes/zlib-ng/instance.mjs +14 -8
- package/dist/protocol/bytes/zlib-ng/zlib-ng.wasm +0 -0
- package/dist/protocol/objects/fsck-names.mjs +27 -7
- package/dist/protocol/objects/fsck.mjs +100 -88
- package/dist/protocol/objects/object-rules.d.mts +1 -0
- package/dist/protocol/objects/tree.d.mts +1 -0
- package/dist/protocol/objects/tree.mjs +55 -6
- package/dist/protocol/wire/push-uploads.mjs +12 -1
- package/dist/server/registry.mjs +12 -0
- package/dist/server/server.mjs +7 -1
- package/dist/storage/budget.d.mts +2 -1
- package/dist/storage/budget.mjs +25 -9
- package/dist/storage/calls.d.mts +1 -1
- package/dist/storage/calls.mjs +4 -2
- package/dist/storage/host-bucket.mjs +15 -5
- package/dist/storage/index-bitmaps.d.mts +1 -0
- package/dist/storage/index-bitmaps.mjs +15 -14
- package/dist/storage/index-build.d.mts +2 -1
- package/dist/storage/index-build.mjs +14 -16
- package/dist/storage/index-files.mjs +3 -3
- package/dist/storage/index-graph.mjs +3 -3
- package/dist/storage/index-remap.mjs +6 -7
- package/dist/storage/links.mjs +34 -2
- package/dist/storage/memory-budget.mjs +12 -3
- package/dist/storage/merge-stream.mjs +4 -3
- package/dist/storage/merge-write.mjs +2 -2
- package/dist/storage/pack-receive.mjs +24 -8
- package/dist/storage/packs.d.mts +3 -1
- package/dist/storage/packs.mjs +33 -11
- package/dist/storage/put-holds.d.mts +1 -0
- package/dist/storage/put-holds.mjs +20 -0
- package/dist/storage/ready.mjs +4 -2
- package/dist/storage/receive-bounds.d.mts +1 -1
- package/dist/storage/receive-bounds.mjs +4 -4
- package/dist/storage/receive-links.mjs +31 -15
- package/dist/storage/receive-steps.mjs +21 -1
- package/dist/storage/runs.d.mts +1 -1
- package/dist/storage/runs.mjs +7 -5
- package/dist/store/door.mjs +9 -1
- package/dist/store/job-try.mjs +5 -5
- package/dist/store/repo-record.mjs +1 -1
- package/dist/sync/step.mjs +3 -4
- package/package.json +3 -9
- package/dist/http/node.d.mts +0 -62
- package/dist/http/node.mjs +0 -212
- package/dist/node.d.mts +0 -3
- package/dist/node.mjs +0 -1
- package/dist/server/edge-node.d.mts +0 -19
- package/dist/server/edge-node.mjs +0 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gitError } from "../contracts/result.mjs";
|
|
2
2
|
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { sha1Now } from "../protocol/bytes/sha1-hasher.mjs";
|
|
4
4
|
import { answerSpent, pastCallLimit } from "../store/errors.mjs";
|
|
5
5
|
import { copyHeldBytes, isKeepUnclosed, isMergeIncomplete, mergeIncomplete } from "./index-bitmaps.mjs";
|
|
6
6
|
import { belowGraphs, copyMergedBitmaps, coveredPacks, indexRowOf, mergeCallsAfterOpen, mergeChunk, newBuildId, putOnce, wordsOf } from "./index-build.mjs";
|
|
@@ -93,7 +93,7 @@ const keptRowBytes = 64;
|
|
|
93
93
|
* beside the tail's and then beside the graph merge's, and the bitmaps' copy beside both, since
|
|
94
94
|
* it runs before the graph's file finishes.
|
|
95
95
|
*/
|
|
96
|
-
const remapHeldMost = (plan, layers, objects, keeps = false) => {
|
|
96
|
+
const remapHeldMost = (plan, layers, objects, multipart, keeps = false) => {
|
|
97
97
|
const tail = plan.positions - plan.prefix;
|
|
98
98
|
const positions = plan.prefix + tail + objects;
|
|
99
99
|
const commits = layers.reduce((sum, layer) => sum + layer.commits, 0);
|
|
@@ -105,7 +105,7 @@ const remapHeldMost = (plan, layers, objects, keeps = false) => {
|
|
|
105
105
|
const dropped = keeps ? Math.max(0, taken - objects) : 0;
|
|
106
106
|
const ids = map + tail * 20 + joinBytes(tail) + plan.rows * keptRowBytes;
|
|
107
107
|
const graph = commits * 4 + mergeHeldBytes(layers.length);
|
|
108
|
-
const copy = bitmaps * 640 + copyHeldBytes(positions, bitmaps, files);
|
|
108
|
+
const copy = bitmaps * 640 + copyHeldBytes(positions, bitmaps, files, multipart);
|
|
109
109
|
const phases = [
|
|
110
110
|
ids + goneBuildBytes(dropped),
|
|
111
111
|
map + goneHeldBytes(dropped) + graph,
|
|
@@ -220,7 +220,7 @@ const remapPast = (input) => {
|
|
|
220
220
|
if (remapCpuPast(remapUnits(plan, layers), input.cpuMost)) return "cpu";
|
|
221
221
|
if (input.lease !== void 0 && input.lease >= input.grace) return "lease";
|
|
222
222
|
if (pastCallsLeft(input.calls, remapCallsMost(plan, layers, mergedObjects(merged), input.bucket.multipart))) return "calls";
|
|
223
|
-
const held = remapHeldMost(plan, layers, mergedObjects(merged), input.keeps !== void 0);
|
|
223
|
+
const held = remapHeldMost(plan, layers, mergedObjects(merged), input.bucket.multipart, input.keeps !== void 0);
|
|
224
224
|
if (!input.allotment.tryGrow(held)) return "memory";
|
|
225
225
|
input.allotment.shrink(held);
|
|
226
226
|
};
|
|
@@ -589,8 +589,7 @@ const remapIndex = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
589
589
|
yield* Effect.scoped(types);
|
|
590
590
|
yield* Effect.scoped(bases);
|
|
591
591
|
allotment.shrink(filesBytes + entries + map4);
|
|
592
|
-
const
|
|
593
|
-
sha.update(regionIds);
|
|
592
|
+
const regionDigest = sha1Now([regionIds]);
|
|
594
593
|
if (regionIds.byteLength > 0) yield* putOnce(bucket, files.region, regionIds);
|
|
595
594
|
const layer = {
|
|
596
595
|
build,
|
|
@@ -602,7 +601,7 @@ const remapIndex = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
602
601
|
],
|
|
603
602
|
rows: read.kept.length
|
|
604
603
|
}],
|
|
605
|
-
region: hexOf(
|
|
604
|
+
region: hexOf(regionDigest),
|
|
606
605
|
first: 0,
|
|
607
606
|
positions,
|
|
608
607
|
graphFirst: 0,
|
package/dist/storage/links.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gitError } from "../contracts/result.mjs";
|
|
2
2
|
import { readCommit } from "../protocol/objects/commit.mjs";
|
|
3
3
|
import { readTag } from "../protocol/objects/tag.mjs";
|
|
4
|
-
import { treeReader } from "../protocol/objects/tree.mjs";
|
|
4
|
+
import { TreeEntries, treeReader } from "../protocol/objects/tree.mjs";
|
|
5
5
|
import { receiveBoundaryMost, receiveCutParentsMost } from "./receive-bounds.mjs";
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
7
7
|
import * as Result from "effect/Result";
|
|
@@ -52,6 +52,38 @@ const linkReader = (object) => {
|
|
|
52
52
|
let at = 0;
|
|
53
53
|
return () => Result.succeed(links.success[at++]);
|
|
54
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* A checked tree's links, read in place: `linkReader`'s links of a tree `fsckObject` passed, one
|
|
57
|
+
* at a time, each ID left where the tree holds it, at `idAt`, so a caller that keeps IDs as bytes
|
|
58
|
+
* makes no text of them and nothing an entry. Its bytes are entries to their end, in Git's order,
|
|
59
|
+
* as fsck passed them, so it reads each with no check of its own; bytes that aren't one end it.
|
|
60
|
+
*/
|
|
61
|
+
var TreeLinks = class {
|
|
62
|
+
/** Where the link's 20-byte ID starts in the tree's bytes. */
|
|
63
|
+
idAt = 0;
|
|
64
|
+
/** The type the link says: a folder's is a tree, a file's or a symlink's a blob. */
|
|
65
|
+
type = "blob";
|
|
66
|
+
#entries;
|
|
67
|
+
#at = 0;
|
|
68
|
+
bytes;
|
|
69
|
+
constructor(bytes) {
|
|
70
|
+
this.bytes = bytes;
|
|
71
|
+
this.#entries = new TreeEntries(bytes);
|
|
72
|
+
}
|
|
73
|
+
/** Moves to the next link, past each submodule, or `false` past the last. */
|
|
74
|
+
next() {
|
|
75
|
+
const entries = this.#entries;
|
|
76
|
+
while (this.#at < this.bytes.length && entries.read(this.#at)) {
|
|
77
|
+
this.#at = entries.end();
|
|
78
|
+
if (entries.kind === "gitlink") continue;
|
|
79
|
+
this.idAt = entries.nul + 1;
|
|
80
|
+
this.type = entries.kind === "tree" ? "tree" : "blob";
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
this.#at = this.bytes.length;
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
55
87
|
/** The links of an object that isn't a tree, which are few: a commit's tree and parents, a tag's object. */
|
|
56
88
|
const fewLinks = (object) => {
|
|
57
89
|
switch (object.type) {
|
|
@@ -187,4 +219,4 @@ const shallowRoot = () => gitError("FAILED_PRECONDITION", "shallow update not al
|
|
|
187
219
|
context: { reason: "shallow-root" }
|
|
188
220
|
});
|
|
189
221
|
const isShallowRoot = (error) => error.code === "FAILED_PRECONDITION" && error.context?.reason === "shallow-root";
|
|
190
|
-
export { CutCarry, boundaryNotInPack, folder, gitlink, isShallowRoot, linkReader, linksOf, mistyped, objectMissing, segmentCut, segmentTooLarge, shallowLinks, shallowRoot, tagTargetMissing, wrongType };
|
|
222
|
+
export { CutCarry, TreeLinks, boundaryNotInPack, folder, gitlink, isShallowRoot, linkReader, linksOf, mistyped, objectMissing, segmentCut, segmentTooLarge, shallowLinks, shallowRoot, tagTargetMissing, wrongType };
|
|
@@ -75,6 +75,14 @@ const readBusy = /* @__PURE__ */ gitError("UNAVAILABLE", "The server is busy: tr
|
|
|
75
75
|
context: { reason: "busy" }
|
|
76
76
|
});
|
|
77
77
|
/**
|
|
78
|
+
* A put's charge's refusal, `Registration.putCharge`'s, when no room came within upkeep's wait: a
|
|
79
|
+
* job's put, whose try ends and comes again.
|
|
80
|
+
*/
|
|
81
|
+
const putBusy = /* @__PURE__ */ gitError("UNAVAILABLE", "The server's memory had no room for a put to the bucket", {
|
|
82
|
+
hint: "The job tries again",
|
|
83
|
+
context: { reason: "busy" }
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
78
86
|
* Maintenance's refusal when what one of its steps holds at once is past all it may hold, the
|
|
79
87
|
* budget less the read reserve, which no wait would make room for. Past only what's free while others hold the rest, the step waits
|
|
80
88
|
* as `readBusy` and comes back later (Q879's split, as Q888 asks of maintenance).
|
|
@@ -1046,9 +1054,10 @@ const pruneIndexObjectsMost = Math.floor((pruneIndexFloor - indexBytes({
|
|
|
1046
1054
|
* The most objects one push of `size`'s length takes in a `packs()` instance of `memory`: what its
|
|
1047
1055
|
* memory takes, `receiveObjectsMostOf`, and no more than `pruneIndexObjectsMost`, so a prune walk
|
|
1048
1056
|
* holds its pack's index, which no merge cuts while it's alone. Past it, a push is refused before
|
|
1049
|
-
* it waits, by the most. In a Worker's 128 MB, 1,048,528
|
|
1057
|
+
* it waits, by the most. In a Worker's 128 MB on R2 or Blob, 1,048,528 for a push told a length
|
|
1058
|
+
* its bucket sends whole, and 641,583 for a chunked one, whose put holds four 8 MiB parts.
|
|
1050
1059
|
*/
|
|
1051
|
-
const pushObjectsMostOf = (memory, size
|
|
1060
|
+
const pushObjectsMostOf = (memory, size) => Math.min(receiveObjectsMostOf(memory, size), pruneIndexObjectsMost);
|
|
1052
1061
|
/**
|
|
1053
1062
|
* What a prune walk's seen set holds (#2019): a bit for each object of each of `packs`, at its rank,
|
|
1054
1063
|
* and for each of `outside` objects no listed pack holds, its ID, at `fetchEntryBytes`. A part's
|
|
@@ -1339,4 +1348,4 @@ const budgetOfObjects = (objects) => {
|
|
|
1339
1348
|
const found = objects[objectBudget];
|
|
1340
1349
|
return found instanceof MemoryBudget ? found : void 0;
|
|
1341
1350
|
};
|
|
1342
|
-
export { AllottedPointers, MemoryAllotment, MemoryBudget, allotmentCacheCharge, allottedWithin, budgetOfObjects, cacheRoomCharge, fetchBusy, growWaitMs, headStuckMs, instanceRoomOf, joinRoomOf, outsideOn, pruneIndexFloor, pruneIndexObjectsMost, pruneSeenBytes, pushBusy, pushEntryTooLarge, pushIndexTooLarge, pushMemoryOf, pushObjectsMostOf, pushTooLarge, pushWaitMs, readBusy, readerMemoryOf, requestBudgetOf, requestRoomOf, rowCacheRoomOf, upkeepMemoryOf, upkeepRuns, upkeepTooLarge, withMemoryBudget };
|
|
1351
|
+
export { AllottedPointers, MemoryAllotment, MemoryBudget, allotmentCacheCharge, allottedWithin, budgetOfObjects, cacheRoomCharge, fetchBusy, growWaitMs, headStuckMs, instanceRoomOf, joinRoomOf, outsideOn, pruneIndexFloor, pruneIndexObjectsMost, pruneSeenBytes, pushBusy, pushEntryTooLarge, pushIndexTooLarge, pushMemoryOf, pushObjectsMostOf, pushTooLarge, pushWaitMs, putBusy, readBusy, readerMemoryOf, requestBudgetOf, requestRoomOf, rowCacheRoomOf, upkeepMemoryOf, upkeepRuns, upkeepTooLarge, withMemoryBudget };
|
|
@@ -9,6 +9,7 @@ import { linksOf } from "./links.mjs";
|
|
|
9
9
|
import { outsideOn, upkeepRuns, upkeepTooLarge } from "./memory-budget.mjs";
|
|
10
10
|
import { choose, chooseCalls, chooseHeld, chosenFirstCalls } from "./merge-choose.mjs";
|
|
11
11
|
import { passObjectsMost, unresolvable, writeCallsOf } from "./merge-cut.mjs";
|
|
12
|
+
import { putHeldBytes } from "./put-holds.mjs";
|
|
12
13
|
import { fencedStep, lossFence } from "./merge-fence.mjs";
|
|
13
14
|
import { mergeBlocksRoom, mergeInputsMost, writingHeld } from "./merge-most.mjs";
|
|
14
15
|
import { indexCalls, indexHeld, indexPack } from "./merge-index.mjs";
|
|
@@ -254,12 +255,12 @@ const goOn = /* @__PURE__ */ Effect.fnUntraced(function* (passes, from, resumed,
|
|
|
254
255
|
};
|
|
255
256
|
});
|
|
256
257
|
/**
|
|
257
|
-
* The
|
|
258
|
-
* puts any pack a merge writes in one call, else
|
|
258
|
+
* The parts a merge's pack put holds, each put told its pack's size (#1670): none on a bucket that
|
|
259
|
+
* puts any pack a merge writes in one call, else its `buffersMost` buffers, as Blob's puts in parts hold. A
|
|
259
260
|
* pack can pass `maxPackSize`, as an entry past it alone goes in a pack of its own, but never
|
|
260
261
|
* `maxPackSizeMost`, so that's the size it's compared with.
|
|
261
262
|
*/
|
|
262
|
-
const putPartHeld = (multipart) => multipart
|
|
263
|
+
const putPartHeld = (multipart) => putHeldBytes(multipart, { size: maxPackSizeMost });
|
|
263
264
|
/** The hold of a merge of `inputs`, charged to the step's allotment while its scope is open. */
|
|
264
265
|
const charged = (input, inputs) => {
|
|
265
266
|
const held = streamHeld(inputs) + putPartHeld(input.bucket.multipart);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sha1NowHasher } from "../protocol/bytes/sha1-hasher.mjs";
|
|
2
2
|
import { randomText } from "../store/random.mjs";
|
|
3
3
|
import { packFiles } from "./layout.mjs";
|
|
4
4
|
import { upkeepRuns } from "./memory-budget.mjs";
|
|
@@ -37,7 +37,7 @@ const writePack = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
37
37
|
tag: 0
|
|
38
38
|
};
|
|
39
39
|
const upload = yield* startPut(bucket, packFiles(input.pack).pack, { size: planned.bytes });
|
|
40
|
-
const sha =
|
|
40
|
+
const sha = sha1NowHasher();
|
|
41
41
|
const pack = openPack(input.readers, planned.objects);
|
|
42
42
|
let offset = 0;
|
|
43
43
|
let chunk = new Uint8Array(writeChunkBytes);
|
|
@@ -13,6 +13,7 @@ import { catchSpent, ownSpentOf } from "../contracts/calls-spent.mjs";
|
|
|
13
13
|
import { bestEffort } from "../store/errors.mjs";
|
|
14
14
|
import { CallBudget, requestCount, spentBudget } from "../store/call-count.mjs";
|
|
15
15
|
import { newChangeId } from "../store/scopes.mjs";
|
|
16
|
+
import { putHeldBytes } from "./put-holds.mjs";
|
|
16
17
|
import { bucketPut, bucketReading, bucketStreamScoped, bucketTry } from "./calls.mjs";
|
|
17
18
|
import { packPutOptions, startPut } from "./merge.mjs";
|
|
18
19
|
import { repoTypes } from "./held-types.mjs";
|
|
@@ -21,7 +22,7 @@ import { packFiles } from "./layout.mjs";
|
|
|
21
22
|
import { fileBytesMost, fileRefuseBytes } from "./file-limits.mjs";
|
|
22
23
|
import { LargestFiles } from "./largest-files.mjs";
|
|
23
24
|
import { ReceivedPointers, pointersRecords } from "./lfs-pointers.mjs";
|
|
24
|
-
import { boundaryNotInPack, linkReader, segmentCut, segmentTooLarge, tagTargetMissing, wrongType } from "./links.mjs";
|
|
25
|
+
import { TreeLinks, boundaryNotInPack, linkReader, segmentCut, segmentTooLarge, tagTargetMissing, wrongType } from "./links.mjs";
|
|
25
26
|
import { noRows } from "./object-rows.mjs";
|
|
26
27
|
import { receiveWriters } from "./receive-admission.mjs";
|
|
27
28
|
import { receiveLinkLimits, receiveLinks } from "./receive-links.mjs";
|
|
@@ -530,6 +531,16 @@ const storePack = /* @__PURE__ */ Effect.fnUntraced(function* (input, opened, st
|
|
|
530
531
|
}
|
|
531
532
|
};
|
|
532
533
|
/**
|
|
534
|
+
* A checked tree's links, from where `tree` is, each put by its ID's bytes: a partial pack's
|
|
535
|
+
* trees name objects it may leave out, so it puts none.
|
|
536
|
+
*/
|
|
537
|
+
const linkTree = (tree) => {
|
|
538
|
+
while (tree.next()) {
|
|
539
|
+
const put = links.linkAt(tree.bytes, tree.idAt, tree.type);
|
|
540
|
+
if (put !== void 0) return Effect.flatMap(put, () => stepEffect(linkTree(tree)));
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
/**
|
|
533
544
|
* An object's fsck, its links, and a commit's parents for the `.graph`, from its `bytes`: every
|
|
534
545
|
* object but a blob's. A tree's `.gitmodules` and `.gitattributes` go in `checked`.
|
|
535
546
|
*/
|
|
@@ -542,6 +553,7 @@ const storePack = /* @__PURE__ */ Effect.fnUntraced(function* (input, opened, st
|
|
|
542
553
|
if (fault !== void 0) return Effect.fail(fsckRefusal(oid, fault));
|
|
543
554
|
const overflow = checkedOverflow(checked);
|
|
544
555
|
if (overflow !== void 0) return Effect.fail(overflow);
|
|
556
|
+
if (type === "tree") return partial ? void 0 : linkTree(new TreeLinks(bytes));
|
|
545
557
|
const shallowCommit = type === "commit" && shallow.has(oid);
|
|
546
558
|
const boundaryCommit = type === "commit" && boundary.has(oid);
|
|
547
559
|
const graphed = [];
|
|
@@ -1017,16 +1029,20 @@ const storePack = /* @__PURE__ */ Effect.fnUntraced(function* (input, opened, st
|
|
|
1017
1029
|
const put = bucketPut(bucket, key, bytes);
|
|
1018
1030
|
return step === void 0 ? put : putAgain(bucket, key, bytes, put);
|
|
1019
1031
|
};
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
]
|
|
1032
|
+
const putting = [
|
|
1033
|
+
[files.idx, written.index],
|
|
1034
|
+
[files.rev, written.reverse],
|
|
1035
|
+
[files.pos, written.positions],
|
|
1036
|
+
[files.graph, graph],
|
|
1037
|
+
[files.types, written.types]
|
|
1038
|
+
];
|
|
1039
|
+
const putsHeld = putting.reduce((sum, [, bytes]) => sum + putHeldBytes(bucket.multipart, { size: bytes.byteLength }), 0);
|
|
1040
|
+
yield* room.take(putsHeld) ?? Effect.void;
|
|
1041
|
+
yield* Effect.all(putting.map(([key, bytes]) => putFile(key, bytes)), {
|
|
1027
1042
|
concurrency: 5,
|
|
1028
1043
|
discard: true
|
|
1029
1044
|
});
|
|
1045
|
+
room.give(putsHeld);
|
|
1030
1046
|
if (step === void 0 && (received.spilled() || ended.spilled || links.spilled())) yield* dropRuns(bucket, opened.pack);
|
|
1031
1047
|
yield* stillOpen({
|
|
1032
1048
|
store,
|
package/dist/storage/packs.d.mts
CHANGED
|
@@ -43,7 +43,9 @@ export interface PacksOptions {
|
|
|
43
43
|
* it can't give back fits, or waits, and caches grow into what's free and shrink when another
|
|
44
44
|
* needs it. The `.idx` and `.rev` kept across repos shrink first. A host with more, such as
|
|
45
45
|
* Node, raises it. One under `packsMemoryLeast` is a `RangeError`: upkeep couldn't hold a merge,
|
|
46
|
-
* so pushes would wait on `git.repack` for good. Raise it to at least that
|
|
46
|
+
* so pushes would wait on `git.repack` for good. Raise it to at least that, and at `open()`, to
|
|
47
|
+
* that and the parts its bucket's put of a merge's pack holds: Blob's 32 MiB, R2's none. A
|
|
48
|
+
* server refuses objects whose upkeep can't hold one put to its bucket, `putMemoryLeast`.
|
|
47
49
|
* A number gives each `open()` a budget of its own, so two servers in one isolate each count
|
|
48
50
|
* only theirs. A `PacksMemory` from `packsMemory()` is one budget every `open()` given it shares.
|
|
49
51
|
*/
|
package/dist/storage/packs.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import { graphMostOf, indexRowOf, indexSaves, indexStatus, indexTry } from "./in
|
|
|
21
21
|
import { indexEligible, indexPath } from "./index-fetch.mjs";
|
|
22
22
|
import { listedIds } from "./listed-ids.mjs";
|
|
23
23
|
import { defaultRemapCpuMost, indexHolds } from "./index-remap.mjs";
|
|
24
|
+
import { putHeldBytes } from "./put-holds.mjs";
|
|
24
25
|
import { indexRowKey, isPackId, packFiles, prunePassKey } from "./layout.mjs";
|
|
25
26
|
import { ReachCache, indexReach, reachCacheBytes, reachedRoots } from "./index-reach.mjs";
|
|
26
27
|
import { indexedVisible, setReachOf } from "./index-visible.mjs";
|
|
@@ -36,7 +37,7 @@ import { receivePack, tooMany } from "./pack-receive.mjs";
|
|
|
36
37
|
import { mergesAlone, passAlone, passDue, passScratch, pruneStartedKey, pruneStep, readPrune } from "./prune.mjs";
|
|
37
38
|
import { rebuildStep } from "./graph-rebuild.mjs";
|
|
38
39
|
import { liftedFences, unfenced } from "./merge-fence.mjs";
|
|
39
|
-
import { freshCalls, geometricStep, groupedPacks, membersOf, opensWithin, resumeMerge, streamHeld } from "./merge-stream.mjs";
|
|
40
|
+
import { freshCalls, geometricStep, groupedPacks, membersOf, opensWithin, putPartHeld, resumeMerge, streamHeld } from "./merge-stream.mjs";
|
|
40
41
|
import { droppedStep, mergeKey } from "./merge-row.mjs";
|
|
41
42
|
import { parksPass, repackJobRow } from "./repack-job.mjs";
|
|
42
43
|
import { dropRefused, sharePacks } from "./quarantine.mjs";
|
|
@@ -48,7 +49,7 @@ import { defaultPrune, deletedLeaveAt, pruneWait, quarantineKey } from "./rows.m
|
|
|
48
49
|
import { openStageReceive, readAnswer, receiveStep, stageReceive, stageReceiveStep, stageStepKey } from "./receive-steps.mjs";
|
|
49
50
|
import { memoryOf, openBudget } from "./packs-memory.mjs";
|
|
50
51
|
import { receiveRoomAdmitted } from "./receive-admission.mjs";
|
|
51
|
-
import { fetchFloorBytes, fetchRowCacheBytes, pushAdmissionOf, pushFloorsOf, pushPartBytes, pushRulesOf, readReserveBytes, readerFloorBytes, readerMost, unpackInflatedMost } from "./budget.mjs";
|
|
52
|
+
import { fetchFloorBytes, fetchRowCacheBytes, pushAdmissionOf, pushFloorsOf, pushPartBytes, pushRulesOf, readReserveBytes, readerFloorBytes, readerMost, stagedPuts, unpackInflatedMost } from "./budget.mjs";
|
|
52
53
|
import { chargedCache } from "./charged-cache.mjs";
|
|
53
54
|
import { serverRequestBudget } from "./request-cache.mjs";
|
|
54
55
|
import { AllottedPointers, allotmentCacheCharge, allottedWithin, cacheRoomCharge, fetchBusy, growWaitMs, instanceRoomOf, pushMemoryOf, pushObjectsMostOf, pushTooLarge, readBusy, readerMemoryOf, requestBudgetOf, rowCacheRoomOf, upkeepMemoryOf, upkeepTooLarge, withMemoryBudget } from "./memory-budget.mjs";
|
|
@@ -506,7 +507,11 @@ const packs = (options = {}) => packsWith(options);
|
|
|
506
507
|
*/
|
|
507
508
|
const packsWith = (options = {}, inner = {}) => {
|
|
508
509
|
const memoryTotal = memoryOf(options.memory);
|
|
509
|
-
|
|
510
|
+
/** Refuses a memory under `least` where upkeep merges: it would hold no merge. */
|
|
511
|
+
const mergesIn = (least) => {
|
|
512
|
+
if (options.repack !== false && memoryTotal < least) throw new RangeError(`packs()' memory of ${memoryTotal} bytes leaves upkeep no room for a merge: raise it to at least ${least}`);
|
|
513
|
+
};
|
|
514
|
+
mergesIn(packsMemoryLeast);
|
|
510
515
|
const optionsFor = (stats) => {
|
|
511
516
|
const prune = optionFor(options.prune, defaultPrune, stats);
|
|
512
517
|
return {
|
|
@@ -522,6 +527,7 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
522
527
|
needsBucket: true,
|
|
523
528
|
indexed: true,
|
|
524
529
|
open: ({ store: calls, bucket: hosts, clock, fetchLimits, callLimits }) => {
|
|
530
|
+
mergesIn(packsMemoryLeast + putPartHeld(hosts.multipart));
|
|
525
531
|
const bucket = countedBucket(hostFailures(hosts));
|
|
526
532
|
const callsMost = fetchCallsMost(callLimits, options.callLimits);
|
|
527
533
|
const stepMost = callLimits === void 0 ? callsMost : fetchCallsMost(jobCallLimitsOf(callLimits), options.callLimits);
|
|
@@ -630,6 +636,11 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
630
636
|
objects: (listed) => objectsAt(listed, { read: true }),
|
|
631
637
|
indexes
|
|
632
638
|
};
|
|
639
|
+
/** A push's or a step's size as its put to this bucket holds it: with the bucket's `multipart`. */
|
|
640
|
+
const sizedFor = (input) => ({
|
|
641
|
+
...input,
|
|
642
|
+
multipart: bucket.multipart
|
|
643
|
+
});
|
|
633
644
|
const asPack = (listed, input, prune, memory, visible) => {
|
|
634
645
|
const packed = {
|
|
635
646
|
store: calls,
|
|
@@ -640,7 +651,7 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
640
651
|
prune,
|
|
641
652
|
receive: input,
|
|
642
653
|
memory,
|
|
643
|
-
objectsMost: pushObjectsMostOf(memoryTotal, input)
|
|
654
|
+
objectsMost: pushObjectsMostOf(memoryTotal, sizedFor(input))
|
|
644
655
|
};
|
|
645
656
|
if (visible !== void 0) packed.visible = visible;
|
|
646
657
|
return receivePack(packed);
|
|
@@ -653,7 +664,8 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
653
664
|
* it returns, which lets it go if the answer never reaches the core; the rest goes back as
|
|
654
665
|
* the scope ends. A push with no pack keeps no allotment.
|
|
655
666
|
*/
|
|
656
|
-
const receive = Effect.fnUntraced(function* (listed,
|
|
667
|
+
const receive = Effect.fnUntraced(function* (listed, pushed, answered, made, visible) {
|
|
668
|
+
const input = sizedFor(pushed);
|
|
657
669
|
const most = pushObjectsMostOf(memoryTotal, input);
|
|
658
670
|
if (input.objects > most) return yield* Effect.fail(tooMany(input.objects, most));
|
|
659
671
|
const past = segmentTooLarge(input);
|
|
@@ -728,7 +740,12 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
728
740
|
if (past !== void 0) return yield* Effect.fail(past);
|
|
729
741
|
const { quarantine: prune } = optionsFor(chosen ? yield* statsOf(calls, listed.repo) : void 0);
|
|
730
742
|
const { boundary = [], needs = [], cutMost, length, atMost, shallow = [] } = input;
|
|
731
|
-
|
|
743
|
+
const held = putHeldBytes(bucket.multipart, {
|
|
744
|
+
size: length,
|
|
745
|
+
atMost
|
|
746
|
+
});
|
|
747
|
+
const admitted = held === 0 ? Effect.void : budget.admit(held);
|
|
748
|
+
const staging = stageReceive({
|
|
732
749
|
store: calls,
|
|
733
750
|
bucket,
|
|
734
751
|
indexes,
|
|
@@ -745,6 +762,7 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
745
762
|
...shallow.length > 0 && { shallow }
|
|
746
763
|
}
|
|
747
764
|
});
|
|
765
|
+
return yield* Effect.scoped(Effect.andThen(admitted, staging));
|
|
748
766
|
});
|
|
749
767
|
/** Stepped multipart staging for push uploads (#1931), internal to `packs()`. */
|
|
750
768
|
const stageStep = {
|
|
@@ -794,14 +812,18 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
794
812
|
* `receive`'s is. A try whose commit another try's beat is `UNAVAILABLE`, to be tried again.
|
|
795
813
|
*/
|
|
796
814
|
const step = Effect.fnUntraced(function* (listed, input, answered, made, visible) {
|
|
797
|
-
const
|
|
815
|
+
const sized = {
|
|
816
|
+
...input,
|
|
817
|
+
multipart: stagedPuts
|
|
818
|
+
};
|
|
819
|
+
const most = pushObjectsMostOf(memoryTotal, sized);
|
|
798
820
|
if (input.objects > most) return yield* Effect.fail(tooMany(input.objects, most));
|
|
799
821
|
const { pack } = input;
|
|
800
822
|
if (!isPackId(pack)) return yield* fail("INVALID_ARGUMENT", `No pack is staged as ${pack}`);
|
|
801
823
|
if (input.objects > 0) yield* refuseBacklog(listed);
|
|
802
824
|
const answer = yield* readAnswer(bucket, pack);
|
|
803
825
|
const size = {
|
|
804
|
-
...
|
|
826
|
+
...sized,
|
|
805
827
|
length: answer.bytes
|
|
806
828
|
};
|
|
807
829
|
const allotment = yield* budget.admit(pushAdmissionOf(size));
|
|
@@ -830,7 +852,7 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
830
852
|
...needs !== void 0 && { needs }
|
|
831
853
|
},
|
|
832
854
|
memory,
|
|
833
|
-
objectsMost: pushObjectsMostOf(memoryTotal,
|
|
855
|
+
objectsMost: pushObjectsMostOf(memoryTotal, sized)
|
|
834
856
|
};
|
|
835
857
|
if (visible !== void 0) receiving.visible = visible;
|
|
836
858
|
const opened = {
|
|
@@ -883,7 +905,7 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
883
905
|
bases: void 0
|
|
884
906
|
};
|
|
885
907
|
}
|
|
886
|
-
const read = yield* readPast(input.pack, unpack.maxBytes, memory.allotment, pushPartBytes(input));
|
|
908
|
+
const read = yield* readPast(input.pack, unpack.maxBytes, memory.allotment, pushPartBytes(sizedFor(input)));
|
|
887
909
|
if (!read.ended) {
|
|
888
910
|
yield* dropPushPreload;
|
|
889
911
|
const whole = {
|
|
@@ -1397,7 +1419,7 @@ const packsWith = (options = {}, inner = {}) => {
|
|
|
1397
1419
|
reach: face.index.reach
|
|
1398
1420
|
},
|
|
1399
1421
|
readyShallow: shallow !== false,
|
|
1400
|
-
pushObjectsMost: pushObjectsMostOf(memoryTotal),
|
|
1422
|
+
pushObjectsMost: pushObjectsMostOf(memoryTotal, { multipart: bucket.multipart }),
|
|
1401
1423
|
...visible === void 0 && { [stageStepKey]: stageStep }
|
|
1402
1424
|
};
|
|
1403
1425
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Multipart } from "@ref0/infra";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/storage/put-holds.ts
|
|
2
|
+
/** The part a bucket's upload holds, R2's for a push of unknown size: 8 MiB. */
|
|
3
|
+
const uploadPartBytes = 8388608;
|
|
4
|
+
/**
|
|
5
|
+
* What a put to a bucket of `multipart` holds in memory, its body told its `size`, or at most
|
|
6
|
+
* `atMost` bytes, or neither: none for a body told a size the bucket sends whole, within its
|
|
7
|
+
* `wholeMost`; else `buffersMost` buffers, each of `partSize` or of the body when it fits in one, all
|
|
8
|
+
* a put holds whatever its body's length. A body within a part is one part, cut in a buffer of
|
|
9
|
+
* its size, and the copies a store's sends hold of it, which `buffersMost` bounds. A bucket that
|
|
10
|
+
* cuts no parts, the memory store's, is charged as one of R2's, `uploadPartBytes`. Every put Git
|
|
11
|
+
* charges is charged this. It's apart from `budget.ts`, which reads it beside its other bounds, so
|
|
12
|
+
* `runs.ts`, below `budget.ts`, charges its run puts with it too.
|
|
13
|
+
*/
|
|
14
|
+
const putHeldBytes = (multipart, body = {}) => {
|
|
15
|
+
if (body.size !== void 0 && body.size <= multipart.wholeMost) return 0;
|
|
16
|
+
const part = Number.isFinite(multipart.partSize) ? multipart.partSize : uploadPartBytes;
|
|
17
|
+
const most = body.atMost ?? body.size;
|
|
18
|
+
return Math.min(most ?? part, part) * multipart.buffersMost;
|
|
19
|
+
};
|
|
20
|
+
export { putHeldBytes, uploadPartBytes };
|
package/dist/storage/ready.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { repoRootsKey, repoScope } from "../store/scopes.mjs";
|
|
|
7
7
|
import { bucketBody, bucketTry } from "./calls.mjs";
|
|
8
8
|
import { startPut } from "./merge.mjs";
|
|
9
9
|
import { readBusy, upkeepTooLarge } from "./memory-budget.mjs";
|
|
10
|
+
import { putHeldBytes } from "./put-holds.mjs";
|
|
10
11
|
import { callsAhead, packOfPlan, planFetchWithin, planTooSlow, timeLeft, unreadPackMs } from "./fetch.mjs";
|
|
11
12
|
import { isPackId, objectCollections, packFiles } from "./layout.mjs";
|
|
12
13
|
import { noRows } from "./object-rows.mjs";
|
|
@@ -373,7 +374,7 @@ const putWhole = (bucket, key, body) => Effect.scoped(Effect.gen(function* () {
|
|
|
373
374
|
/**
|
|
374
375
|
* A plan's pack written to the bucket under a new `quarantine` row and marker, as a push's is, in
|
|
375
376
|
* what's left of the build's time from `started`: a step cut before its commit, or past that time,
|
|
376
|
-
* leaves the pack for clean-up.
|
|
377
|
+
* leaves the pack for clean-up. Its put's parts are charged to the step's allotment while it runs.
|
|
377
378
|
*/
|
|
378
379
|
const keepPack = /* @__PURE__ */ Effect.fnUntraced(function* (input, shallow, plan, started) {
|
|
379
380
|
const { store, bucket, listed, at, prune } = input;
|
|
@@ -387,7 +388,8 @@ const keepPack = /* @__PURE__ */ Effect.fnUntraced(function* (input, shallow, pl
|
|
|
387
388
|
const limits = readyLimits(shallow);
|
|
388
389
|
const left = yield* timeLeft(limits, started);
|
|
389
390
|
const answer = yield* handingOn(packOfPlan(input.reads, plan, limits, { left }));
|
|
390
|
-
|
|
391
|
+
const held = putHeldBytes(bucket.multipart, { atMost: readyBytesMost });
|
|
392
|
+
yield* Effect.acquireUseRelease(input.charge(held), () => putWhole(bucket, packFiles(opened.pack).pack, answer.pack), () => input.release(held));
|
|
391
393
|
const { columns } = plan;
|
|
392
394
|
let followed = 0;
|
|
393
395
|
for (let ordinal = 0; ordinal < columns.count; ordinal += 1) if (columns.kindAt(ordinal) === "tag") followed += 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "@ref0/infra";
|
|
1
|
+
import { Multipart } from "@ref0/infra";
|
|
@@ -92,7 +92,7 @@ const receiveBoundaryMost = repoRootsMost;
|
|
|
92
92
|
const receiveCutParentsMost = 2 * receiveBoundaryMost;
|
|
93
93
|
/**
|
|
94
94
|
* The runs a receive's listing deletes a page at a time, in one `deleteMany`: a store's batch of
|
|
95
|
-
* 1,000 keys, R2's
|
|
95
|
+
* 1,000 keys, R2's and Vercel's, so a page is one batch.
|
|
96
96
|
*/
|
|
97
97
|
const receiveDropPage = 1e3;
|
|
98
98
|
/**
|
|
@@ -113,11 +113,11 @@ const importTryTimeout = "13 minutes";
|
|
|
113
113
|
* - On Cloudflare, an alarm's `alarmWallTime`, 15 minutes from before the claim. R2's calls
|
|
114
114
|
* through its binding take no signal, so one started before the try's timeout runs on, but
|
|
115
115
|
* the alarm's end stops it.
|
|
116
|
-
* - On Node,
|
|
117
|
-
* call, and a call under way ends at once.
|
|
116
|
+
* - On Node, as on Vercel, `importTryTimeout`: at it the signal aborts, `bucketCall` starts no
|
|
117
|
+
* call, and a call under way ends at once. Vercel Blob's take it, so a request
|
|
118
118
|
* already sent can only commit within its own trip. The disk bucket's calls take no signal: the
|
|
119
119
|
* bound assumes its local writes, an fsync then a link, end within the grace. A queue on
|
|
120
|
-
* `
|
|
120
|
+
* `Runner.workerThreads()` caps any call: a second past the abort, it ends the handler's thread.
|
|
121
121
|
* Then `jobLeaseMargin`, the queue's own room past a try's end, covers that last call's commit.
|
|
122
122
|
* So 15.5 minutes, on every bucket and host Git ships, given that local I/O. A call that outlasts
|
|
123
123
|
* it on a queue run in-process, the disk bucket's on a disk that stalls, or a host's own bucket's
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gitError } from "../contracts/result.mjs";
|
|
2
|
-
import { writeOidBytes } from "../protocol/packs/idx.mjs";
|
|
3
|
-
import "../protocol/objects/object.mjs";
|
|
2
|
+
import { oidBytes, writeOidBytes } from "../protocol/packs/idx.mjs";
|
|
3
|
+
import { emptyTree } from "../protocol/objects/object.mjs";
|
|
4
4
|
import { stepEffect } from "../protocol/packs/step.mjs";
|
|
5
5
|
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
6
6
|
import { compareIds } from "./raw-ids.mjs";
|
|
@@ -22,6 +22,7 @@ const types = [
|
|
|
22
22
|
"commit",
|
|
23
23
|
"tag"
|
|
24
24
|
];
|
|
25
|
+
const emptyTreeId = oidBytes(emptyTree);
|
|
25
26
|
/**
|
|
26
27
|
* The refusal of a push whose links need more of the server than `receiveLinkSpillBytes`: the
|
|
27
28
|
* bytes they need, and those left.
|
|
@@ -188,22 +189,36 @@ const receiveLinks = (bucket, pack, reads, limits = receiveLinkLimits, writing =
|
|
|
188
189
|
judged(linked.oid, linked.first, actual, true);
|
|
189
190
|
if (linked.other !== void 0) judged(linked.oid, linked.other, actual, false);
|
|
190
191
|
};
|
|
191
|
-
/**
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
const seen = {
|
|
192
|
+
/** A link to the empty tree, which every repo holds: judged as it's read, and put in no run. */
|
|
193
|
+
const emptyLink = (type) => {
|
|
194
|
+
judged(emptyTree, {
|
|
195
195
|
seq: seq++,
|
|
196
|
-
type
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
type
|
|
197
|
+
}, "tree", !emptyLinked);
|
|
198
|
+
emptyLinked = true;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* A link whose ID is written, unless it's the empty tree's: past `receiveLinksMost` refused, then
|
|
202
|
+
* its row's type and place, and the put a full buffer makes.
|
|
203
|
+
*/
|
|
204
|
+
const put = (type, empty) => {
|
|
205
|
+
if (seq === 8e7) return Effect.fail(linksTooMany());
|
|
206
|
+
if (empty) return emptyLink(type);
|
|
207
|
+
view.setUint32(20, (types.indexOf(type) << 30 | seq++) >>> 0);
|
|
205
208
|
return writer.add(row);
|
|
206
209
|
};
|
|
210
|
+
/** One link, as it's read: a row of its runs, or the put a full buffer makes. */
|
|
211
|
+
const link = (named) => {
|
|
212
|
+
const empty = named.oid === emptyTree;
|
|
213
|
+
if (!empty) writeOidBytes(named.oid, row, 0);
|
|
214
|
+
return put(named.type, empty);
|
|
215
|
+
};
|
|
216
|
+
/** `link` of the 20-byte ID `bytes` hold at `at`, as a tree's are read, with no text of it. */
|
|
217
|
+
const linkAt = (bytes, at, type) => {
|
|
218
|
+
const empty = compareIds(bytes, at, emptyTreeId, 0) === 0;
|
|
219
|
+
if (!empty) for (let index = 0; index < 20; index += 1) row[index] = bytes[at + index] ?? 0;
|
|
220
|
+
return put(type, empty);
|
|
221
|
+
};
|
|
207
222
|
/**
|
|
208
223
|
* Once the pack is read: refused as `receiveLinks` says. `own` is the type of the pack's object
|
|
209
224
|
* `oid`, checked when it isn't `said`, or `undefined` when the pack brought none; `parents` are a
|
|
@@ -319,6 +334,7 @@ const receiveLinks = (bucket, pack, reads, limits = receiveLinkLimits, writing =
|
|
|
319
334
|
const putRuns = () => spilled;
|
|
320
335
|
return {
|
|
321
336
|
link,
|
|
337
|
+
linkAt,
|
|
322
338
|
finish,
|
|
323
339
|
carry: Effect.map(writer.finish, (runs) => ({
|
|
324
340
|
runs,
|
|
@@ -559,6 +559,26 @@ const stepInflatedMostOf = (share) => share * inflatedSharesMost;
|
|
|
559
559
|
*/
|
|
560
560
|
const streamStepsMost = (bytes, share) => share === void 0 ? 8 : Math.max(1, Math.ceil(bytes / share));
|
|
561
561
|
/**
|
|
562
|
+
* A receive's quarantine as its last step hands it on: the commit that lands its pack, a push
|
|
563
|
+
* upload's push or an import's, deletes its record too and puts its `staged` row, landed, so
|
|
564
|
+
* clean-up deletes the keys under its prefix once no step of an earlier try can put more. That
|
|
565
|
+
* commit comes within the try's own bound, under `receiveStepGrace` past the step's start at `at`,
|
|
566
|
+
* and a step that read the quarantine open before it puts its last key within `receiveStepGrace`
|
|
567
|
+
* of its own start, so the row is due `receiveStepGrace` twice past `at`. A pack that never lands
|
|
568
|
+
* leaves both to clean-up's end of its quarantine.
|
|
569
|
+
*/
|
|
570
|
+
const landing = (received, pack, at) => {
|
|
571
|
+
const { change } = received;
|
|
572
|
+
return {
|
|
573
|
+
...received,
|
|
574
|
+
change: {
|
|
575
|
+
...change,
|
|
576
|
+
put: [...change.put ?? [], stagedRow(pack, at + receiveStepGrace, true)],
|
|
577
|
+
delete: [...change.delete ?? [], receiveKey(pack)]
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
562
582
|
* A step whose quarantine isn't open, its stage over (#1502): what it and clean-up left deleted now,
|
|
563
583
|
* not only at its `staged` row's sweep, every key under its prefix but its markers, and its pack's
|
|
564
584
|
* files once no marker holds it. A pack gone with a marker left landed, by another try, so its
|
|
@@ -649,7 +669,7 @@ const receiveStep = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
649
669
|
...carried && { carried },
|
|
650
670
|
...input.largest === true && { largest: { entryMost: stepEntryMostOf(share) } }
|
|
651
671
|
});
|
|
652
|
-
if (!("paused" in stored)) return { received: stored };
|
|
672
|
+
if (!("paused" in stored)) return { received: landing(stored, opened.pack, at) };
|
|
653
673
|
const { state, table } = stored.paused;
|
|
654
674
|
yield* putStepState(bucket, keys, state, table, stored.paused.pointers, stored.paused.checked);
|
|
655
675
|
const inflated = (read.row?.inflated ?? 0) + (pausedInflated ? 1 : 0);
|
package/dist/storage/runs.d.mts
CHANGED