@ref0/git 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/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/client.d.mts +16 -9
- package/dist/contracts/events.d.mts +12 -10
- package/dist/contracts/events.mjs +8 -6
- 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/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 +20 -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 +3 -3
- package/dist/contracts/queue.mjs +5 -18
- 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/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/loose-tally.mjs +46 -0
- package/dist/core/objects/writing.mjs +1 -0
- package/dist/core/promise.mjs +1 -15
- package/dist/core/purge.mjs +14 -9
- package/dist/core/push.mjs +13 -6
- package/dist/core/ref-view.mjs +14 -6
- package/dist/core/repack.mjs +19 -14
- 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/effect.d.mts +2 -4
- package/dist/effect.mjs +2 -4
- package/dist/engine/commits.mjs +19 -47
- package/dist/engine/failures.d.mts +1 -2
- package/dist/engine/failures.mjs +1 -3
- package/dist/engine/merge-base-walk.mjs +57 -142
- package/dist/engine/merge-bases.mjs +5 -5
- package/dist/engine/merge.mjs +16 -14
- package/dist/extend.d.mts +1 -2
- package/dist/extend.mjs +1 -2
- package/dist/http/core-parts.mjs +1 -2
- package/dist/http/handler.mjs +11 -31
- package/dist/http/parts.d.mts +0 -1
- package/dist/index.d.mts +28 -21
- 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 +90 -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 +44 -26
- package/dist/lfs/upload-most.mjs +41 -0
- package/dist/lfs/uploaded.mjs +59 -0
- package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
- package/dist/protocol/bytes/text.mjs +6 -1
- package/dist/protocol/objects/fsck.mjs +6 -3
- package/dist/queue/advance.mjs +38 -8
- package/dist/queue/calls.mjs +4 -14
- package/dist/queue/lanes.mjs +1 -1
- package/dist/queue/rows.mjs +8 -0
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +3 -4
- 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 +240 -240
- package/dist/rest/files.d.mts +18 -18
- package/dist/rest/forks.d.mts +45 -57
- 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 +139 -139
- package/dist/rest/repos.d.mts +54 -66
- package/dist/rest/tokens.d.mts +12 -12
- package/dist/rest/topics.d.mts +110 -110
- package/dist/rest/trees.d.mts +66 -66
- package/dist/rest/wire.d.mts +1 -1
- 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 +1 -1
- package/dist/server/server.d.mts +0 -1
- package/dist/server/server.mjs +26 -45
- 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-build.mjs +100 -12
- package/dist/storage/lfs-pointers.d.mts +5 -5
- package/dist/storage/lfs-pointers.mjs +37 -11
- package/dist/storage/loose.mjs +4 -1
- package/dist/storage/memory-budget.mjs +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-receive.mjs +10 -6
- package/dist/storage/packs.mjs +58 -27
- package/dist/storage/prune.mjs +68 -40
- package/dist/storage/ready.d.mts +1 -1
- package/dist/storage/ready.mjs +12 -3
- 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/store/call-count.d.mts +23 -3
- package/dist/store/call-count.mjs +36 -13
- package/dist/store/records.mjs +10 -4
- package/dist/store/repo-record.mjs +29 -12
- package/dist/store/scopes.mjs +6 -1
- package/dist/sync/import.mjs +14 -2
- package/dist/sync/layer.d.mts +5 -1
- package/dist/sync/layer.mjs +7 -2
- package/dist/sync/step.mjs +15 -15
- package/dist/topics/advance.mjs +7 -6
- 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
|
@@ -20,6 +20,7 @@ import { checkedFilesRefused, checkedOverflow, checkedRecords, fsckRefusal, rece
|
|
|
20
20
|
import { packFiles } from "./layout.mjs";
|
|
21
21
|
import { ReceivedPointers, pointersRecords } from "./lfs-pointers.mjs";
|
|
22
22
|
import { boundaryNotInPack, linkReader, segmentCut, segmentTooLarge, tagTargetMissing, wrongType } from "./links.mjs";
|
|
23
|
+
import { noRows } from "./object-rows.mjs";
|
|
23
24
|
import { receiveWriters } from "./receive-admission.mjs";
|
|
24
25
|
import { receiveLinkLimits, receiveLinks } from "./receive-links.mjs";
|
|
25
26
|
import { foundWrongly, receivedFiles } from "./receive-files.mjs";
|
|
@@ -985,12 +986,15 @@ const storePack = /* @__PURE__ */ Effect.fnUntraced(function* (input, opened, st
|
|
|
985
986
|
const quarantine = {
|
|
986
987
|
id: newChangeId(),
|
|
987
988
|
quarantine: opened.quarantine,
|
|
988
|
-
change: {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
989
|
+
change: {
|
|
990
|
+
add: [{
|
|
991
|
+
id: opened.pack,
|
|
992
|
+
objects: received.counts.objects,
|
|
993
|
+
bytes: read.bytes,
|
|
994
|
+
graphBytes: graph.byteLength
|
|
995
|
+
}],
|
|
996
|
+
rows: noRows
|
|
997
|
+
},
|
|
994
998
|
bytes: read.bytes,
|
|
995
999
|
objects: received.counts.objects,
|
|
996
1000
|
lfsPointers: pointers.finish()
|
package/dist/storage/packs.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { fail, gitError } from "../contracts/result.mjs";
|
|
2
2
|
import { PackTransportError } from "../protocol/packs/reader.mjs";
|
|
3
3
|
import { decodeRecord } from "../store/catalogue.mjs";
|
|
4
|
+
import { decodePacks } from "../store/git-store.mjs";
|
|
4
5
|
import { tryUnlessSpent } from "../contracts/calls-spent.mjs";
|
|
5
6
|
import { resultCall } from "../store/errors.mjs";
|
|
6
|
-
import {
|
|
7
|
+
import { decodeStats, repoStats } from "../store/repo-record.mjs";
|
|
7
8
|
import { collections, newChangeId, repoScope, selfKey } from "../store/scopes.mjs";
|
|
8
9
|
import { CallBudget, RequestCalls, callScope, checkedLimits, countInto, countedAs, heldCall, noScope, readScope, requestCount, stepBudget, withBound } from "../store/call-count.mjs";
|
|
9
10
|
import { forkIn, noCall, resultIn } from "../store/crossing.mjs";
|
|
@@ -21,21 +22,22 @@ import { ReachCache, indexReach } from "./index-reach.mjs";
|
|
|
21
22
|
import { indexedVisible, setReachOf } from "./index-visible.mjs";
|
|
22
23
|
import { pointersOfObjects } from "./lfs-pointers.mjs";
|
|
23
24
|
import { PackIndexes, packReader, seedBytes } from "./pack-reads.mjs";
|
|
24
|
-
import { copyRowsPage } from "./object-rows.mjs";
|
|
25
|
+
import { copyRowsPage, noRows } from "./object-rows.mjs";
|
|
25
26
|
import { pushedCommitsPage } from "./pushed-commits.mjs";
|
|
26
27
|
import { segmentTooLarge } from "./links.mjs";
|
|
27
28
|
import { walkWithin } from "./swap-walk.mjs";
|
|
28
29
|
import { receivePack, tooMany } from "./pack-receive.mjs";
|
|
29
|
-
import { mergesAlone, passDue, pruneStep, readPrune } from "./prune.mjs";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
30
|
+
import { mergesAlone, passDue, passScratch, pruneStartedKey, pruneStep, readPrune } from "./prune.mjs";
|
|
31
|
+
import { rebuildStep } from "./graph-rebuild.mjs";
|
|
32
|
+
import { liftedFences, unfenced } from "./merge-fence.mjs";
|
|
33
|
+
import { freshCalls, geometricStep, groupedPacks, membersOf, opensWithin, resumeMerge, streamHeld } from "./merge-stream.mjs";
|
|
32
34
|
import { droppedStep, mergeKey } from "./merge-row.mjs";
|
|
33
35
|
import { parksPass } from "./repack-job.mjs";
|
|
34
36
|
import { sharePacks } from "./quarantine.mjs";
|
|
35
37
|
import { burstOptions, defaultRepack, optionFor, readObjectRows } from "./repack.mjs";
|
|
36
38
|
import { containedPlan, containedWalk, countedMerge } from "./repack-contained.mjs";
|
|
37
39
|
import { refuseBacklog } from "./repack-backlog.mjs";
|
|
38
|
-
import { defaultShallow, readyAnswer, readyStep, untilEnded } from "./ready.mjs";
|
|
40
|
+
import { defaultShallow, readyAnswer, readyBytesOf, readyKey, readyStep, untilEnded } from "./ready.mjs";
|
|
39
41
|
import { defaultPrune, pruneWait, quarantineKey } from "./rows.mjs";
|
|
40
42
|
import { readAnswer, receiveStep, stageReceive } from "./receive-steps.mjs";
|
|
41
43
|
import { memoryOf, openBudget } from "./packs-memory.mjs";
|
|
@@ -136,22 +138,28 @@ const rejoined = (chunks, reader) => {
|
|
|
136
138
|
const stepLost = fail("UNAVAILABLE", "Another try of this receive's step committed first", { hint: "Try the step again" });
|
|
137
139
|
const tooManyToUnpack = (count) => gitError("INVALID_ARGUMENT", `The pack's header counts ${count} objects, past what its push said`, { hint: "Push again" });
|
|
138
140
|
/**
|
|
139
|
-
* A repo's stats, read for an option given as a function: its record, refs, `stats` times
|
|
140
|
-
*
|
|
141
|
+
* A repo's stats, read for an option given as a function: its record, refs, `stats` times, listed
|
|
142
|
+
* packs and ready shallow pack, all at one version, so the bytes are a total some version held.
|
|
143
|
+
* They're read again rather than taken from the step's `Listed`, which a repack may have moved on
|
|
144
|
+
* from before the ready pack's read.
|
|
141
145
|
*/
|
|
142
|
-
const statsOf = /* @__PURE__ */ Effect.fnUntraced(function* (store,
|
|
143
|
-
const
|
|
144
|
-
scope: repoScope(
|
|
146
|
+
const statsOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo) {
|
|
147
|
+
const [selfRows = [], refRows = [], packRows = [], timeRows = [], readyRows = []] = (yield* store.read({
|
|
148
|
+
scope: repoScope(repo),
|
|
145
149
|
reads: [
|
|
146
150
|
selfKey,
|
|
147
151
|
{ collection: collections.refs },
|
|
148
|
-
{ collection: collections.
|
|
152
|
+
{ collection: collections.packs },
|
|
153
|
+
{ collection: collections.stats },
|
|
154
|
+
readyKey
|
|
149
155
|
]
|
|
150
|
-
});
|
|
151
|
-
const record = yield* decodeRecord(
|
|
156
|
+
})).results;
|
|
157
|
+
const record = yield* decodeRecord(selfRows[0]);
|
|
152
158
|
if (record === void 0) return yield* fail("NOT_FOUND", "The repo's record is gone");
|
|
153
|
-
const
|
|
154
|
-
|
|
159
|
+
const packs = yield* decodePacks(packRows);
|
|
160
|
+
const times = yield* decodeStats(timeRows);
|
|
161
|
+
const readyBytes = yield* readyBytesOf(readyRows);
|
|
162
|
+
return repoStats(record, refRows.length, packs, times, readyBytes);
|
|
155
163
|
});
|
|
156
164
|
const hasChange = (step) => {
|
|
157
165
|
const { add = [], remove = [], put = [], delete: deleted = [] } = step.change;
|
|
@@ -224,7 +232,10 @@ const receiveRows = /* @__PURE__ */ Effect.fnUntraced(function* (reader, unpack,
|
|
|
224
232
|
});
|
|
225
233
|
const quarantine = {
|
|
226
234
|
id: newChangeId(),
|
|
227
|
-
change: {
|
|
235
|
+
change: {
|
|
236
|
+
put: unpacked.rows,
|
|
237
|
+
rows: unpacked.moved
|
|
238
|
+
},
|
|
228
239
|
bytes: unpacked.bytes,
|
|
229
240
|
objects: unpacked.objects.length,
|
|
230
241
|
lfsPointers: yield* pointersOfObjects(unpacked.objects, pointers)
|
|
@@ -427,7 +438,7 @@ const packs = (options = {}) => {
|
|
|
427
438
|
const stage = Effect.fnUntraced(function* (listed, input) {
|
|
428
439
|
const past = segmentTooLarge(input);
|
|
429
440
|
if (past !== void 0) return yield* Effect.fail(past);
|
|
430
|
-
const { quarantine: prune } = optionsFor(chosen ? yield* statsOf(calls, listed) : void 0);
|
|
441
|
+
const { quarantine: prune } = optionsFor(chosen ? yield* statsOf(calls, listed.repo) : void 0);
|
|
431
442
|
const { boundary = [], needs = [], cutMost, length, atMost } = input;
|
|
432
443
|
return yield* stageReceive({
|
|
433
444
|
store: calls,
|
|
@@ -473,7 +484,7 @@ const packs = (options = {}) => {
|
|
|
473
484
|
};
|
|
474
485
|
}
|
|
475
486
|
};
|
|
476
|
-
const { quarantine: prune } = optionsFor(chosen ? yield* statsOf(calls, listed) : void 0);
|
|
487
|
+
const { quarantine: prune } = optionsFor(chosen ? yield* statsOf(calls, listed.repo) : void 0);
|
|
477
488
|
const { objects, needs } = input;
|
|
478
489
|
const receiving = {
|
|
479
490
|
store: input.store,
|
|
@@ -520,7 +531,7 @@ const packs = (options = {}) => {
|
|
|
520
531
|
*/
|
|
521
532
|
const seeded = (run) => Effect.scoped(Effect.flatMap(Effect.scope, (answered) => Effect.flatMap(Effect.scoped(run(answered)), (done) => done.seed === void 0 ? Effect.succeed(done.answer) : Effect.as(indexes.seed(done.seed), done.answer))));
|
|
522
533
|
const receiveWithin = Effect.fnUntraced(function* (listed, input, memory, visible) {
|
|
523
|
-
const { unpack, quarantine } = optionsFor(chosen ? yield* statsOf(calls, listed) : void 0);
|
|
534
|
+
const { unpack, quarantine } = optionsFor(chosen ? yield* statsOf(calls, listed.repo) : void 0);
|
|
524
535
|
const held = readerOf(listed, memory.reader, void 0, visible);
|
|
525
536
|
if (input.objects === 0) return yield* receiveRows(held, unpack, input, memory.pointers);
|
|
526
537
|
if (unpack === false || input.objects > unpack.maxObjects) return yield* asPack(listed, input, quarantine, memory, visible);
|
|
@@ -691,7 +702,7 @@ const packs = (options = {}) => {
|
|
|
691
702
|
more: true
|
|
692
703
|
};
|
|
693
704
|
return yield* Effect.flatMap(budget.upkeep(), (allotment) => upkeepSteps(listed, input, allotment, own, raw, cleaned)).pipe(Effect.catchIf((error) => error === readBusy, () => Effect.succeed({
|
|
694
|
-
change: {},
|
|
705
|
+
change: { rows: noRows },
|
|
695
706
|
more: false,
|
|
696
707
|
due: at + growWaitMs
|
|
697
708
|
})));
|
|
@@ -714,11 +725,16 @@ const packs = (options = {}) => {
|
|
|
714
725
|
allotment
|
|
715
726
|
};
|
|
716
727
|
const objectRows = yield* readObjectRows(upkeep);
|
|
717
|
-
const
|
|
728
|
+
const prior = yield* readPrune(upkeep);
|
|
729
|
+
const fences = liftedFences(prior.refused, freshCalls(counted?.most));
|
|
730
|
+
const read = {
|
|
731
|
+
...prior,
|
|
732
|
+
refused: fences.refused
|
|
733
|
+
};
|
|
718
734
|
const { repack: merging, prune: pruning } = read.merges;
|
|
719
735
|
const orphan = prune === false || input.deleted === true ? pruning : void 0;
|
|
720
736
|
if (orphan === void 0 && merging !== void 0 && pruning === void 0 && input.steps === "prune") return {
|
|
721
|
-
change: {},
|
|
737
|
+
change: { rows: noRows },
|
|
722
738
|
more: false,
|
|
723
739
|
yielded: true
|
|
724
740
|
};
|
|
@@ -737,6 +753,16 @@ const packs = (options = {}) => {
|
|
|
737
753
|
};
|
|
738
754
|
const step = yield* Effect.gen(function* () {
|
|
739
755
|
if (orphan !== void 0) return ending(droppedStep(orphan));
|
|
756
|
+
if (input.deleted === true && read.started !== void 0) return (yield* passScratch(upkeep, read.started.at)) === "more" ? {
|
|
757
|
+
change: { rows: noRows },
|
|
758
|
+
more: true
|
|
759
|
+
} : {
|
|
760
|
+
change: {
|
|
761
|
+
delete: [pruneStartedKey],
|
|
762
|
+
rows: noRows
|
|
763
|
+
},
|
|
764
|
+
more: true
|
|
765
|
+
};
|
|
740
766
|
if (merging !== void 0 && input.steps !== "prune") return yield* resumeMerge(upkeep, merging, chosen === false ? defaultRepack.maxPackSize : chosen.maxPackSize ?? defaultRepack.maxPackSize, counted === void 0 ? void 0 : {
|
|
741
767
|
made: counted.made,
|
|
742
768
|
most: counted.most
|
|
@@ -751,10 +777,15 @@ const packs = (options = {}) => {
|
|
|
751
777
|
more: true
|
|
752
778
|
};
|
|
753
779
|
if (input.steps === "prune") return pruned?.next === void 0 ? void 0 : {
|
|
754
|
-
change: {},
|
|
780
|
+
change: { rows: noRows },
|
|
755
781
|
more: false,
|
|
756
782
|
due: pruned.next
|
|
757
783
|
};
|
|
784
|
+
const rebuilt = yield* rebuildStep(upkeep, read.refused, counted === void 0 ? void 0 : {
|
|
785
|
+
made: counted.made,
|
|
786
|
+
most: counted.most
|
|
787
|
+
});
|
|
788
|
+
if (rebuilt !== void 0) return ending(rebuilt);
|
|
758
789
|
const held = new Set(pruning?.value.inputs);
|
|
759
790
|
const cruft = mergesAlone(read);
|
|
760
791
|
const alone = (pack) => cruft(pack) || held.has(pack.id);
|
|
@@ -808,14 +839,14 @@ const packs = (options = {}) => {
|
|
|
808
839
|
const behind = last === void 0 || last + wait <= at ? { pruneWait: wait } : {};
|
|
809
840
|
const ended = ready ?? cleaned;
|
|
810
841
|
const named = passAt === void 0 ? ended : {
|
|
811
|
-
change: {},
|
|
842
|
+
change: { rows: noRows },
|
|
812
843
|
more: false,
|
|
813
844
|
...ended,
|
|
814
845
|
prune: passAt,
|
|
815
846
|
...behind
|
|
816
847
|
};
|
|
817
848
|
const idle = named ?? {
|
|
818
|
-
change: {},
|
|
849
|
+
change: { rows: noRows },
|
|
819
850
|
more: false
|
|
820
851
|
};
|
|
821
852
|
if (due === void 0) return named;
|
|
@@ -824,7 +855,7 @@ const packs = (options = {}) => {
|
|
|
824
855
|
due
|
|
825
856
|
};
|
|
826
857
|
});
|
|
827
|
-
return unfenced(step, read.refused, listed.packs);
|
|
858
|
+
return unfenced(step, read.refused, listed.packs, fences.lifted);
|
|
828
859
|
});
|
|
829
860
|
/**
|
|
830
861
|
* The objects, every one, or with `visible`, only those it holds, as `seen` says. Each call
|
package/dist/storage/prune.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { decodeRefused, refusedRead } from "./merge-fence.mjs";
|
|
|
12
12
|
import { decodeMerges, droppedStep, mergeKey, mergeRead, takenOf, writtenOf } from "./merge-row.mjs";
|
|
13
13
|
import { mergeInputsMost } from "./merge-most.mjs";
|
|
14
14
|
import { opensWithin, resumeMerge, streamMerge } from "./merge-stream.mjs";
|
|
15
|
-
import { objectKey } from "./object-rows.mjs";
|
|
15
|
+
import { noRows, objectKey, rowsMoved } from "./object-rows.mjs";
|
|
16
16
|
import { bitsBytes, hasBit, keepBits, keptAt, setBit } from "./prune-keep.mjs";
|
|
17
17
|
import { WalkSaved, pruneWalk, walkKeys } from "./prune-walk.mjs";
|
|
18
18
|
import { defaultRepack, leavingRows, loadAll, mergeWith, namedOf, replacing, wholeRows } from "./repack.mjs";
|
|
@@ -150,7 +150,8 @@ const pruneWhole = /* @__PURE__ */ WholeRepo.mint();
|
|
|
150
150
|
const walkPackOf = (repo, at, kind) => `p_${kind}${repo.slice(2)}${at.toString(36).padStart(15, "0")}`;
|
|
151
151
|
/**
|
|
152
152
|
* The scratch packs of the pass marked at `at` dropped, pages at most each, once its commit is
|
|
153
|
-
* in: `'more'` while keys are left, for the next step to drop.
|
|
153
|
+
* in: `'more'` while keys are left, for the next step to drop. The next pass's first step drops
|
|
154
|
+
* them, or a deleted repo's step, which no pass follows.
|
|
154
155
|
*/
|
|
155
156
|
const passScratch = (input, at) => Effect.map(Effect.all([dropRuns(input.bucket, walkPackOf(input.listed.repo, at, "r")), dropRuns(input.bucket, walkPackOf(input.listed.repo, at, "n"))]), (drops) => drops.includes("more") ? "more" : "done");
|
|
156
157
|
/**
|
|
@@ -393,7 +394,8 @@ const cruftListing = (landed) => Effect.fnUntraced(function* (input, merge) {
|
|
|
393
394
|
...cruftKey(pack.id),
|
|
394
395
|
value: { since: input.at }
|
|
395
396
|
})),
|
|
396
|
-
delete: [...quarantines, mergeKey(merge.pack)]
|
|
397
|
+
delete: [...quarantines, mergeKey(merge.pack)],
|
|
398
|
+
rows: noRows
|
|
397
399
|
},
|
|
398
400
|
more: true,
|
|
399
401
|
quarantine: first,
|
|
@@ -421,7 +423,8 @@ const keptListing = (read, seen, rows, landed) => Effect.fnUntraced(function* (i
|
|
|
421
423
|
...quarantines,
|
|
422
424
|
...dropped.map((pack) => cruftKey(pack.id)),
|
|
423
425
|
mergeKey(merge.pack)
|
|
424
|
-
]
|
|
426
|
+
],
|
|
427
|
+
rows: noRows
|
|
425
428
|
},
|
|
426
429
|
more: true,
|
|
427
430
|
quarantine: first,
|
|
@@ -477,7 +480,8 @@ const rowsCruft = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, most
|
|
|
477
480
|
...cruftKey(id),
|
|
478
481
|
value: { since: input.at }
|
|
479
482
|
}],
|
|
480
|
-
delete: [merged.quarantine]
|
|
483
|
+
delete: [merged.quarantine],
|
|
484
|
+
rows: noRows
|
|
481
485
|
},
|
|
482
486
|
more: true,
|
|
483
487
|
quarantine: merged.quarantine
|
|
@@ -492,7 +496,10 @@ const rowsStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, keep,
|
|
|
492
496
|
});
|
|
493
497
|
if (merged === "too big") return { waits: "its rows pack is past the pack size" };
|
|
494
498
|
const step = {
|
|
495
|
-
change: merged === void 0 ? {
|
|
499
|
+
change: merged === void 0 ? {
|
|
500
|
+
delete: rows.map((row) => objectKey(row.oid)),
|
|
501
|
+
rows: rowsMoved(rows, "deleted")
|
|
502
|
+
} : replacing(input, merged, [], rows),
|
|
496
503
|
more: true
|
|
497
504
|
};
|
|
498
505
|
if (merged !== void 0) step.quarantine = merged.quarantine;
|
|
@@ -500,7 +507,9 @@ const rowsStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, rows, keep,
|
|
|
500
507
|
});
|
|
501
508
|
/**
|
|
502
509
|
* 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`.
|
|
510
|
+
* each a `leaving` row, and an old cruft pack's `cruft` row ended, so the step `drops`. It makes
|
|
511
|
+
* the `repack` row due, whose clean-up deletes the packs' bytes once their rows are, so on a repo
|
|
512
|
+
* that takes no push they don't wait for the row's next run.
|
|
504
513
|
*/
|
|
505
514
|
const emptiedStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, emptied) {
|
|
506
515
|
const ids = new Set(emptied.map((each) => each.pack));
|
|
@@ -510,9 +519,11 @@ const emptiedStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, em
|
|
|
510
519
|
change: {
|
|
511
520
|
remove: removed.map((pack) => pack.id),
|
|
512
521
|
put: leavingRows(input, removed),
|
|
513
|
-
delete: dropped.map((pack) => cruftKey(pack.id))
|
|
522
|
+
delete: dropped.map((pack) => cruftKey(pack.id)),
|
|
523
|
+
rows: noRows
|
|
514
524
|
},
|
|
515
|
-
more: true
|
|
525
|
+
more: true,
|
|
526
|
+
repack: input.at
|
|
516
527
|
};
|
|
517
528
|
if (dropped.length > 0) step.drops = true;
|
|
518
529
|
return step;
|
|
@@ -553,7 +564,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
553
564
|
const scratch = walkPackOf(input.listed.repo, at, "r");
|
|
554
565
|
const saving = (walks) => ({
|
|
555
566
|
step: {
|
|
556
|
-
change: {},
|
|
567
|
+
change: { rows: noRows },
|
|
557
568
|
more: true
|
|
558
569
|
},
|
|
559
570
|
mark: { walks }
|
|
@@ -661,7 +672,7 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
661
672
|
if ("cruft" in first) return first.cruft;
|
|
662
673
|
if ("classes" in first) return {
|
|
663
674
|
step: {
|
|
664
|
-
change: {},
|
|
675
|
+
change: { rows: noRows },
|
|
665
676
|
more: true
|
|
666
677
|
},
|
|
667
678
|
mark: { classes: first.classes }
|
|
@@ -731,18 +742,19 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
731
742
|
if (emptied.length > 0) return { step: yield* emptiedStep(input, read, emptied) };
|
|
732
743
|
if (rewrites.length > 0) {
|
|
733
744
|
const n = (classes?.n ?? -1) + 1;
|
|
745
|
+
const value = {
|
|
746
|
+
kind: "kept",
|
|
747
|
+
n,
|
|
748
|
+
packs: ids,
|
|
749
|
+
reads: digest,
|
|
750
|
+
bytes: yield* putClasses(input, classesKey(input.listed.repo, at, n), rewrites)
|
|
751
|
+
};
|
|
734
752
|
return {
|
|
735
753
|
step: {
|
|
736
|
-
change: {},
|
|
754
|
+
change: { rows: noRows },
|
|
737
755
|
more: true
|
|
738
756
|
},
|
|
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
|
-
} }
|
|
757
|
+
mark: { classes: value }
|
|
746
758
|
};
|
|
747
759
|
}
|
|
748
760
|
const held = carry.refs === void 0 || (yield* refsHeld(input, scratch, carry.refs, refs));
|
|
@@ -750,14 +762,17 @@ const passSteps = /* @__PURE__ */ Effect.fnUntraced(function* (input, read, pack
|
|
|
750
762
|
const scratchDropped = yield* dropRuns(input.bucket, scratch, marked);
|
|
751
763
|
const namedDropped = yield* dropRuns(input.bucket, named, marked);
|
|
752
764
|
if (scratchDropped === "more" || namedDropped === "more") return { step: {
|
|
753
|
-
change: {},
|
|
765
|
+
change: { rows: noRows },
|
|
754
766
|
more: true
|
|
755
767
|
} };
|
|
756
768
|
const step = {
|
|
757
|
-
change: {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
769
|
+
change: {
|
|
770
|
+
put: [{
|
|
771
|
+
...prunePassKey,
|
|
772
|
+
value: { at: input.at }
|
|
773
|
+
}],
|
|
774
|
+
rows: noRows
|
|
775
|
+
},
|
|
761
776
|
more: false
|
|
762
777
|
};
|
|
763
778
|
const whole = (oid) => keep(oid) || inFenced(oid);
|
|
@@ -844,17 +859,20 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
844
859
|
const ended = read.started?.at;
|
|
845
860
|
if (ended !== void 0 && last !== void 0 && ended <= last && (yield* passScratch(input, ended)) === "more") return {
|
|
846
861
|
step: {
|
|
847
|
-
change: {},
|
|
862
|
+
change: { rows: noRows },
|
|
848
863
|
more: true
|
|
849
864
|
},
|
|
850
865
|
next
|
|
851
866
|
};
|
|
852
867
|
if (markHeld && read.cruft.size === 0 && merge === void 0) return {
|
|
853
868
|
step: {
|
|
854
|
-
change: {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
869
|
+
change: {
|
|
870
|
+
put: [{
|
|
871
|
+
...prunePassKey,
|
|
872
|
+
value: { at: input.at }
|
|
873
|
+
}],
|
|
874
|
+
rows: noRows
|
|
875
|
+
},
|
|
858
876
|
more: true
|
|
859
877
|
},
|
|
860
878
|
next: input.at + pruneWait(prune)
|
|
@@ -877,10 +895,13 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
877
895
|
const { started } = read;
|
|
878
896
|
if (!(started !== void 0 && (last === void 0 || started.at > last))) return {
|
|
879
897
|
step: {
|
|
880
|
-
change: {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
898
|
+
change: {
|
|
899
|
+
put: [{
|
|
900
|
+
...pruneStartedKey,
|
|
901
|
+
value: { at: input.at }
|
|
902
|
+
}],
|
|
903
|
+
rows: noRows
|
|
904
|
+
},
|
|
884
905
|
more: true
|
|
885
906
|
},
|
|
886
907
|
next
|
|
@@ -898,9 +919,13 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
898
919
|
}
|
|
899
920
|
};
|
|
900
921
|
const step = {
|
|
901
|
-
change: merge === void 0 ? {
|
|
922
|
+
change: merge === void 0 ? {
|
|
902
923
|
put: [mark],
|
|
903
|
-
|
|
924
|
+
rows: noRows
|
|
925
|
+
} : {
|
|
926
|
+
put: [mark],
|
|
927
|
+
delete: [mergeKey(merge.pack)],
|
|
928
|
+
rows: noRows
|
|
904
929
|
},
|
|
905
930
|
more: true
|
|
906
931
|
};
|
|
@@ -925,10 +950,13 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
925
950
|
}
|
|
926
951
|
};
|
|
927
952
|
if ("last" in stepped) {
|
|
928
|
-
const rewalk = {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
953
|
+
const rewalk = {
|
|
954
|
+
put: [{
|
|
955
|
+
...pruneStartedKey,
|
|
956
|
+
value: { at: started.at }
|
|
957
|
+
}],
|
|
958
|
+
rows: noRows
|
|
959
|
+
};
|
|
932
960
|
return {
|
|
933
961
|
step: {
|
|
934
962
|
...step.reaches === true ? {
|
|
@@ -945,4 +973,4 @@ const pruneStep = /* @__PURE__ */ Effect.fnUntraced(function* (input, prune, rep
|
|
|
945
973
|
next
|
|
946
974
|
};
|
|
947
975
|
});
|
|
948
|
-
export { CruftRow, PassClasses, PruneCleared, PrunePass, PruneStarted, bitsOf, cruftOf, mergesAlone, passDue, pruneClearedKey, prunePassKey, pruneStartedKey, pruneStep, reachesOnly, readPrune, walkPackOf };
|
|
976
|
+
export { CruftRow, PassClasses, PruneCleared, PrunePass, PruneStarted, bitsOf, cruftOf, mergesAlone, passDue, passScratch, pruneClearedKey, prunePassKey, pruneStartedKey, pruneStep, reachesOnly, readPrune, walkPackOf };
|
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 };
|
|
@@ -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
|
package/dist/storage/unpack.mjs
CHANGED
|
@@ -251,15 +251,22 @@ const unpackObjects = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
|
251
251
|
yield* fscked(input, objects);
|
|
252
252
|
const cut = yield* connected(input, objects);
|
|
253
253
|
const rows = [...objects.values()].map(objectRow);
|
|
254
|
+
let valuesBytes = 0;
|
|
254
255
|
for (const row of rows) {
|
|
255
256
|
const valueBytes = rowValueBytes(row.value);
|
|
256
257
|
if (valueBytes > limits.valueBytes) return yield* Effect.fail(rowTooLarge(row.id, valueBytes));
|
|
258
|
+
valuesBytes += valueBytes;
|
|
257
259
|
}
|
|
258
260
|
const rowBytes = rows.reduce((sum, row) => sum + JSON.stringify(row).length, 0);
|
|
259
261
|
if (rowBytes > limits$1.bytes) return yield* Effect.fail(tooLarge(rowBytes, limits$1.bytes));
|
|
262
|
+
const moved = {
|
|
263
|
+
objects: rows.length,
|
|
264
|
+
bytes: valuesBytes
|
|
265
|
+
};
|
|
260
266
|
return {
|
|
261
267
|
objects: [...objects.values()],
|
|
262
268
|
rows,
|
|
269
|
+
moved,
|
|
263
270
|
bytes,
|
|
264
271
|
cut
|
|
265
272
|
};
|