@ref0/git 0.20.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/private-refs.mjs +1 -1
- package/dist/auth/access-jwt.mjs +3 -3
- package/dist/auth/auth-namespace.d.mts +3 -3
- package/dist/auth/auth-namespace.mjs +3 -2
- package/dist/auth/auth.d.mts +3 -3
- package/dist/auth/auth.mjs +9 -8
- package/dist/auth/authorize.mjs +1 -1
- package/dist/auth/fences.d.mts +1 -1
- package/dist/auth/host-function.mjs +1 -1
- package/dist/auth/host-services.mjs +4 -6
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +6 -0
- package/dist/auth/token-cleanup.mjs +2 -2
- package/dist/auth/token-rows.mjs +6 -1
- package/dist/auth/token-text.mjs +1 -1
- package/dist/auth/tokens-base.d.mts +1 -1
- package/dist/auth/tokens.d.mts +1 -1
- package/dist/auth/tokens.mjs +1 -1
- package/dist/client/client.d.mts +15 -7
- package/dist/client/client.mjs +21 -12
- package/dist/client/git-http.mjs +1 -1
- package/dist/client/local.mjs +60 -24
- package/dist/client/negotiate.mjs +3 -3
- package/dist/client/push-upload.mjs +26 -10
- package/dist/client/remote.mjs +4 -3
- package/dist/client/run-remote-helper.d.mts +2 -2
- package/dist/client/run-remote-helper.mjs +6 -6
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +3 -3
- package/dist/contracts/blobs.d.mts +3 -3
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/calls-spent.mjs +5 -33
- package/dist/contracts/client.d.mts +15 -14
- package/dist/contracts/commits.d.mts +4 -4
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +2 -2
- package/dist/contracts/events.d.mts +1 -1
- package/dist/contracts/events.mjs +1 -1
- package/dist/contracts/files.d.mts +4 -4
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +4 -4
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-hooks.d.mts +1 -1
- package/dist/contracts/git.d.mts +9 -5
- package/dist/contracts/grants.d.mts +1 -1
- package/dist/contracts/merges.d.mts +1 -1
- package/dist/contracts/object-values.d.mts +1 -0
- package/dist/contracts/object-values.mjs +16 -1
- package/dist/contracts/objects.d.mts +30 -18
- package/dist/contracts/opaque.mjs +1 -1
- package/dist/contracts/operations.mjs +1 -1
- package/dist/contracts/queue.d.mts +208 -44
- package/dist/contracts/queue.mjs +5 -5
- package/dist/contracts/refs.d.mts +5 -5
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +3 -6
- package/dist/contracts/repos.d.mts +3 -3
- package/dist/contracts/repos.mjs +1 -1
- package/dist/contracts/result.d.mts +10 -7
- package/dist/contracts/result.mjs +8 -3
- package/dist/contracts/rules.d.mts +13 -12
- package/dist/contracts/server.d.mts +8 -10
- package/dist/contracts/services.d.mts +6 -9
- package/dist/contracts/services.mjs +1 -2
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/store.d.mts +2 -2
- package/dist/contracts/sync.d.mts +63 -6
- package/dist/contracts/sync.mjs +3 -2
- package/dist/contracts/tags.d.mts +3 -3
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/tokens.d.mts +2 -2
- package/dist/contracts/tokens.mjs +1 -1
- package/dist/contracts/topics.d.mts +9 -9
- package/dist/contracts/trees.d.mts +4 -4
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +4 -4
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +1 -1
- package/dist/core/ancestry.mjs +30 -34
- package/dist/core/{promise.mjs → call-groups.mjs} +7 -30
- package/dist/core/call-services.mjs +1 -1
- package/dist/core/events/deliver.d.mts +2 -2
- package/dist/core/events/deliver.mjs +3 -3
- package/dist/core/events/retired.mjs +1 -1
- package/dist/core/forks.mjs +5 -5
- package/dist/core/hooks/groups.mjs +2 -2
- package/dist/core/imports.mjs +101 -21
- package/dist/core/index-job.mjs +14 -9
- package/dist/core/index-lost.d.mts +1 -1
- package/dist/core/loose-tally.mjs +38 -15
- package/dist/core/merge-parts.d.mts +17 -4
- package/dist/core/merge-parts.mjs +7 -2
- package/dist/core/mirror-rows.mjs +31 -1
- package/dist/core/objects/blobs.mjs +8 -10
- package/dist/core/objects/files.mjs +20 -17
- package/dist/core/objects/objects-layer.mjs +1 -1
- package/dist/core/objects/peel.mjs +1 -7
- package/dist/core/objects/reading.mjs +19 -18
- package/dist/core/objects/tree-edits.mjs +1 -1
- package/dist/core/objects/trees.mjs +257 -58
- package/dist/core/objects/writing.mjs +3 -9
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +8 -1
- package/dist/core/parts.mjs +8 -4
- package/dist/core/purge.mjs +31 -18
- package/dist/core/push.d.mts +2 -2
- package/dist/core/push.mjs +145 -98
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +9 -2
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +74 -31
- package/dist/core/refs.mjs +3 -3
- package/dist/core/repack.mjs +25 -30
- package/dist/core/repo-info.mjs +1 -1
- package/dist/core/repos.mjs +1 -1
- package/dist/core/rules/changes.mjs +18 -40
- package/dist/core/rules/check.mjs +6 -5
- package/dist/core/rules/commit-changes.mjs +114 -58
- package/dist/core/rules/context.d.mts +3 -3
- package/dist/core/rules/context.mjs +18 -14
- package/dist/core/rules/fetch.mjs +1 -1
- package/dist/core/rules/protect.mjs +30 -17
- package/dist/core/saved-caller-views.d.mts +1 -1
- package/dist/core/saved-caller-views.mjs +3 -3
- package/dist/core/saved-callers.d.mts +1 -1
- package/dist/core/saved-callers.mjs +1 -1
- package/dist/core/seam.d.mts +1 -2
- package/dist/core/view.d.mts +6 -3
- package/dist/core/view.mjs +11 -10
- package/dist/core/work.mjs +2 -2
- package/dist/engine/allotted-xdiff.mjs +3 -16
- package/dist/engine/combined.d.mts +3 -0
- package/dist/engine/combined.mjs +200 -185
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/merge.mjs +7 -9
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +22 -14
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +1 -1
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +2 -2
- package/dist/event-streams/stream.mjs +3 -3
- package/dist/extend.d.mts +2 -6
- package/dist/extend.mjs +1 -5
- package/dist/http/core-parts.mjs +83 -26
- package/dist/http/handler.mjs +54 -9
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +138 -24
- package/dist/http/push-uploads.mjs +2 -2
- package/dist/http/receive-pack.mjs +14 -53
- package/dist/http/request-snapshot.mjs +258 -0
- package/dist/http/upload-pack.mjs +23 -18
- package/dist/index.d.mts +29 -21
- package/dist/index.mjs +11 -2
- package/dist/lfs/base.d.mts +1 -1
- package/dist/lfs/copy.d.mts +49 -1
- package/dist/lfs/copy.mjs +135 -22
- package/dist/lfs/layer.d.mts +4 -3
- package/dist/lfs/layer.mjs +4 -5
- package/dist/lfs/locks.mjs +2 -2
- package/dist/lfs/objects.d.mts +1 -1
- package/dist/lfs/objects.mjs +3 -3
- package/dist/lfs/pointers.mjs +1 -1
- package/dist/lfs/rows.d.mts +1 -1
- package/dist/lfs/rows.mjs +11 -4
- package/dist/lfs/upkeep.mjs +40 -9
- package/dist/lfs/uploaded.mjs +1 -1
- package/dist/lfs/wire.mjs +1 -1
- package/dist/merges/merges.mjs +17 -2
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +1 -1
- package/dist/protocol/bytes/deflate.d.mts +1 -1
- package/dist/protocol/bytes/deflate.mjs +1 -1
- package/dist/protocol/bytes/inflate.d.mts +1 -1
- package/dist/protocol/bytes/inflate.mjs +1 -1
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +1 -1
- package/dist/protocol/diff/read.d.mts +2 -1
- package/dist/protocol/diff/read.mjs +102 -8
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +1 -1
- package/dist/protocol/packs/idx.mjs +1 -1
- package/dist/protocol/packs/parts.mjs +1 -1
- package/dist/protocol/packs/reader.d.mts +1 -1
- package/dist/protocol/packs/reader.mjs +1 -1
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +1 -1
- package/dist/protocol/packs/writer.mjs +3 -3
- package/dist/protocol/wire/advertisement.d.mts +1 -1
- package/dist/protocol/wire/advertisement.mjs +3 -2
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +9 -1
- package/dist/protocol/wire/lines.mjs +28 -1
- package/dist/protocol/wire/push-uploads.mjs +10 -7
- package/dist/protocol/wire/receive-pack.d.mts +1 -1
- package/dist/protocol/wire/receive-pack.mjs +1 -1
- package/dist/protocol/wire/report-status.d.mts +1 -1
- package/dist/protocol/wire/report-status.mjs +1 -1
- package/dist/protocol/wire/v2.d.mts +1 -1
- package/dist/protocol/wire/v2.mjs +1 -1
- package/dist/queue/advance.mjs +31 -24
- package/dist/queue/base.d.mts +5 -3
- package/dist/queue/calls.mjs +5 -5
- package/dist/queue/commit.mjs +1 -1
- package/dist/queue/host.d.mts +1 -1
- package/dist/queue/layer.d.mts +0 -1
- package/dist/queue/layer.mjs +9 -5
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +1 -1
- package/dist/queue/state.mjs +1 -1
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/client.d.mts +1 -1
- package/dist/rest/client.mjs +6 -6
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/handler.mjs +2 -2
- package/dist/rest/handlers.mjs +16 -6
- package/dist/rest/layer.mjs +1 -1
- package/dist/rest/listen.mjs +2 -2
- package/dist/rest/refs.mjs +1 -1
- package/dist/server/edge.mjs +27 -3
- package/dist/server/git-layer.d.mts +1 -2
- package/dist/server/git-layer.mjs +4 -5
- package/dist/server/lifecycle.mjs +1 -1
- package/dist/server/registry.mjs +2 -8
- package/dist/server/server.mjs +62 -43
- package/dist/signin/context.d.mts +1 -1
- package/dist/signin/context.mjs +1 -1
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -2
- package/dist/signin/grants.mjs +1 -1
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/allotted.mjs +4 -9
- package/dist/storage/batch-upkeep.mjs +31 -12
- package/dist/storage/batches.d.mts +2 -3
- package/dist/storage/batches.mjs +52 -49
- package/dist/storage/budget.mjs +23 -1
- package/dist/storage/calls.d.mts +1 -1
- package/dist/storage/calls.mjs +41 -43
- package/dist/storage/charged-cache.mjs +180 -0
- package/dist/storage/chunks.d.mts +3 -3
- package/dist/storage/chunks.mjs +121 -8
- package/dist/storage/counted-bucket.mjs +32 -10
- package/dist/storage/fetch-row-cache.d.mts +6 -0
- package/dist/storage/fetch-row-cache.mjs +211 -0
- package/dist/storage/fetch.d.mts +1 -0
- package/dist/storage/fetch.mjs +54 -242
- package/dist/storage/held-types.d.mts +0 -1
- package/dist/storage/held-types.mjs +13 -4
- package/dist/storage/host-bucket.mjs +9 -4
- package/dist/storage/index-bitmaps.mjs +340 -65
- package/dist/storage/index-build.d.mts +2 -3
- package/dist/storage/index-build.mjs +274 -56
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +60 -21
- package/dist/storage/index-graph.mjs +1 -1
- package/dist/storage/index-layers.mjs +55 -25
- package/dist/storage/index-reach.mjs +15 -22
- package/dist/storage/index-whole.d.mts +7 -0
- package/dist/storage/index-whole.mjs +145 -37
- package/dist/storage/largest-files.mjs +1 -7
- package/dist/storage/layout.mjs +17 -1
- package/dist/storage/lfs-pointers.mjs +1 -6
- package/dist/storage/link-join.mjs +55 -16
- package/dist/storage/list-source.d.mts +7 -0
- package/dist/storage/list-source.mjs +288 -0
- package/dist/storage/loose.d.mts +8 -8
- package/dist/storage/loose.mjs +157 -91
- package/dist/storage/memory-budget.mjs +226 -22
- package/dist/storage/merge-cut.mjs +9 -6
- package/dist/storage/merge-fence.mjs +1 -1
- package/dist/storage/merge-row.mjs +1 -1
- package/dist/storage/merge.d.mts +2 -3
- package/dist/storage/merge.mjs +2 -2
- package/dist/storage/object-rows.d.mts +3 -3
- package/dist/storage/object-rows.mjs +179 -38
- package/dist/storage/pack-order.mjs +97 -44
- package/dist/storage/pack-ranges.mjs +44 -16
- package/dist/storage/pack-reads.d.mts +5 -3
- package/dist/storage/pack-reads.mjs +236 -72
- package/dist/storage/pack-receive.d.mts +1 -2
- package/dist/storage/pack-receive.mjs +24 -18
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +477 -116
- package/dist/storage/placed-reads.mjs +33 -16
- package/dist/storage/prune-seen.mjs +1 -1
- package/dist/storage/prune-walk.mjs +1 -1
- package/dist/storage/prune.mjs +4 -31
- package/dist/storage/push-allotment.mjs +26 -14
- package/dist/storage/push-uploads.mjs +195 -57
- package/dist/storage/pushed-commits.mjs +20 -1
- package/dist/storage/quarantine.d.mts +2 -3
- package/dist/storage/range-cache.mjs +175 -40
- package/dist/storage/raw-ids.mjs +39 -10
- package/dist/storage/ready.d.mts +2 -3
- package/dist/storage/ready.mjs +114 -38
- package/dist/storage/receive-bounds.mjs +31 -9
- package/dist/storage/receive-cache.d.mts +7 -0
- package/dist/storage/receive-cache.mjs +147 -0
- package/dist/storage/receive-files.mjs +1 -1
- package/dist/storage/receive-links.mjs +1 -1
- package/dist/storage/receive-state.d.mts +2 -2
- package/dist/storage/receive-state.mjs +6 -8
- package/dist/storage/receive-steps.d.mts +20 -0
- package/dist/storage/receive-steps.mjs +298 -13
- package/dist/storage/repack-backlog.mjs +1 -6
- package/dist/storage/repack-contained.mjs +2 -2
- package/dist/storage/repack-job.mjs +1 -1
- package/dist/storage/repack.d.mts +2 -3
- package/dist/storage/repack.mjs +54 -9
- package/dist/storage/request-cache.mjs +57 -0
- package/dist/storage/roots.mjs +1 -24
- package/dist/storage/rows.d.mts +2 -2
- package/dist/storage/rows.mjs +1 -1
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +1 -1
- package/dist/storage/send-list.mjs +62 -25
- package/dist/storage/stream-whole.mjs +84 -63
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +878 -450
- package/dist/storage/visible.mjs +110 -32
- package/dist/storage/walk.mjs +1 -0
- package/dist/storage/wants.mjs +22 -58
- package/dist/store/call-count.d.mts +2 -2
- package/dist/store/call-count.mjs +24 -11
- package/dist/store/catalogue.d.mts +1 -1
- package/dist/store/catalogue.mjs +19 -7
- package/dist/store/crossing.mjs +1 -7
- package/dist/store/cursor-seal.d.mts +1 -1
- package/dist/store/cursor-seal.mjs +1 -1
- package/dist/store/door.mjs +9 -4
- package/dist/store/errors.d.mts +2 -2
- package/dist/store/errors.mjs +107 -19
- package/dist/store/git-store.mjs +7 -2
- package/dist/store/job-try.mjs +90 -9
- package/dist/store/list-job.mjs +10 -34
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +2 -2
- package/dist/store/queue-jobs.mjs +6 -12
- package/dist/store/records.d.mts +2 -2
- package/dist/store/records.mjs +2 -2
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +2 -2
- package/dist/store/repo-record.d.mts +2 -2
- package/dist/store/repo-record.mjs +3 -3
- package/dist/store/request-snapshot.mjs +5 -0
- package/dist/store/reservations.mjs +2 -2
- package/dist/store/topic-jobs.mjs +5 -11
- package/dist/sync/bound.d.mts +3 -3
- package/dist/sync/bound.mjs +10 -7
- package/dist/sync/github.mjs +65 -67
- package/dist/sync/http.mjs +1 -1
- package/dist/sync/import.mjs +201 -66
- package/dist/sync/layer.d.mts +1 -1
- package/dist/sync/layer.mjs +6 -6
- package/dist/sync/lfs-batch.mjs +1 -1
- package/dist/sync/lfs-copy.mjs +175 -15
- package/dist/sync/mirror.mjs +5 -10
- package/dist/sync/said.mjs +1 -1
- package/dist/sync/step.mjs +268 -86
- package/dist/sync/tries.mjs +25 -6
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +3 -3
- package/dist/topics/calls.mjs +1 -1
- package/dist/topics/layer.d.mts +15 -14
- package/dist/topics/members.mjs +1 -1
- package/dist/topics/topic.mjs +1 -1
- package/package.json +3 -13
- package/dist/auth/helpers.mjs +0 -17
- package/dist/auth.d.mts +0 -5
- package/dist/auth.mjs +0 -5
- package/dist/core/rules/commit-changes.d.mts +0 -12
- package/dist/effect.d.mts +0 -9
- package/dist/effect.mjs +0 -7
- package/dist/server/joined.d.mts +0 -70
- package/dist/server/joined.mjs +0 -41
package/dist/engine/combined.mjs
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import { objectsReadMost } from "../contracts/object-values.mjs";
|
|
2
|
-
import { spentAt } from "../contracts/calls-spent.mjs";
|
|
1
|
+
import { growWaits, grownBy, objectsReadMost } from "../contracts/object-values.mjs";
|
|
2
|
+
import { answerFailed, spentAt } from "../contracts/calls-spent.mjs";
|
|
3
3
|
import { gitError, isGitError, reject } from "../contracts/result.mjs";
|
|
4
4
|
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
5
5
|
import { emptyTree } from "../protocol/objects/object.mjs";
|
|
6
6
|
import { compareNames } from "../protocol/objects/tree.mjs";
|
|
7
7
|
import * as Schema from "effect/Schema";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Stream from "effect/Stream";
|
|
10
|
+
import * as Result from "effect/Result";
|
|
8
11
|
// src/engine/combined.ts
|
|
9
12
|
/** The most the walk holds of trees read ahead and not yet open, besides those open: 1 MiB. */
|
|
10
13
|
const aheadMost = 1048576;
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
15
|
+
* A batch read's refusal past a call bound, as the defect it is: a spent request stops whole, so
|
|
16
|
+
* the walk never falls back to reading each tree on its own, which would make more calls past it.
|
|
17
|
+
* Any other refusal reads nothing more ahead.
|
|
14
18
|
*/
|
|
15
|
-
const
|
|
16
|
-
/**
|
|
17
|
-
* A batch read's refusal past a call bound, thrown: a spent request stops whole, so the walk
|
|
18
|
-
* never falls back to reading each tree on its own, which would make more calls past it.
|
|
19
|
-
*/
|
|
20
|
-
const stopIfSpent = (error) => {
|
|
21
|
-
if (spentAt(error) !== void 0) throw failedWith(error);
|
|
22
|
-
};
|
|
19
|
+
const stopIfSpent = (error) => spentAt(error) === void 0 ? Effect.void : answerFailed(error);
|
|
23
20
|
/** A walk stopped by its allotment's refusal, which its caller answers. */
|
|
24
21
|
var WalkRefused = class extends Schema.TaggedError()("WalkRefused", { refusal: Schema.declare(isGitError) }) {
|
|
25
22
|
/**
|
|
@@ -150,38 +147,37 @@ var OpenParses = class {
|
|
|
150
147
|
* it once: when it won't, the tree as it was, its entries read from its bytes on each pass, and
|
|
151
148
|
* the walk never refused for them.
|
|
152
149
|
*/
|
|
153
|
-
const keptParsed =
|
|
154
|
-
if (tree.entries !== void 0) return tree;
|
|
150
|
+
const keptParsed = (tree, allotment) => {
|
|
151
|
+
if (tree.entries !== void 0) return Effect.succeed(tree);
|
|
155
152
|
const entries = parsedOf(tree.bytes);
|
|
156
153
|
const cost = entries.length * 128;
|
|
157
|
-
|
|
158
|
-
if ((answer instanceof Promise ? await answer : answer) !== void 0) return tree;
|
|
159
|
-
return {
|
|
154
|
+
return Effect.map(grownBy(allotment, cost), (refused) => refused !== void 0 ? tree : {
|
|
160
155
|
bytes: tree.bytes,
|
|
161
156
|
entries,
|
|
162
157
|
charged: tree.charged + cost
|
|
163
|
-
};
|
|
158
|
+
});
|
|
164
159
|
};
|
|
165
160
|
/**
|
|
166
161
|
* Whether an entry is a folder, by its mode's type bits, as Git and receive's fsck read it: a
|
|
167
162
|
* folder written `40755` is one, and its files are walked.
|
|
168
163
|
*/
|
|
169
164
|
const isFolder = (entry) => entry !== void 0 && (entry.mode & typeBits) === folderType;
|
|
170
|
-
/**
|
|
171
|
-
|
|
165
|
+
/**
|
|
166
|
+
* A tree's bytes, the empty tree's none: `DATA_LOSS` for one the repo doesn't have. A read's
|
|
167
|
+
* refusal past a call bound stops the walk as the defect it is.
|
|
168
|
+
*/
|
|
169
|
+
const treeBytes = /* @__PURE__ */ Effect.fnUntraced(function* (read, oid, signal) {
|
|
172
170
|
if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") return /* @__PURE__ */ new Uint8Array();
|
|
173
|
-
const
|
|
171
|
+
const object = yield* Effect.catch(read({
|
|
174
172
|
oid,
|
|
175
173
|
signal
|
|
176
|
-
});
|
|
177
|
-
if (found.kind === "error") throw failedWith(found.error);
|
|
178
|
-
const object = found.value;
|
|
174
|
+
}), answerFailed);
|
|
179
175
|
if (object?.type !== "tree") {
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
yield* Effect.promise(async () => object?.bytes.cancel().catch(() => void 0));
|
|
177
|
+
return yield* Effect.fail(gitError("DATA_LOSS", `${oid} isn't a tree in the repo`));
|
|
182
178
|
}
|
|
183
|
-
return new Uint8Array(
|
|
184
|
-
};
|
|
179
|
+
return new Uint8Array(yield* Effect.promise(() => new Response(object.bytes).bytes()));
|
|
180
|
+
});
|
|
185
181
|
const decoder = new TextDecoder("utf-8", {
|
|
186
182
|
fatal: true,
|
|
187
183
|
ignoreBOM: true
|
|
@@ -279,28 +275,29 @@ var Ahead = class {
|
|
|
279
275
|
* A batch that fails, past that bound or past the allotment, reads nothing more ahead: each
|
|
280
276
|
* tree is read on its own when the walk opens it, which answers any error of the tree's own.
|
|
281
277
|
*/
|
|
282
|
-
|
|
278
|
+
read(oids) {
|
|
283
279
|
const { objects, signal, allotment } = this.#input;
|
|
284
|
-
if (objects === void 0 || this.#full) return;
|
|
280
|
+
if (objects === void 0 || this.#full) return Effect.void;
|
|
285
281
|
const asked = [...new Set(oids.filter((oid) => oid !== "4b825dc642cb6eb9a060e54bf8d69288fbee4904" && !this.#held.has(oid)))].slice(0, objectsReadMost);
|
|
286
|
-
if (asked.length === 0) return;
|
|
282
|
+
if (asked.length === 0) return Effect.void;
|
|
287
283
|
const within = this.#within(allotment);
|
|
288
|
-
|
|
284
|
+
return Effect.matchEffect(objects({
|
|
289
285
|
oids: asked,
|
|
290
286
|
bytes: within,
|
|
291
287
|
signal
|
|
288
|
+
}), {
|
|
289
|
+
onFailure: (error) => Effect.andThen(stopIfSpent(error), Effect.sync(() => {
|
|
290
|
+
this.#full = true;
|
|
291
|
+
})),
|
|
292
|
+
onSuccess: (read) => Effect.sync(() => {
|
|
293
|
+
if (read.left.length > 0) this.#full = true;
|
|
294
|
+
for (const object of read.objects.values()) if (object.type === "tree") this.#held.set(object.oid, {
|
|
295
|
+
bytes: object.bytes,
|
|
296
|
+
charged: object.bytes.byteLength
|
|
297
|
+
});
|
|
298
|
+
else within.shrink(object.bytes.byteLength);
|
|
299
|
+
})
|
|
292
300
|
});
|
|
293
|
-
if (read.kind === "error") {
|
|
294
|
-
stopIfSpent(read.error);
|
|
295
|
-
this.#full = true;
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
if (read.value.left.length > 0) this.#full = true;
|
|
299
|
-
for (const object of read.value.objects.values()) if (object.type === "tree") this.#held.set(object.oid, {
|
|
300
|
-
bytes: object.bytes,
|
|
301
|
-
charged: object.bytes.byteLength
|
|
302
|
-
});
|
|
303
|
-
else within.shrink(object.bytes.byteLength);
|
|
304
301
|
}
|
|
305
302
|
/**
|
|
306
303
|
* The walk's allotment within what's left of `aheadMost`: a bound inside the walk's allotment,
|
|
@@ -317,7 +314,7 @@ var Ahead = class {
|
|
|
317
314
|
if (refused === void 0) this.#bytes += bytes;
|
|
318
315
|
return refused;
|
|
319
316
|
};
|
|
320
|
-
return answer
|
|
317
|
+
return growWaits(answer) ? Effect.map(answer, granted) : granted(answer);
|
|
321
318
|
},
|
|
322
319
|
shrink: (bytes) => {
|
|
323
320
|
this.#bytes -= bytes;
|
|
@@ -326,62 +323,64 @@ var Ahead = class {
|
|
|
326
323
|
};
|
|
327
324
|
}
|
|
328
325
|
/** The held tree `oid`, its entries parsed and kept within `aheadMost` when there's room. */
|
|
329
|
-
|
|
330
|
-
if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") return emptyOne;
|
|
326
|
+
#parsed(oid) {
|
|
327
|
+
if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") return Effect.succeed(emptyOne);
|
|
331
328
|
const held = this.#held.get(oid);
|
|
332
|
-
if (held === void 0) return void 0;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
329
|
+
if (held === void 0) return Effect.succeed(void 0);
|
|
330
|
+
return Effect.map(keptParsed(held, this.#within(this.#input.allotment)), (kept) => {
|
|
331
|
+
this.#held.set(oid, kept);
|
|
332
|
+
return kept;
|
|
333
|
+
});
|
|
336
334
|
}
|
|
337
335
|
/**
|
|
338
336
|
* Reads the folders below `folders` ahead, a level at a time, each level's trees in one batch,
|
|
339
337
|
* until a level is read or `aheadMost` is full: a folder whose trees didn't all come is left
|
|
340
338
|
* for the walk to read when it opens it.
|
|
341
339
|
*/
|
|
342
|
-
|
|
343
|
-
if (this.#input.objects === void 0) return;
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
340
|
+
below(folders) {
|
|
341
|
+
if (this.#input.objects === void 0) return Effect.void;
|
|
342
|
+
return Effect.gen({ self: this }, function* () {
|
|
343
|
+
const once = (into, seen, folder) => {
|
|
344
|
+
const key = keyOf(folder);
|
|
345
|
+
if (seen.has(key)) return;
|
|
346
|
+
seen.add(key);
|
|
347
|
+
into.push(folder);
|
|
348
|
+
};
|
|
349
|
+
let level = [];
|
|
350
|
+
const first = /* @__PURE__ */ new Set();
|
|
351
|
+
for (const folder of folders) once(level, first, folder);
|
|
352
|
+
while (level.length > 0 && !this.#full) {
|
|
353
|
+
yield* this.read(level.flatMap((folder) => [folder.head, ...folder.parents]));
|
|
354
|
+
const next = [];
|
|
355
|
+
const seen = /* @__PURE__ */ new Set();
|
|
356
|
+
for (const folder of level) {
|
|
357
|
+
const known = this.#below.get(keyOf(folder));
|
|
358
|
+
if (known !== void 0) {
|
|
359
|
+
for (const below of known.folders) once(next, seen, below);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
const own = yield* this.#parsed(folder.head);
|
|
363
|
+
const sides = [];
|
|
364
|
+
for (const parent of folder.parents) {
|
|
365
|
+
const side = yield* this.#parsed(parent);
|
|
366
|
+
if (side !== void 0) sides.push(side);
|
|
367
|
+
}
|
|
368
|
+
if (own === void 0 || sides.length < folder.parents.length) continue;
|
|
369
|
+
const below = foldersOf(own, sides);
|
|
370
|
+
const charged = below.reduce((sum, each) => sum + folderBytes(each), 0);
|
|
371
|
+
if ((yield* grownBy(this.#within(this.#input.allotment), charged)) !== void 0) {
|
|
372
|
+
this.#full = true;
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
this.#below.set(keyOf(folder), {
|
|
376
|
+
folders: below,
|
|
377
|
+
charged
|
|
378
|
+
});
|
|
379
|
+
for (const each of below) once(next, seen, each);
|
|
376
380
|
}
|
|
377
|
-
|
|
378
|
-
folders: below,
|
|
379
|
-
charged
|
|
380
|
-
});
|
|
381
|
-
for (const each of below) once(next, seen, each);
|
|
381
|
+
level = next;
|
|
382
382
|
}
|
|
383
|
-
|
|
384
|
-
}
|
|
383
|
+
});
|
|
385
384
|
}
|
|
386
385
|
/**
|
|
387
386
|
* The tree `oid`, read ahead, moved from what's held ahead to what the walk has open: its bytes
|
|
@@ -426,26 +425,51 @@ var Ahead = class {
|
|
|
426
425
|
};
|
|
427
426
|
/** A read ahead's refusal past `aheadMost`, which reads nothing ahead. */
|
|
428
427
|
const aheadFull = /* @__PURE__ */ gitError("RESOURCE_EXHAUSTED", "The walk's trees read ahead pass their bound", { context: { reason: "diff-limit" } });
|
|
429
|
-
/**
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
428
|
+
/**
|
|
429
|
+
* Each path under `head` differing from every one of `parents`', as `CombinedInput` says: each
|
|
430
|
+
* handed on as it's pulled, before the walk reads on.
|
|
431
|
+
*/
|
|
432
|
+
const combinedPaths = (input) => input.order === "level" ? levelPaths(input) : depthPaths(input);
|
|
433
|
+
/**
|
|
434
|
+
* The depth walk: the folders open on its path a stack, the deepest on top, each path pulled
|
|
435
|
+
* from the top's steps and each folder it comes to opened above it. However it ends, each folder
|
|
436
|
+
* still open is closed, the deepest first, and what was read ahead goes back.
|
|
437
|
+
*/
|
|
438
|
+
const depthPaths = (input) => Stream.suspend(() => {
|
|
439
|
+
const walking = {
|
|
440
|
+
ahead: new Ahead(input),
|
|
441
|
+
parses: new OpenParses()
|
|
442
|
+
};
|
|
443
|
+
const path = [];
|
|
444
|
+
let started = false;
|
|
445
|
+
const next = Effect.gen(function* () {
|
|
446
|
+
if (!started) {
|
|
447
|
+
started = true;
|
|
448
|
+
yield* walking.ahead.read([input.head, ...input.parents]);
|
|
449
|
+
path.push(yield* opening(input, walking, input.head, input.parents, void 0));
|
|
450
|
+
}
|
|
451
|
+
for (let top = path.at(-1); top !== void 0; top = path.at(-1)) {
|
|
452
|
+
const step = top.steps.next();
|
|
453
|
+
if (step.done === true) {
|
|
454
|
+
path.pop();
|
|
455
|
+
top.close();
|
|
456
|
+
} else if ("change" in step.value) return [step.value.change, void 0];
|
|
457
|
+
else {
|
|
458
|
+
const { folder, path: at } = step.value;
|
|
459
|
+
path.push(yield* opening(input, walking, folder.head, folder.parents, at));
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
return Stream.unfold(void 0, () => next).pipe(Stream.ensuring(Effect.sync(() => {
|
|
464
|
+
for (let top = path.pop(); top !== void 0; top = path.pop()) top.close();
|
|
465
|
+
walking.ahead.release();
|
|
466
|
+
})));
|
|
467
|
+
});
|
|
468
|
+
/**
|
|
469
|
+
* Opens one folder's trees, the commit's and each parent's, for the depth walk: what they take is
|
|
470
|
+
* given back by the answer's `close`, or at once if the folder fails to open.
|
|
471
|
+
*/
|
|
472
|
+
const opening = (input, walking, head, parents, prefix) => {
|
|
449
473
|
const { allotment, read, signal } = input;
|
|
450
474
|
const { ahead, parses } = walking;
|
|
451
475
|
let taken = 0;
|
|
@@ -467,49 +491,50 @@ async function* differing(input, walking, head, parents, prefix) {
|
|
|
467
491
|
}
|
|
468
492
|
return freed;
|
|
469
493
|
});
|
|
470
|
-
const
|
|
494
|
+
const close = () => {
|
|
495
|
+
unhold();
|
|
496
|
+
allotment.shrink(taken);
|
|
497
|
+
taken = 0;
|
|
498
|
+
};
|
|
499
|
+
const opened = Effect.fnUntraced(function* (oid) {
|
|
471
500
|
if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") return emptyOne;
|
|
472
501
|
const held = ahead.take(oid);
|
|
473
502
|
if (held !== void 0) {
|
|
474
503
|
taken += held.charged;
|
|
475
504
|
return held;
|
|
476
505
|
}
|
|
477
|
-
const bytes =
|
|
478
|
-
|
|
479
|
-
let refused = asked instanceof Promise ? await asked : asked;
|
|
506
|
+
const bytes = yield* treeBytes(read, oid, signal);
|
|
507
|
+
let refused = yield* grownBy(allotment, bytes.length);
|
|
480
508
|
if (refused !== void 0) {
|
|
481
509
|
const readAhead = ahead.holds();
|
|
482
510
|
ahead.release();
|
|
483
|
-
if (parses.letGo() > 0 || readAhead)
|
|
484
|
-
const again = allotment.grow(bytes.length);
|
|
485
|
-
refused = again instanceof Promise ? await again : again;
|
|
486
|
-
}
|
|
511
|
+
if (parses.letGo() > 0 || readAhead) refused = yield* grownBy(allotment, bytes.length);
|
|
487
512
|
}
|
|
488
|
-
if (refused !== void 0)
|
|
513
|
+
if (refused !== void 0) return yield* Effect.fail(new WalkRefused({ refusal: refused }));
|
|
489
514
|
taken += bytes.length;
|
|
490
|
-
const tree =
|
|
515
|
+
const tree = yield* keptParsed({
|
|
491
516
|
bytes,
|
|
492
517
|
charged: bytes.length
|
|
493
518
|
}, allotment);
|
|
494
519
|
taken += tree.charged - bytes.length;
|
|
495
520
|
return tree;
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
trees.push(
|
|
499
|
-
for (const parent of parents) trees.push(
|
|
521
|
+
});
|
|
522
|
+
return Effect.gen(function* () {
|
|
523
|
+
trees.push(yield* opened(head));
|
|
524
|
+
for (const parent of parents) trees.push(yield* opened(parent));
|
|
500
525
|
const [own = emptyOne, ...sides] = trees;
|
|
501
|
-
|
|
526
|
+
yield* ahead.below(ahead.foldersBelow({
|
|
502
527
|
head,
|
|
503
528
|
parents
|
|
504
529
|
}) ?? foldersOf(own, sides));
|
|
505
530
|
for (const tree of trees) cursors.push(cursorOf(tree));
|
|
506
531
|
const [ownCursor, ...sideCursors] = cursors;
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
}
|
|
532
|
+
return {
|
|
533
|
+
steps: ownCursor === void 0 ? [][Symbol.iterator]() : stepsIn(ownCursor, sideCursors, prefix),
|
|
534
|
+
close
|
|
535
|
+
};
|
|
536
|
+
}).pipe(Effect.onError(() => Effect.sync(close)));
|
|
537
|
+
};
|
|
513
538
|
/**
|
|
514
539
|
* The steps of one folder, its trees open, the commit's and each parent's beside it, one at a
|
|
515
540
|
* time: what both orders walk, `depth` as each comes and `level` a level at a time.
|
|
@@ -532,11 +557,6 @@ function* stepsIn(own, sides, prefix) {
|
|
|
532
557
|
} else yield { change: changeOf(path, entry, beside[0] === void 0 || isFolder(beside[0])) };
|
|
533
558
|
}
|
|
534
559
|
}
|
|
535
|
-
/** `differing`'s walk of one folder, depth first: each path as it comes, each folder in turn. */
|
|
536
|
-
async function* differingIn(input, walking, own, sides, prefix) {
|
|
537
|
-
for (const step of stepsIn(own, sides, prefix)) if ("change" in step) yield step.change;
|
|
538
|
-
else yield* differing(input, walking, step.folder.head, step.folder.parents, step.path);
|
|
539
|
-
}
|
|
540
560
|
/**
|
|
541
561
|
* What a path the level walk holds until it ends takes, charged to its allotment: about what V8
|
|
542
562
|
* keeps for the change, its mode, its ID and its path's text.
|
|
@@ -547,85 +567,81 @@ function* flattened(slot) {
|
|
|
547
567
|
else yield item;
|
|
548
568
|
}
|
|
549
569
|
/** `bytes` more of `allotment`, or the walk refused as it answers. */
|
|
550
|
-
const grownOrRefused =
|
|
551
|
-
const answer = allotment.grow(bytes);
|
|
552
|
-
const refused = answer instanceof Promise ? await answer : answer;
|
|
553
|
-
if (refused !== void 0) throw new WalkRefused({ refusal: refused });
|
|
554
|
-
};
|
|
570
|
+
const grownOrRefused = (allotment, bytes) => Effect.flatMap(grownBy(allotment, bytes), (refused) => refused === void 0 ? Effect.void : Effect.fail(new WalkRefused({ refusal: refused })));
|
|
555
571
|
/**
|
|
556
572
|
* The trees of one level, its folders' and their parents', read in batches as far as the
|
|
557
573
|
* allotment holds them, then one at a time, each charged: refused only for a tree that won't fit
|
|
558
574
|
* on its own beside what the walk holds. A level that fails part-way, refused, a read failed or
|
|
559
|
-
*
|
|
575
|
+
* interrupted, gives back what it charged, since its caller shrinks only the trees of a level it
|
|
576
|
+
* got.
|
|
560
577
|
*/
|
|
561
|
-
const levelTrees =
|
|
578
|
+
const levelTrees = (input, oids) => {
|
|
562
579
|
const { allotment, objects, read, signal } = input;
|
|
563
580
|
const trees = /* @__PURE__ */ new Map([[emptyTree, emptyOne]]);
|
|
564
581
|
const asked = [...new Set(oids.filter((oid) => oid !== emptyTree))];
|
|
565
|
-
|
|
566
|
-
|
|
582
|
+
return Effect.gen(function* () {
|
|
583
|
+
let left = asked;
|
|
567
584
|
while (objects !== void 0 && left.length > 0) {
|
|
568
|
-
const
|
|
569
|
-
|
|
585
|
+
const batch = left.slice(0, objectsReadMost);
|
|
586
|
+
const answer = yield* Effect.result(objects({
|
|
587
|
+
oids: batch,
|
|
570
588
|
bytes: allotment,
|
|
571
589
|
signal
|
|
572
|
-
});
|
|
573
|
-
if (answer
|
|
574
|
-
stopIfSpent(answer.
|
|
590
|
+
}));
|
|
591
|
+
if (Result.isFailure(answer)) {
|
|
592
|
+
yield* stopIfSpent(answer.failure);
|
|
575
593
|
break;
|
|
576
594
|
}
|
|
577
|
-
for (const object of answer.
|
|
595
|
+
for (const object of answer.success.objects.values()) trees.set(object.oid, {
|
|
578
596
|
bytes: object.bytes,
|
|
579
597
|
charged: object.bytes.byteLength
|
|
580
598
|
});
|
|
581
|
-
left = [...answer.
|
|
582
|
-
if (answer.
|
|
599
|
+
left = [...answer.success.left, ...left.slice(objectsReadMost)];
|
|
600
|
+
if (answer.success.objects.size === 0) break;
|
|
583
601
|
}
|
|
584
602
|
for (const oid of asked) {
|
|
585
603
|
if (trees.has(oid)) continue;
|
|
586
|
-
const bytes =
|
|
587
|
-
|
|
604
|
+
const bytes = yield* treeBytes(read, oid, signal);
|
|
605
|
+
yield* grownOrRefused(allotment, bytes.length);
|
|
588
606
|
trees.set(oid, {
|
|
589
607
|
bytes,
|
|
590
608
|
charged: bytes.length
|
|
591
609
|
});
|
|
592
610
|
}
|
|
593
|
-
|
|
611
|
+
return trees;
|
|
612
|
+
}).pipe(Effect.onError(() => Effect.sync(() => {
|
|
594
613
|
for (const tree of trees.values()) allotment.shrink(tree.charged);
|
|
595
|
-
|
|
596
|
-
}
|
|
597
|
-
return trees;
|
|
614
|
+
})));
|
|
598
615
|
};
|
|
599
616
|
/** `combinedPaths` a level at a time, as `CombinedInput.order` says. */
|
|
600
|
-
|
|
617
|
+
const levelPaths = (input) => Stream.suspend(() => {
|
|
601
618
|
const { allotment } = input;
|
|
602
|
-
const root = { items: [] };
|
|
603
|
-
let level = [{
|
|
604
|
-
folder: {
|
|
605
|
-
head: input.head,
|
|
606
|
-
parents: input.parents
|
|
607
|
-
},
|
|
608
|
-
prefix: void 0,
|
|
609
|
-
slot: root
|
|
610
|
-
}];
|
|
611
619
|
let held = 0;
|
|
612
|
-
const hold =
|
|
613
|
-
await grownOrRefused(allotment, bytes);
|
|
620
|
+
const hold = (bytes) => Effect.map(grownOrRefused(allotment, bytes), () => {
|
|
614
621
|
held += bytes;
|
|
615
|
-
};
|
|
616
|
-
|
|
622
|
+
});
|
|
623
|
+
const walked = Effect.gen(function* () {
|
|
624
|
+
const root = { items: [] };
|
|
625
|
+
let level = [{
|
|
626
|
+
folder: {
|
|
627
|
+
head: input.head,
|
|
628
|
+
parents: input.parents
|
|
629
|
+
},
|
|
630
|
+
prefix: void 0,
|
|
631
|
+
slot: root
|
|
632
|
+
}];
|
|
617
633
|
while (level.length > 0) {
|
|
618
|
-
const trees =
|
|
634
|
+
const trees = yield* levelTrees(input, level.flatMap(({ folder }) => [folder.head, ...folder.parents]));
|
|
619
635
|
const next = [];
|
|
620
|
-
|
|
636
|
+
yield* Effect.gen(function* () {
|
|
621
637
|
for (const { folder, prefix, slot } of level) {
|
|
622
638
|
const own = trees.get(folder.head) ?? emptyOne;
|
|
623
639
|
const sides = folder.parents.map((oid) => trees.get(oid) ?? emptyOne);
|
|
624
640
|
for (const step of stepsIn(cursorOf(own), sides.map(cursorOf), prefix)) if ("change" in step) {
|
|
625
|
-
|
|
641
|
+
yield* hold(changeBytes(step.change));
|
|
626
642
|
slot.items.push(step.change);
|
|
627
643
|
} else {
|
|
628
|
-
|
|
644
|
+
yield* hold(folderBytes(step.folder));
|
|
629
645
|
const below = { items: [] };
|
|
630
646
|
slot.items.push(below);
|
|
631
647
|
next.push({
|
|
@@ -635,14 +651,13 @@ async function* levelPaths(input) {
|
|
|
635
651
|
});
|
|
636
652
|
}
|
|
637
653
|
}
|
|
638
|
-
}
|
|
654
|
+
}).pipe(Effect.ensuring(Effect.sync(() => {
|
|
639
655
|
for (const tree of trees.values()) allotment.shrink(tree.charged);
|
|
640
|
-
}
|
|
656
|
+
})));
|
|
641
657
|
level = next;
|
|
642
658
|
}
|
|
643
|
-
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
659
|
+
return Stream.fromIterable(flattened(root));
|
|
660
|
+
});
|
|
661
|
+
return Stream.unwrap(walked).pipe(Stream.ensuring(Effect.sync(() => allotment.shrink(held))));
|
|
662
|
+
});
|
|
648
663
|
export { WalkRefused, changeBytes, combinedPaths, folderBytes };
|
package/dist/engine/content.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isBinary } from "../protocol/diff/text.mjs";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
2
|
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
4
|
// src/engine/content.ts
|
|
5
5
|
const attributeSet = { state: "set" };
|
|
6
6
|
const attributeUnset = { state: "unset" };
|
package/dist/engine/merge.mjs
CHANGED
|
@@ -914,15 +914,13 @@ var TreeMerge = class {
|
|
|
914
914
|
return false;
|
|
915
915
|
});
|
|
916
916
|
};
|
|
917
|
-
/** The objects a merge made, each
|
|
918
|
-
const writesOf = (made) => ({
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
};
|
|
925
|
-
} });
|
|
917
|
+
/** The objects a merge made, each as a stream of its bytes. */
|
|
918
|
+
const writesOf = (made) => Array.from(made, ([oid, { type, bytes }]) => ({
|
|
919
|
+
oid,
|
|
920
|
+
type,
|
|
921
|
+
size: bytes.length,
|
|
922
|
+
bytes: streamOf(bytes)
|
|
923
|
+
}));
|
|
926
924
|
/** `read`, though an object the call's merges made is read from them. */
|
|
927
925
|
const knownFirst = (known, read) => (oid) => {
|
|
928
926
|
const made = known.get(oid);
|
package/dist/engine/reads.d.mts
CHANGED