@ref0/git 0.20.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/private-refs.mjs +1 -1
- package/dist/auth/access-jwt.mjs +3 -3
- package/dist/auth/auth-namespace.d.mts +3 -3
- package/dist/auth/auth-namespace.mjs +3 -2
- package/dist/auth/auth.d.mts +3 -3
- package/dist/auth/auth.mjs +9 -8
- package/dist/auth/authorize.mjs +1 -1
- package/dist/auth/fences.d.mts +1 -1
- package/dist/auth/host-function.mjs +1 -1
- package/dist/auth/host-services.mjs +4 -6
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +6 -0
- package/dist/auth/token-cleanup.mjs +2 -2
- package/dist/auth/token-rows.mjs +6 -1
- package/dist/auth/token-text.mjs +1 -1
- package/dist/auth/tokens-base.d.mts +1 -1
- package/dist/auth/tokens.d.mts +1 -1
- package/dist/auth/tokens.mjs +1 -1
- package/dist/client/client.d.mts +15 -7
- package/dist/client/client.mjs +21 -12
- package/dist/client/git-http.mjs +1 -1
- package/dist/client/local.mjs +60 -24
- package/dist/client/negotiate.mjs +3 -3
- package/dist/client/push-upload.mjs +26 -10
- package/dist/client/remote.mjs +4 -3
- package/dist/client/run-remote-helper.d.mts +2 -2
- package/dist/client/run-remote-helper.mjs +6 -6
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +3 -3
- package/dist/contracts/blobs.d.mts +3 -3
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/calls-spent.mjs +5 -33
- package/dist/contracts/client.d.mts +15 -14
- package/dist/contracts/commits.d.mts +4 -4
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +2 -2
- package/dist/contracts/events.d.mts +1 -1
- package/dist/contracts/events.mjs +1 -1
- package/dist/contracts/files.d.mts +4 -4
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +4 -4
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-hooks.d.mts +1 -1
- package/dist/contracts/git.d.mts +9 -5
- package/dist/contracts/grants.d.mts +1 -1
- package/dist/contracts/merges.d.mts +1 -1
- package/dist/contracts/object-values.d.mts +1 -0
- package/dist/contracts/object-values.mjs +16 -1
- package/dist/contracts/objects.d.mts +20 -17
- package/dist/contracts/opaque.mjs +1 -1
- package/dist/contracts/operations.mjs +1 -1
- package/dist/contracts/queue.d.mts +208 -44
- package/dist/contracts/queue.mjs +5 -5
- package/dist/contracts/refs.d.mts +5 -5
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +3 -6
- package/dist/contracts/repos.d.mts +3 -3
- package/dist/contracts/repos.mjs +1 -1
- package/dist/contracts/result.d.mts +10 -7
- package/dist/contracts/result.mjs +8 -3
- package/dist/contracts/rules.d.mts +2 -2
- package/dist/contracts/server.d.mts +8 -10
- package/dist/contracts/services.d.mts +6 -9
- package/dist/contracts/services.mjs +1 -2
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/store.d.mts +2 -2
- package/dist/contracts/sync.d.mts +63 -6
- package/dist/contracts/sync.mjs +3 -2
- package/dist/contracts/tags.d.mts +3 -3
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/tokens.d.mts +2 -2
- package/dist/contracts/tokens.mjs +1 -1
- package/dist/contracts/topics.d.mts +9 -9
- package/dist/contracts/trees.d.mts +4 -4
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +4 -4
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +1 -1
- package/dist/core/ancestry.mjs +30 -34
- package/dist/core/{promise.mjs → call-groups.mjs} +7 -30
- package/dist/core/call-services.mjs +1 -1
- package/dist/core/events/deliver.d.mts +2 -2
- package/dist/core/events/deliver.mjs +3 -3
- package/dist/core/events/retired.mjs +1 -1
- package/dist/core/forks.mjs +5 -5
- package/dist/core/hooks/groups.mjs +2 -2
- package/dist/core/imports.mjs +101 -21
- package/dist/core/index-job.mjs +14 -9
- package/dist/core/index-lost.d.mts +1 -1
- package/dist/core/loose-tally.mjs +38 -15
- package/dist/core/merge-parts.d.mts +17 -4
- package/dist/core/merge-parts.mjs +7 -2
- package/dist/core/mirror-rows.mjs +31 -1
- package/dist/core/objects/blobs.mjs +8 -10
- package/dist/core/objects/files.mjs +20 -17
- package/dist/core/objects/objects-layer.mjs +1 -1
- package/dist/core/objects/peel.mjs +1 -7
- package/dist/core/objects/reading.mjs +19 -18
- package/dist/core/objects/tree-edits.mjs +1 -1
- package/dist/core/objects/trees.mjs +257 -58
- package/dist/core/objects/writing.mjs +3 -9
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +8 -1
- package/dist/core/parts.mjs +8 -4
- package/dist/core/purge.mjs +31 -18
- package/dist/core/push.d.mts +2 -2
- package/dist/core/push.mjs +125 -94
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +9 -2
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +74 -31
- package/dist/core/refs.mjs +3 -3
- package/dist/core/repack.mjs +25 -30
- package/dist/core/repo-info.mjs +1 -1
- package/dist/core/repos.mjs +1 -1
- package/dist/core/rules/changes.mjs +18 -40
- package/dist/core/rules/check.mjs +6 -5
- package/dist/core/rules/commit-changes.mjs +3 -15
- package/dist/core/rules/context.d.mts +3 -3
- package/dist/core/rules/context.mjs +18 -14
- package/dist/core/rules/fetch.mjs +1 -1
- package/dist/core/rules/protect.mjs +30 -17
- package/dist/core/saved-caller-views.d.mts +1 -1
- package/dist/core/saved-caller-views.mjs +3 -3
- package/dist/core/saved-callers.d.mts +1 -1
- package/dist/core/saved-callers.mjs +1 -1
- package/dist/core/seam.d.mts +1 -2
- package/dist/core/view.d.mts +6 -3
- package/dist/core/view.mjs +11 -10
- package/dist/core/work.mjs +2 -2
- package/dist/engine/allotted-xdiff.mjs +3 -16
- package/dist/engine/combined.d.mts +3 -0
- package/dist/engine/combined.mjs +200 -185
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/merge.mjs +7 -9
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +22 -14
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +1 -1
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +2 -2
- package/dist/event-streams/stream.mjs +3 -3
- package/dist/extend.d.mts +2 -6
- package/dist/extend.mjs +1 -5
- package/dist/http/core-parts.mjs +83 -26
- package/dist/http/handler.mjs +54 -9
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +138 -24
- package/dist/http/push-uploads.mjs +2 -2
- package/dist/http/receive-pack.mjs +14 -53
- package/dist/http/request-snapshot.mjs +258 -0
- package/dist/http/upload-pack.mjs +23 -18
- package/dist/index.d.mts +29 -21
- package/dist/index.mjs +11 -2
- package/dist/lfs/base.d.mts +1 -1
- package/dist/lfs/copy.d.mts +49 -1
- package/dist/lfs/copy.mjs +135 -22
- package/dist/lfs/layer.d.mts +4 -3
- package/dist/lfs/layer.mjs +4 -5
- package/dist/lfs/locks.mjs +2 -2
- package/dist/lfs/objects.d.mts +1 -1
- package/dist/lfs/objects.mjs +3 -3
- package/dist/lfs/pointers.mjs +1 -1
- package/dist/lfs/rows.d.mts +1 -1
- package/dist/lfs/rows.mjs +11 -4
- package/dist/lfs/upkeep.mjs +40 -9
- package/dist/lfs/uploaded.mjs +1 -1
- package/dist/lfs/wire.mjs +1 -1
- package/dist/merges/merges.mjs +17 -2
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +1 -1
- package/dist/protocol/bytes/deflate.d.mts +1 -1
- package/dist/protocol/bytes/deflate.mjs +1 -1
- package/dist/protocol/bytes/inflate.d.mts +1 -1
- package/dist/protocol/bytes/inflate.mjs +1 -1
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +1 -1
- package/dist/protocol/diff/read.d.mts +2 -1
- package/dist/protocol/diff/read.mjs +102 -8
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +1 -1
- package/dist/protocol/packs/idx.mjs +1 -1
- package/dist/protocol/packs/parts.mjs +1 -1
- package/dist/protocol/packs/reader.d.mts +1 -1
- package/dist/protocol/packs/reader.mjs +1 -1
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +1 -1
- package/dist/protocol/packs/writer.mjs +3 -3
- package/dist/protocol/wire/advertisement.d.mts +1 -1
- package/dist/protocol/wire/advertisement.mjs +3 -2
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +9 -1
- package/dist/protocol/wire/lines.mjs +28 -1
- package/dist/protocol/wire/push-uploads.mjs +10 -7
- package/dist/protocol/wire/receive-pack.d.mts +1 -1
- package/dist/protocol/wire/receive-pack.mjs +1 -1
- package/dist/protocol/wire/report-status.d.mts +1 -1
- package/dist/protocol/wire/report-status.mjs +1 -1
- package/dist/protocol/wire/v2.d.mts +1 -1
- package/dist/protocol/wire/v2.mjs +1 -1
- package/dist/queue/advance.mjs +31 -24
- package/dist/queue/base.d.mts +5 -3
- package/dist/queue/calls.mjs +5 -5
- package/dist/queue/commit.mjs +1 -1
- package/dist/queue/host.d.mts +1 -1
- package/dist/queue/layer.d.mts +0 -1
- package/dist/queue/layer.mjs +9 -5
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +1 -1
- package/dist/queue/state.mjs +1 -1
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/client.d.mts +1 -1
- package/dist/rest/client.mjs +6 -6
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/handler.mjs +2 -2
- package/dist/rest/handlers.mjs +16 -6
- package/dist/rest/layer.mjs +1 -1
- package/dist/rest/listen.mjs +2 -2
- package/dist/rest/refs.mjs +1 -1
- package/dist/server/edge.mjs +27 -3
- package/dist/server/git-layer.d.mts +1 -2
- package/dist/server/git-layer.mjs +4 -5
- package/dist/server/lifecycle.mjs +1 -1
- package/dist/server/registry.mjs +2 -8
- package/dist/server/server.mjs +62 -43
- package/dist/signin/context.d.mts +1 -1
- package/dist/signin/context.mjs +1 -1
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -2
- package/dist/signin/grants.mjs +1 -1
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/allotted.mjs +4 -9
- package/dist/storage/batch-upkeep.mjs +31 -12
- package/dist/storage/batches.d.mts +2 -3
- package/dist/storage/batches.mjs +52 -49
- package/dist/storage/budget.mjs +23 -1
- package/dist/storage/calls.d.mts +1 -1
- package/dist/storage/calls.mjs +41 -43
- package/dist/storage/charged-cache.mjs +180 -0
- package/dist/storage/chunks.d.mts +3 -3
- package/dist/storage/chunks.mjs +121 -8
- package/dist/storage/counted-bucket.mjs +32 -10
- package/dist/storage/fetch-row-cache.d.mts +6 -0
- package/dist/storage/fetch-row-cache.mjs +211 -0
- package/dist/storage/fetch.d.mts +1 -0
- package/dist/storage/fetch.mjs +54 -242
- package/dist/storage/held-types.d.mts +0 -1
- package/dist/storage/host-bucket.mjs +9 -4
- package/dist/storage/index-bitmaps.mjs +77 -49
- package/dist/storage/index-build.d.mts +2 -3
- package/dist/storage/index-build.mjs +248 -48
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +60 -21
- package/dist/storage/index-graph.mjs +1 -1
- package/dist/storage/index-layers.mjs +55 -25
- package/dist/storage/index-reach.mjs +15 -22
- package/dist/storage/index-whole.d.mts +7 -0
- package/dist/storage/index-whole.mjs +145 -37
- package/dist/storage/largest-files.mjs +1 -7
- package/dist/storage/layout.mjs +17 -1
- package/dist/storage/lfs-pointers.mjs +1 -6
- package/dist/storage/link-join.mjs +55 -16
- package/dist/storage/list-source.d.mts +7 -0
- package/dist/storage/list-source.mjs +288 -0
- package/dist/storage/loose.d.mts +8 -8
- package/dist/storage/loose.mjs +157 -91
- package/dist/storage/memory-budget.mjs +226 -22
- package/dist/storage/merge-cut.mjs +9 -6
- package/dist/storage/merge-fence.mjs +1 -1
- package/dist/storage/merge-row.mjs +1 -1
- package/dist/storage/merge.d.mts +2 -3
- package/dist/storage/merge.mjs +2 -2
- package/dist/storage/object-rows.d.mts +3 -3
- package/dist/storage/object-rows.mjs +179 -38
- package/dist/storage/pack-order.mjs +97 -44
- package/dist/storage/pack-ranges.mjs +44 -16
- package/dist/storage/pack-reads.d.mts +5 -3
- package/dist/storage/pack-reads.mjs +236 -72
- package/dist/storage/pack-receive.d.mts +1 -2
- package/dist/storage/pack-receive.mjs +21 -17
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +477 -116
- package/dist/storage/placed-reads.mjs +33 -16
- package/dist/storage/prune-seen.mjs +1 -1
- package/dist/storage/prune-walk.mjs +1 -1
- package/dist/storage/prune.mjs +4 -31
- package/dist/storage/push-allotment.mjs +26 -14
- package/dist/storage/push-uploads.mjs +195 -57
- package/dist/storage/pushed-commits.mjs +20 -1
- package/dist/storage/quarantine.d.mts +2 -3
- package/dist/storage/range-cache.mjs +175 -40
- package/dist/storage/raw-ids.mjs +39 -10
- package/dist/storage/ready.d.mts +2 -3
- package/dist/storage/ready.mjs +114 -38
- package/dist/storage/receive-bounds.mjs +31 -9
- package/dist/storage/receive-cache.d.mts +7 -0
- package/dist/storage/receive-cache.mjs +147 -0
- package/dist/storage/receive-files.mjs +1 -1
- package/dist/storage/receive-links.mjs +1 -1
- package/dist/storage/receive-state.d.mts +2 -2
- package/dist/storage/receive-state.mjs +6 -8
- package/dist/storage/receive-steps.d.mts +20 -0
- package/dist/storage/receive-steps.mjs +298 -13
- package/dist/storage/repack-backlog.mjs +1 -6
- package/dist/storage/repack-contained.mjs +2 -2
- package/dist/storage/repack-job.mjs +1 -1
- package/dist/storage/repack.d.mts +2 -3
- package/dist/storage/repack.mjs +54 -9
- package/dist/storage/request-cache.mjs +57 -0
- package/dist/storage/roots.mjs +1 -24
- package/dist/storage/rows.d.mts +2 -2
- package/dist/storage/rows.mjs +1 -1
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +1 -1
- package/dist/storage/send-list.mjs +62 -25
- package/dist/storage/stream-whole.mjs +84 -63
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +878 -450
- package/dist/storage/visible.mjs +110 -32
- package/dist/storage/walk.mjs +1 -0
- package/dist/storage/wants.mjs +22 -58
- package/dist/store/call-count.d.mts +2 -2
- package/dist/store/call-count.mjs +24 -11
- package/dist/store/catalogue.d.mts +1 -1
- package/dist/store/catalogue.mjs +19 -7
- package/dist/store/crossing.mjs +1 -7
- package/dist/store/cursor-seal.d.mts +1 -1
- package/dist/store/cursor-seal.mjs +1 -1
- package/dist/store/door.mjs +9 -4
- package/dist/store/errors.d.mts +2 -2
- package/dist/store/errors.mjs +107 -19
- package/dist/store/git-store.mjs +7 -2
- package/dist/store/job-try.mjs +90 -9
- package/dist/store/list-job.mjs +10 -34
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +2 -2
- package/dist/store/queue-jobs.mjs +6 -12
- package/dist/store/records.d.mts +2 -2
- package/dist/store/records.mjs +2 -2
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +2 -2
- package/dist/store/repo-record.d.mts +2 -2
- package/dist/store/repo-record.mjs +3 -3
- package/dist/store/request-snapshot.mjs +5 -0
- package/dist/store/reservations.mjs +2 -2
- package/dist/store/topic-jobs.mjs +5 -11
- package/dist/sync/bound.d.mts +3 -3
- package/dist/sync/bound.mjs +10 -7
- package/dist/sync/github.mjs +65 -67
- package/dist/sync/http.mjs +1 -1
- package/dist/sync/import.mjs +201 -66
- package/dist/sync/layer.d.mts +1 -1
- package/dist/sync/layer.mjs +6 -6
- package/dist/sync/lfs-batch.mjs +1 -1
- package/dist/sync/lfs-copy.mjs +175 -15
- package/dist/sync/mirror.mjs +5 -10
- package/dist/sync/said.mjs +1 -1
- package/dist/sync/step.mjs +268 -86
- package/dist/sync/tries.mjs +25 -6
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +3 -3
- package/dist/topics/calls.mjs +1 -1
- package/dist/topics/layer.d.mts +15 -14
- package/dist/topics/members.mjs +1 -1
- package/dist/topics/topic.mjs +1 -1
- package/package.json +3 -13
- package/dist/auth/helpers.mjs +0 -17
- package/dist/auth.d.mts +0 -5
- package/dist/auth.mjs +0 -5
- package/dist/core/rules/commit-changes.d.mts +0 -12
- package/dist/effect.d.mts +0 -9
- package/dist/effect.mjs +0 -7
- package/dist/server/joined.d.mts +0 -70
- package/dist/server/joined.mjs +0 -41
package/dist/lfs/pointers.mjs
CHANGED
|
@@ -10,8 +10,8 @@ import { lfsPointerText } from "../protocol/objects/lfs-pointer.mjs";
|
|
|
10
10
|
import { lfsOidAt, lfsSizeAt, pointersOfBlob } from "../storage/lfs-pointers.mjs";
|
|
11
11
|
import { listedOf } from "./objects.mjs";
|
|
12
12
|
import { uploadedOf } from "./uploaded.mjs";
|
|
13
|
-
import * as Clock from "effect/Clock";
|
|
14
13
|
import * as Effect from "effect/Effect";
|
|
14
|
+
import * as Clock from "effect/Clock";
|
|
15
15
|
// src/lfs/pointers.ts
|
|
16
16
|
/**
|
|
17
17
|
* LFS's push rule: a ref whose new tip holds, in a tree the push carries, a Git LFS pointer the
|
package/dist/lfs/rows.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../contracts/ids.mjs";
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
2
|
import { Key, Moment, Read } from "@ref0/infra";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
4
|
/**
|
|
5
5
|
* A listed object: its bytes are at `key`, checked. A signed upload's are at its upload row's
|
|
6
6
|
* `objectKey`, and a Worker upload's stay at the staging key they streamed to, which only they
|
package/dist/lfs/rows.mjs
CHANGED
|
@@ -69,12 +69,15 @@ const UploadRow = /* @__PURE__ */ Schema.Struct({
|
|
|
69
69
|
});
|
|
70
70
|
/**
|
|
71
71
|
* A staging key, which upkeep deletes at `removeAt` unless a listing names it: a Worker upload's,
|
|
72
|
-
* or an import copy's, which names its `oid`.
|
|
72
|
+
* or an import copy's, which names its `oid`. An import's copy of an object past one step puts it
|
|
73
|
+
* in parts, and `upload` is that multipart upload's token, which upkeep aborts before the delete,
|
|
74
|
+
* so an import that stopped partway leaves no parts the bucket keeps.
|
|
73
75
|
*/
|
|
74
76
|
const StagingRow = /* @__PURE__ */ Schema.Struct({
|
|
75
77
|
key: Schema.String,
|
|
76
78
|
removeAt: Schema.Int,
|
|
77
|
-
oid: Schema.optionalKey(Schema.String)
|
|
79
|
+
oid: Schema.optionalKey(Schema.String),
|
|
80
|
+
upload: Schema.optionalKey(Schema.String)
|
|
78
81
|
});
|
|
79
82
|
/**
|
|
80
83
|
* The key an import's copy of an object put, or will put, its bytes at, its staging row's ID and
|
|
@@ -95,9 +98,13 @@ const CopyRow = /* @__PURE__ */ Schema.Struct({
|
|
|
95
98
|
const streamMost = /* @__PURE__ */ millis("12 hours");
|
|
96
99
|
/**
|
|
97
100
|
* Bytes upkeep is deleting: nothing lists them, since the commit that put the row dropped their
|
|
98
|
-
* upload row or their staging row.
|
|
101
|
+
* upload row or their staging row. With `upload`, a staging row's multipart token, upkeep aborts
|
|
102
|
+
* that upload first. It drops the row once the delete of `key` returns.
|
|
99
103
|
*/
|
|
100
|
-
const EndingRow = /* @__PURE__ */ Schema.Struct({
|
|
104
|
+
const EndingRow = /* @__PURE__ */ Schema.Struct({
|
|
105
|
+
key: Schema.String,
|
|
106
|
+
upload: Schema.optionalKey(Schema.String)
|
|
107
|
+
});
|
|
101
108
|
const LockRow = /* @__PURE__ */ Schema.Struct({
|
|
102
109
|
path: Schema.String,
|
|
103
110
|
/** The actor's ID that holds it. */
|
package/dist/lfs/upkeep.mjs
CHANGED
|
@@ -56,7 +56,7 @@ const upkeepStep = /* @__PURE__ */ Effect.fnUntraced(function* (upkeep) {
|
|
|
56
56
|
id: row.id,
|
|
57
57
|
...decoded
|
|
58
58
|
})));
|
|
59
|
-
if (endings.length > 0) return yield* endObjects(upkeep, snapshot.version, endings);
|
|
59
|
+
if (endings.length > 0) return yield* endObjects(upkeep, snapshot.version, endingsWithin(endings));
|
|
60
60
|
const stages = yield* Effect.forEach(staging, (row) => Effect.map(decodeRow(StagingRow, row, `LFS staging row ${row.id}`), (stage) => ({
|
|
61
61
|
id: row.id,
|
|
62
62
|
...stage
|
|
@@ -76,9 +76,29 @@ const upkeepStep = /* @__PURE__ */ Effect.fnUntraced(function* (upkeep) {
|
|
|
76
76
|
due
|
|
77
77
|
};
|
|
78
78
|
});
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Aborts the multipart upload an ending row names, if any, before its key's delete. Every bucket
|
|
81
|
+
* aborts an upload it no longer holds, completed or aborted already, as one it does, so a failure
|
|
82
|
+
* is the bucket's own: it fails the step, and the row stays for the next to abort again.
|
|
83
|
+
*/
|
|
84
|
+
const abortUpload = (upkeep, row) => row.upload === void 0 ? Effect.void : bucketDo(upkeep.bucket.abortPut(row.key, row.upload));
|
|
85
|
+
/**
|
|
86
|
+
* Of `rows`, the first whose bucket calls, a delete each and `abortPutCalls` for each upload, are
|
|
87
|
+
* at most `upkeepPage`: a step ends no more calls' worth than a page of deletes does.
|
|
88
|
+
*/
|
|
89
|
+
const endingsWithin = (rows) => {
|
|
90
|
+
const taken = [];
|
|
91
|
+
let calls = 0;
|
|
92
|
+
for (const row of rows) {
|
|
93
|
+
calls += 1 + (row.upload === void 0 ? 0 : 3);
|
|
94
|
+
if (calls > upkeepPage) break;
|
|
95
|
+
taken.push(row);
|
|
96
|
+
}
|
|
97
|
+
return taken;
|
|
98
|
+
};
|
|
99
|
+
/** Aborts each ending row's upload, deletes its key, then the row, at `version`. */
|
|
80
100
|
const endObjects = /* @__PURE__ */ Effect.fnUntraced(function* (upkeep, version, rows) {
|
|
81
|
-
yield* Effect.forEach(rows, (row) => bucketDo(upkeep.bucket.remove(row.key)), {
|
|
101
|
+
yield* Effect.forEach(rows, (row) => Effect.andThen(abortUpload(upkeep, row), bucketDo(upkeep.bucket.remove(row.key))), {
|
|
82
102
|
concurrency: 8,
|
|
83
103
|
discard: true
|
|
84
104
|
});
|
|
@@ -104,7 +124,7 @@ const endStages = /* @__PURE__ */ Effect.fnUntraced(function* (upkeep, stages) {
|
|
|
104
124
|
const found = snapshot.results.map((rows) => rows[0]);
|
|
105
125
|
const dropped = [];
|
|
106
126
|
const ended = [];
|
|
107
|
-
for (const { id, key, oid } of stages) {
|
|
127
|
+
for (const { id, key, oid, upload } of stages) {
|
|
108
128
|
const [staged, listedRow, copyRow] = found.splice(0, oid === void 0 ? 1 : 3);
|
|
109
129
|
if (staged === void 0) continue;
|
|
110
130
|
dropped.push({
|
|
@@ -113,23 +133,34 @@ const endStages = /* @__PURE__ */ Effect.fnUntraced(function* (upkeep, stages) {
|
|
|
113
133
|
});
|
|
114
134
|
const copy = copyRow === void 0 ? void 0 : yield* copyOf(copyRow);
|
|
115
135
|
if (oid !== void 0 && copy?.staged === id) dropped.push(copyRowKey(oid));
|
|
116
|
-
|
|
117
|
-
|
|
136
|
+
const listed = listedRow === void 0 ? void 0 : yield* listedOf(listedRow);
|
|
137
|
+
const ending = upload === void 0 ? {
|
|
118
138
|
id,
|
|
119
139
|
key
|
|
140
|
+
} : {
|
|
141
|
+
id,
|
|
142
|
+
key,
|
|
143
|
+
upload
|
|
144
|
+
};
|
|
145
|
+
if (listed?.key !== key) ended.push({
|
|
146
|
+
collection: lfsCollections.ending,
|
|
147
|
+
...ending
|
|
120
148
|
});
|
|
121
149
|
}
|
|
122
150
|
if (dropped.length === 0) return did;
|
|
123
151
|
const committed = yield* upkeep.rows.commit(upkeep.repo, snapshot.version, {
|
|
124
|
-
put: ended.map(({ collection, id, key }) => ({
|
|
152
|
+
put: ended.map(({ collection, id, key, upload }) => ({
|
|
125
153
|
collection,
|
|
126
154
|
id,
|
|
127
|
-
value: {
|
|
155
|
+
value: {
|
|
156
|
+
key,
|
|
157
|
+
...upload !== void 0 && { upload }
|
|
158
|
+
}
|
|
128
159
|
})),
|
|
129
160
|
delete: dropped
|
|
130
161
|
});
|
|
131
162
|
if (!committed.ok || ended.length === 0) return did;
|
|
132
|
-
return yield* endObjects(upkeep, committed.version, ended);
|
|
163
|
+
return yield* endObjects(upkeep, committed.version, endingsWithin(ended));
|
|
133
164
|
});
|
|
134
165
|
/** Up to a page of the upload rows that are due, by ID, and when the soonest of the rest is. */
|
|
135
166
|
const dueUploads = /* @__PURE__ */ Effect.fnUntraced(function* (upkeep) {
|
package/dist/lfs/uploaded.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { dayMs, dayOf, sweepOf } from "../core/receipts.mjs";
|
|
2
2
|
import { decodeRow } from "../store/errors.mjs";
|
|
3
3
|
import { lfsCollections, uploadedKept } from "./rows.mjs";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
4
|
import * as Schema from "effect/Schema";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
6
|
// src/lfs/uploaded.ts
|
|
7
7
|
/**
|
|
8
8
|
* A caller's own upload: an object whose bytes it sent, checked against the oid, which its pushes'
|
package/dist/lfs/wire.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { decodeJson } from "../protocol/wire/json.mjs";
|
|
|
3
3
|
import { boundedBytes } from "../protocol/bytes/reader.mjs";
|
|
4
4
|
import { brokenRead, endedEarly, readBody } from "../store/errors.mjs";
|
|
5
5
|
import { lfsResponse } from "./answer.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
6
|
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Result from "effect/Result";
|
|
9
9
|
// src/lfs/wire.ts
|
|
10
10
|
/**
|
package/dist/merges/merges.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { MergeParts, Merges } from "../core/merge-parts.mjs";
|
|
1
|
+
import { MergeParts, Merges, MergesBase } from "../core/merge-parts.mjs";
|
|
2
|
+
import { acting } from "../core/access.mjs";
|
|
3
|
+
import { mergeCalls } from "../core/objects/merges.mjs";
|
|
4
|
+
import { fail } from "../contracts/result.mjs";
|
|
2
5
|
import { Objects } from "../core/objects/objects.mjs";
|
|
3
6
|
import { loadedXdiff, mergeParts } from "../engine/parts.mjs";
|
|
4
7
|
import { defaultXdiffBudget } from "../engine/xdiff.mjs";
|
|
@@ -6,6 +9,7 @@ import { scopedReader } from "../storage/calls.mjs";
|
|
|
6
9
|
import * as Effect from "effect/Effect";
|
|
7
10
|
import * as Context from "effect/Context";
|
|
8
11
|
import * as Layer from "effect/Layer";
|
|
12
|
+
import * as Option from "effect/Option";
|
|
9
13
|
// src/merges/merges.ts
|
|
10
14
|
/**
|
|
11
15
|
* `Merges` and its part, over `objects`, with xdiff loaded once now: a module that isn't
|
|
@@ -23,7 +27,18 @@ const mergesContext = /* @__PURE__ */ Effect.fnUntraced(function* (options, obje
|
|
|
23
27
|
const allot = Effect.succeed((most, refusal) => reader.allotment(most, refusal));
|
|
24
28
|
return yield* parts.mergeTrees((object) => reader.read(object), input, allot);
|
|
25
29
|
}));
|
|
26
|
-
|
|
30
|
+
const base = yield* Effect.serviceOption(MergesBase);
|
|
31
|
+
const create = Option.match(base, {
|
|
32
|
+
onNone: () => () => fail("FAILED_PRECONDITION", "Merges.create runs only among Git.layer's features", {
|
|
33
|
+
hint: "Provide Merges.layer among Git.layer's features",
|
|
34
|
+
context: { reason: "merges-off" }
|
|
35
|
+
}),
|
|
36
|
+
onSome: ({ needs, door }) => (repo, input, by) => door(Effect.suspend(() => Effect.provideContext(acting(by, mergeCalls(by).create(repo, input)), Context.add(needs, MergeParts, parts))))
|
|
37
|
+
});
|
|
38
|
+
return Context.make(MergeParts, parts).pipe(Context.add(Merges, {
|
|
39
|
+
merge: mergeRead,
|
|
40
|
+
create
|
|
41
|
+
}));
|
|
27
42
|
});
|
|
28
43
|
/** `Merges.merge`, from the context. */
|
|
29
44
|
const merge = (input) => Effect.flatMap(Effect.service(Merges), (merges) => merges.merge(input));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BufferError, BufferMeter } from "./buffers.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
|
import * as Scope from "effect/Scope";
|
|
5
5
|
/**
|
|
6
6
|
* One zlib member deflated at a time, as a pack holds one per entry, at zlib's defaults: level 6,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { allotOrFail, allotScoped, capacityOf } from "./buffers.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
|
import untyped from "pako/lib/zlib/deflate.js";
|
|
5
5
|
// src/protocol/bytes/deflate.ts
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
1
|
import * as Schema from "effect/Schema";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Result from "effect/Result";
|
|
4
4
|
import * as Scope from "effect/Scope";
|
|
5
5
|
/** The bytes an inflater keeps between calls, at most: its window, its tables and its state. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
1
|
import * as Schema from "effect/Schema";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
3
|
/**
|
|
4
4
|
* A SHA-1's state between writes: its five words, the bytes it took, and the bytes past its last
|
|
5
5
|
* whole 64-byte block, as lowercase hex, as many as `length` leaves past a block. Decode stored state through it, so a damaged one fails by
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Allotment, GitObject, ObjectsRead } from "../../contracts/objects.mjs";
|
|
2
|
+
import "../../contracts/result.mjs";
|
|
2
3
|
import { Oid } from "../../contracts/ids.mjs";
|
|
3
4
|
import "../objects/commit.mjs";
|
|
4
5
|
import "../objects/tree.mjs";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
7
8
|
/**
|
|
8
9
|
* How a diff reads objects: through a caller's reader, every read counted, every object drained
|
|
9
10
|
* once and checked against its size and type, and every byte decoded charged to the diff's limits.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { allotmentWithin, objectsReadMost } from "../../contracts/object-values.mjs";
|
|
2
|
-
import { gitError } from "../../contracts/result.mjs";
|
|
2
|
+
import { gitError, isGitError } from "../../contracts/result.mjs";
|
|
3
3
|
import { decodeCommit, noRepoRoots } from "../objects/commit.mjs";
|
|
4
4
|
import { emptyTree } from "../objects/object.mjs";
|
|
5
5
|
import { decodeTag } from "../objects/tag.mjs";
|
|
6
6
|
import { parseTreeBytes, treeEntriesIn } from "../objects/tree.mjs";
|
|
7
7
|
import { tryUnlessSpent } from "../../contracts/calls-spent.mjs";
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
8
|
import * as Schema from "effect/Schema";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
10
|
// src/protocol/diff/read.ts
|
|
11
11
|
const mebibyte = 1048576;
|
|
12
12
|
/**
|
|
@@ -22,6 +22,13 @@ const defaultDiffLimits = {
|
|
|
22
22
|
fileBytes: 16 * mebibyte
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
|
+
* The most bytes speculative tree read-ahead (`prefetchAhead`) holds at once under its own
|
|
26
|
+
* allotment before the walk takes each tree: 512 KiB. Holds >10x all group trees (~53 KiB) and
|
|
27
|
+
* >25x a 1,000-entry page's leaf-package trees (~20 KiB) in `lockfiles-3k`, while staying under
|
|
28
|
+
* 0.8% of `defaultDiffLimits.bytes` (64 MiB).
|
|
29
|
+
*/
|
|
30
|
+
const readAheadBytesMost = 524288;
|
|
31
|
+
/**
|
|
25
32
|
* Why a diff stopped: an object `missing`, or `past-roots`, missing from a repo that holds roots,
|
|
26
33
|
* so it may be history past them; `malformed` or `unreadable`; a read or a charge past the diff's
|
|
27
34
|
* limits, `diff-limit`; or one object past its own, `object-too-large`.
|
|
@@ -141,6 +148,11 @@ var DiffReader = class {
|
|
|
141
148
|
#trees = /* @__PURE__ */ new Map();
|
|
142
149
|
/** Objects `prefetch` read ahead, counted and charged, each until `rootOf` takes it. */
|
|
143
150
|
#fetched = /* @__PURE__ */ new Map();
|
|
151
|
+
/**
|
|
152
|
+
* Objects `prefetchAhead` read speculatively under their own allotment: counted against
|
|
153
|
+
* `objects`, not charged to `bytes` until `rootOf` takes them, and shrunk on `releaseReadAhead`.
|
|
154
|
+
*/
|
|
155
|
+
#readAhead = /* @__PURE__ */ new Map();
|
|
144
156
|
read;
|
|
145
157
|
limits;
|
|
146
158
|
tally;
|
|
@@ -222,6 +234,26 @@ var DiffReader = class {
|
|
|
222
234
|
forgetTrees() {
|
|
223
235
|
this.#trees.clear();
|
|
224
236
|
this.#fetched.clear();
|
|
237
|
+
this.releaseReadAhead();
|
|
238
|
+
}
|
|
239
|
+
/** Releases every untaken read-ahead object and shrinks its allotment back to zero. */
|
|
240
|
+
releaseReadAhead() {
|
|
241
|
+
for (const held of this.#readAhead.values()) held.allotment.shrink(held.object.bytes.length);
|
|
242
|
+
this.#readAhead.clear();
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Returns a tree's entries if `oid` is already kept in `#trees` or held in `#readAhead`, without
|
|
246
|
+
* touching storage, removing it from `#readAhead`, or charging `bytes` or `entries`. Used by
|
|
247
|
+
* speculative lookahead to inspect already-prefetched parent folders; answers `undefined` if
|
|
248
|
+
* `oid` is not a valid in-memory tree.
|
|
249
|
+
*/
|
|
250
|
+
peekTree(oid) {
|
|
251
|
+
if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") return Effect.succeed([]);
|
|
252
|
+
const kept = this.#trees.get(oid);
|
|
253
|
+
if (kept !== void 0) return Effect.succeed(kept);
|
|
254
|
+
const ahead = this.#readAhead.get(oid);
|
|
255
|
+
if (ahead === void 0 || ahead.object.type !== "tree") return Effect.succeed(void 0);
|
|
256
|
+
return parseTreeBytes(ahead.object.bytes).pipe(Effect.catch(() => Effect.succeed(void 0)));
|
|
225
257
|
}
|
|
226
258
|
/**
|
|
227
259
|
* Reads `oids` ahead through `batch`, `objectsReadMost` at a time, for `rootOf` to take as it
|
|
@@ -254,6 +286,58 @@ var DiffReader = class {
|
|
|
254
286
|
});
|
|
255
287
|
}
|
|
256
288
|
/**
|
|
289
|
+
* Speculatively reads `oids` ahead through `batch` under `allotment` (never charging `bytes`
|
|
290
|
+
* until `rootOf` takes an object). Counts kept objects against `objects` (within the caller's
|
|
291
|
+
* reserve). If `allotment` or memory refuses (`refusal`, `busy`, or `object-too-large`), drops
|
|
292
|
+
* the entire batch, shrinks every byte grown for it on `allotment`, commits nothing, and answers
|
|
293
|
+
* `false` so the caller stops reading ahead for the rest of the page without failing the walk.
|
|
294
|
+
*/
|
|
295
|
+
prefetchAhead(oids, allotment, refusal) {
|
|
296
|
+
const { batch } = this;
|
|
297
|
+
if (batch === void 0) return Effect.succeed(false);
|
|
298
|
+
const asked = [...new Set(oids.filter((oid) => oid !== "4b825dc642cb6eb9a060e54bf8d69288fbee4904" && !this.#trees.has(oid) && !this.#fetched.has(oid) && !this.#readAhead.has(oid)))];
|
|
299
|
+
if (asked.length === 0) return Effect.succeed(true);
|
|
300
|
+
return Effect.gen({ self: this }, function* () {
|
|
301
|
+
const staged = [];
|
|
302
|
+
let stagedBytes = 0;
|
|
303
|
+
let committed = false;
|
|
304
|
+
const releaseStaged = () => {
|
|
305
|
+
if (stagedBytes > 0) allotment.shrink(stagedBytes);
|
|
306
|
+
stagedBytes = 0;
|
|
307
|
+
staged.length = 0;
|
|
308
|
+
};
|
|
309
|
+
return yield* Effect.gen({ self: this }, function* () {
|
|
310
|
+
for (let at = 0; at < asked.length; at += objectsReadMost) {
|
|
311
|
+
let left = asked.slice(at, at + objectsReadMost);
|
|
312
|
+
while (left.length > 0) {
|
|
313
|
+
const read = yield* batch(left, allotment);
|
|
314
|
+
for (const object of read.objects.values()) {
|
|
315
|
+
staged.push(object);
|
|
316
|
+
stagedBytes += object.bytes.length;
|
|
317
|
+
}
|
|
318
|
+
left = read.left;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
for (let at = 0; at < staged.length; at += 1) {
|
|
322
|
+
this.#objects += 1;
|
|
323
|
+
if (this.#objects > this.limits.objects) return yield* failed("diff-limit", `the diff reads past ${this.limits.objects} objects`);
|
|
324
|
+
if (this.tally?.object() === false) return yield* failed("diff-limit", `the call reads past ${this.tally.limits.objects} objects`);
|
|
325
|
+
}
|
|
326
|
+
for (const object of staged) this.#readAhead.set(object.oid, {
|
|
327
|
+
object,
|
|
328
|
+
allotment
|
|
329
|
+
});
|
|
330
|
+
committed = true;
|
|
331
|
+
return true;
|
|
332
|
+
}).pipe(Effect.catchIf((error) => error === refusal || isGitError(error) && (error.code === "UNAVAILABLE" && error.context?.reason === "busy" || error.code === "RESOURCE_EXHAUSTED" && error.context?.reason === "object-too-large"), () => Effect.sync(() => {
|
|
333
|
+
releaseStaged();
|
|
334
|
+
return false;
|
|
335
|
+
})), Effect.onExit(() => Effect.sync(() => {
|
|
336
|
+
if (!committed) releaseStaged();
|
|
337
|
+
})));
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
257
341
|
* An allotment of what the diff's bytes bound and its call's have left, the less of the two,
|
|
258
342
|
* which a batch's bytes are charged to as it reads them, so a batch past either is refused
|
|
259
343
|
* before it's held.
|
|
@@ -314,11 +398,21 @@ var DiffReader = class {
|
|
|
314
398
|
this.#fetched.delete(at);
|
|
315
399
|
let object;
|
|
316
400
|
if (fetched === void 0) {
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
bytes
|
|
321
|
-
|
|
401
|
+
const ahead = this.#readAhead.get(at);
|
|
402
|
+
if (ahead !== void 0) {
|
|
403
|
+
this.#readAhead.delete(at);
|
|
404
|
+
ahead.allotment.shrink(ahead.object.bytes.length);
|
|
405
|
+
this.#sizes.set(at, ahead.object.bytes.length);
|
|
406
|
+
if (ahead.object.bytes.length > this.limits.fileBytes) return yield* failed("object-too-large", `${ahead.object.type} ${at} is ${ahead.object.bytes.length} bytes, past ${this.limits.fileBytes}`, at);
|
|
407
|
+
yield* this.charge(ahead.object.bytes.length);
|
|
408
|
+
object = ahead.object;
|
|
409
|
+
} else {
|
|
410
|
+
const read = yield* this.object(at);
|
|
411
|
+
object = {
|
|
412
|
+
type: read.type,
|
|
413
|
+
bytes: yield* this.#chargedDrained(read)
|
|
414
|
+
};
|
|
415
|
+
}
|
|
322
416
|
} else object = fetched;
|
|
323
417
|
const { bytes } = object;
|
|
324
418
|
if (object.type === "tree") return {
|
|
@@ -359,4 +453,4 @@ const malformedOn = (oid, decoded) => Effect.mapError(decoded, (error) => new Di
|
|
|
359
453
|
oid,
|
|
360
454
|
message: `${oid}: ${error.message}`
|
|
361
455
|
}));
|
|
362
|
-
export { DiffError, DiffReader, ReadTally, defaultDiffLimits, drained };
|
|
456
|
+
export { DiffError, DiffReader, ReadTally, defaultDiffLimits, drained, readAheadBytesMost };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { oidBytes, sealed } from "./idx.mjs";
|
|
2
|
-
import "effect/Effect";
|
|
3
2
|
import * as Schema from "effect/Schema";
|
|
3
|
+
import "effect/Effect";
|
|
4
4
|
// src/protocol/packs/graph.ts
|
|
5
5
|
/**
|
|
6
6
|
* A pack's `.graph`: each commit it holds, by ID, with its parents, so a walk of history reads
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Oid } from "../../contracts/ids.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
|
export declare const PackIndexFault: Schema.Literals<readonly ["header", "version", "length", "fanout", "order", "offset", "checksum"]>;
|
|
5
5
|
export type PackIndexFault = typeof PackIndexFault.Type;
|
|
6
6
|
declare const PackIndexError_base: Schema.Class<PackIndexError, Schema.TaggedStruct<"PackIndexError", {
|
|
@@ -2,8 +2,8 @@ import { hexOf } from "../bytes/hex.mjs";
|
|
|
2
2
|
import { Sha1 } from "../bytes/sha1.mjs";
|
|
3
3
|
import { nativeSha1Hasher } from "../bytes/sha1-hasher.mjs";
|
|
4
4
|
import { isOid } from "../bytes/text.mjs";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
5
|
import * as Schema from "effect/Schema";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Hex from "effect/encoding/Hex";
|
|
8
8
|
// src/protocol/packs/idx.ts
|
|
9
9
|
/**
|
|
@@ -3,8 +3,8 @@ import { Oid } from "../../contracts/ids.mjs";
|
|
|
3
3
|
import { ObjectType } from "../../contracts/object-values.mjs";
|
|
4
4
|
import { BufferError, BufferMeter } from "../bytes/buffers.mjs";
|
|
5
5
|
import "./step.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
6
|
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
8
|
import "effect/Result";
|
|
9
9
|
/**
|
|
10
10
|
* A Git pack read as it streams, object by object, never held whole: its header, then each
|
|
@@ -6,8 +6,8 @@ import { flushPkt } from "../framing/pkt-line.mjs";
|
|
|
6
6
|
import { objectTypes } from "../objects/object.mjs";
|
|
7
7
|
import { stepEffect } from "./step.mjs";
|
|
8
8
|
import { tryUnlessSpent } from "../../contracts/calls-spent.mjs";
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
9
|
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Result from "effect/Result";
|
|
12
12
|
import * as Hex from "effect/encoding/Hex";
|
|
13
13
|
// src/protocol/packs/reader.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "effect/Effect";
|
|
2
1
|
import * as Schema from "effect/Schema";
|
|
2
|
+
import "effect/Effect";
|
|
3
3
|
/** Why a pack wasn't written, named. */
|
|
4
4
|
export declare const PackWriteFault: Schema.Literals<readonly ["count", "kind", "oid", "size", "duplicate", "length", "hash", "too big", "time", "cancelled"]>;
|
|
5
5
|
export type PackWriteFault = typeof PackWriteFault.Type;
|
|
@@ -6,15 +6,15 @@ import { isOid } from "../bytes/text.mjs";
|
|
|
6
6
|
import { isObjectType, objectHeader } from "../objects/object.mjs";
|
|
7
7
|
import { PackParts } from "./parts.mjs";
|
|
8
8
|
import { PackWriteError, refuseWrite } from "./write-error.mjs";
|
|
9
|
-
import * as Clock from "effect/Clock";
|
|
10
9
|
import * as Effect from "effect/Effect";
|
|
11
10
|
import * as Option from "effect/Option";
|
|
12
11
|
import * as Cause from "effect/Cause";
|
|
13
12
|
import * as Exit from "effect/Exit";
|
|
14
|
-
import * as Fiber from "effect/Fiber";
|
|
15
|
-
import * as Hex from "effect/encoding/Hex";
|
|
16
13
|
import * as Scope from "effect/Scope";
|
|
17
14
|
import * as Deferred from "effect/Deferred";
|
|
15
|
+
import * as Fiber from "effect/Fiber";
|
|
16
|
+
import * as Clock from "effect/Clock";
|
|
17
|
+
import * as Hex from "effect/encoding/Hex";
|
|
18
18
|
import * as Scheduler from "effect/Scheduler";
|
|
19
19
|
// src/protocol/packs/writer.ts
|
|
20
20
|
/** The writer's output buffer, and the most bytes it hands its compressor at once. */
|
|
@@ -2,8 +2,8 @@ import { Oid } from "../../contracts/ids.mjs";
|
|
|
2
2
|
import { WireDecodeError, WireEncodeError } from "../bytes/errors.mjs";
|
|
3
3
|
import "./lines.mjs";
|
|
4
4
|
import { PushLimits } from "./push-limits.mjs";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
5
|
import * as Schema from "effect/Schema";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
7
|
/** The two services smart HTTP serves. */
|
|
8
8
|
export type GitService = 'git-upload-pack' | 'git-receive-pack';
|
|
9
9
|
/** A ref a server lists: its name, its object, and an annotated tag's object through every tag. */
|
|
@@ -5,8 +5,8 @@ import { pktText, readPkt } from "../framing/pkt-line.mjs";
|
|
|
5
5
|
import { byName, decoded, encodeErr, gitsOwnRefs, isWord, listsRef, refusedText, textLines, unwritable } from "./lines.mjs";
|
|
6
6
|
import { pushLimitOffers } from "./push-limits.mjs";
|
|
7
7
|
import { pushUploadOffer } from "./push-uploads.mjs";
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
8
|
import * as Schema from "effect/Schema";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
10
|
import * as Result from "effect/Result";
|
|
11
11
|
// src/protocol/wire/advertisement.ts
|
|
12
12
|
/**
|
|
@@ -126,6 +126,7 @@ const onLines = (what, texts) => {
|
|
|
126
126
|
*/
|
|
127
127
|
const advertisementPages = (service, listed, capabilities, table) => {
|
|
128
128
|
const uploading = service === "git-upload-pack";
|
|
129
|
+
const hidden = uploading ? table : table.filter((row) => row.movedUnder === void 0);
|
|
129
130
|
const caps = capabilities.join(" ");
|
|
130
131
|
let first = true;
|
|
131
132
|
const lines = (refs) => refs.flatMap((ref) => {
|
|
@@ -141,7 +142,7 @@ const advertisementPages = (service, listed, capabilities, table) => {
|
|
|
141
142
|
return {
|
|
142
143
|
start: Effect.andThen(onLines("advertisement", capabilities), () => Effect.map(Effect.all([serviceLine, textLines(lines(head), false)]), joinedBytes)),
|
|
143
144
|
page: (refs) => {
|
|
144
|
-
const shown = refs.filter((ref) => listsRef(
|
|
145
|
+
const shown = refs.filter((ref) => listsRef(hidden, ref.name, []));
|
|
145
146
|
return Effect.andThen(onLines("advertisement", shown.map((ref) => ref.name)), () => textLines(lines(shown), false));
|
|
146
147
|
},
|
|
147
148
|
end: (roots) => Effect.suspend(() => textLines([...first ? [`${zero} capabilities^{}\0${caps}\n`] : [], ...uploading ? roots.map((root) => `shallow ${root}\n`) : []], true))
|
|
@@ -3,8 +3,8 @@ import { Oid } from "../../contracts/ids.mjs";
|
|
|
3
3
|
import { WireDecodeError, WireEncodeError } from "../bytes/errors.mjs";
|
|
4
4
|
import { Band } from "../framing/band.mjs";
|
|
5
5
|
import { V2Request } from "./v2.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
6
|
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Result from "effect/Result";
|
|
9
9
|
/**
|
|
10
10
|
* A fetch, one round at a time, as `git-upload-pack` negotiates it over stateless smart HTTP:
|
|
@@ -6,8 +6,8 @@ import { onBand } from "../framing/band.mjs";
|
|
|
6
6
|
import { dataPkt, delimPkt, flushPkt, pktText, readPkt } from "../framing/pkt-line.mjs";
|
|
7
7
|
import { decoded, isWord, readSection, refusedText, textLines, unwritable } from "./lines.mjs";
|
|
8
8
|
import { encodeV2Request } from "./v2.mjs";
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
9
|
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Result from "effect/Result";
|
|
12
12
|
// src/protocol/wire/fetch.ts
|
|
13
13
|
/**
|
|
@@ -10,7 +10,7 @@ import "effect/Result";
|
|
|
10
10
|
export declare const encodeErr: (message: string) => Effect.Effect<Uint8Array<ArrayBuffer>, WireEncodeError>;
|
|
11
11
|
/**
|
|
12
12
|
* A prefix whose refs are Git's own: only `owner`, the registration that registered it or an import,
|
|
13
|
-
* moves one, and no push or API call does
|
|
13
|
+
* moves one, and no push or API call does, but under its `movedUnder`. v0 never advertises them. v2's `ls-refs`, and
|
|
14
14
|
* `refs.list`, list one only for an asked prefix under it when `underPrefix` is `listed`, and never
|
|
15
15
|
* when it's `hidden`, nor does a fetch reach a commit only a `hidden` one holds. An `owned` one is
|
|
16
16
|
* the owner's alone: no listing, count, fetch, fork or `refs.get` shows it to anyone else, a caller
|
|
@@ -21,4 +21,12 @@ export interface HiddenRefs {
|
|
|
21
21
|
readonly underPrefix: 'listed' | 'hidden' | 'owned';
|
|
22
22
|
/** Who moves them, as a refusal says it. */
|
|
23
23
|
readonly mover: string;
|
|
24
|
+
/**
|
|
25
|
+
* A prefix under `owner`'s whose refs any caller who writes the repo and sees them moves too,
|
|
26
|
+
* as Git's own move: no rule, hook, publish check or event sees it, though the registered
|
|
27
|
+
* checks, as LFS's pointers, still judge it. Only receive-pack shows one, to a pusher whose
|
|
28
|
+
* view is whole, so its next push leases from the tip. Any other ref under `owner`'s prefix
|
|
29
|
+
* stays its owner's alone.
|
|
30
|
+
*/
|
|
31
|
+
readonly movedUnder?: string;
|
|
24
32
|
}
|