@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/core/push.mjs
CHANGED
|
@@ -5,37 +5,35 @@ import { isUnindexedRead } from "../storage/index-visible.mjs";
|
|
|
5
5
|
import { openTreesRefusal } from "../storage/push-allotment.mjs";
|
|
6
6
|
import { isLoose } from "../storage/loose.mjs";
|
|
7
7
|
import { listedIds } from "../storage/listed-ids.mjs";
|
|
8
|
-
import { indexRowKey, isPackId, objectCollections } from "../storage/layout.mjs";
|
|
8
|
+
import { indexRowKey, isPackId, objectCollections, pruneClearedKey } from "../storage/layout.mjs";
|
|
9
9
|
import { noLfsPointers } from "../storage/lfs-pointers.mjs";
|
|
10
10
|
import { isShallowRoot } from "../storage/links.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { repackJobKey, repackJobName } from "../storage/repack-job.mjs";
|
|
12
12
|
import { allottedRows } from "../storage/allotted.mjs";
|
|
13
13
|
import { chunkedOf } from "../storage/chunks.mjs";
|
|
14
14
|
import { gitObjectOf, headerOfRow, noRows, receivedObject, receivedRows } from "../storage/object-rows.mjs";
|
|
15
|
-
import { pruneClearedKey } from "../storage/prune.mjs";
|
|
16
15
|
import { abandonOwn } from "../storage/quarantine.mjs";
|
|
17
16
|
import { readyBytesOf, readyKey } from "../storage/ready.mjs";
|
|
18
17
|
import { QuarantineRow } from "../storage/rows.mjs";
|
|
19
18
|
import { promoteOwn } from "../storage/batch-upkeep.mjs";
|
|
20
|
-
import { abandonBatch, batchesRead, isStagedReceive, stagedBatchOf } from "../storage/batches.mjs";
|
|
21
|
-
import { bestEffort, decodeRow, fromInfra, storeCommit } from "../store/errors.mjs";
|
|
19
|
+
import { abandonBatch, batchesRead, isStagedReceive, stagedBatchOf, stagedOwnOf } from "../storage/batches.mjs";
|
|
20
|
+
import { bestEffort, decodeRow, fromInfra, storeCall, storeCommit } from "../store/errors.mjs";
|
|
22
21
|
import { callScope } from "../store/call-count.mjs";
|
|
23
22
|
import { decodePacks, gitStore } from "../store/git-store.mjs";
|
|
24
23
|
import { WholeRepo, refBytesOf, storesPeel, wholeRefs } from "../store/ref-rows.mjs";
|
|
25
24
|
import { dropBody } from "../protocol/bytes/reader.mjs";
|
|
26
|
-
import {
|
|
25
|
+
import { anyoneMoves, hiddenUnder, movesAsGitsOwn } from "../protocol/wire/lines.mjs";
|
|
27
26
|
import { sliceOf } from "../protocol/wire/push-limits.mjs";
|
|
28
27
|
import { pushCounts } from "./events/seen.mjs";
|
|
29
28
|
import { refViewIn } from "./ref-view.mjs";
|
|
30
29
|
import { appendEvents, decodeOutbox, firstSeq, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
31
30
|
import { rowsAtCommit } from "./loose-tally.mjs";
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { HeldBy, decodeStats, heldUntil, looseRows, movedRoots, readRecord, repoStats, rootsMoved, rootsOf, timeRow } from "../store/repo-record.mjs";
|
|
31
|
+
import { LooseTally, PrunedMark } from "../store/records.mjs";
|
|
32
|
+
import { HeldBy, decodeStats, heldAdd, heldStore, heldUntil, looseRows, movedRoots, readRecord, repoStats, rootsMoved, rootsOf, timeRow } from "../store/repo-record.mjs";
|
|
35
33
|
import { advanceRow } from "../store/queue-jobs.mjs";
|
|
36
34
|
import { liveReservations, reservedTarget } from "../store/reservations.mjs";
|
|
37
35
|
import { settleName } from "../store/settle.mjs";
|
|
38
|
-
import { collections, newChangeId, prunedKey, pushedKey, pushedUnder, reachedKey, repoRootsKey, repoScope } from "../store/scopes.mjs";
|
|
36
|
+
import { collections, looseKey, newChangeId, prunedKey, pushedKey, pushedUnder, reachedKey, repoRootsKey, repoScope } from "../store/scopes.mjs";
|
|
39
37
|
import { headOf, indexJobs, openKeyed, openRepo, refIndexJobs, repoAccess } from "./access.mjs";
|
|
40
38
|
import { kindsOf } from "./ancestry.mjs";
|
|
41
39
|
import { isRefName } from "./names.mjs";
|
|
@@ -49,8 +47,8 @@ import { changedWhileChecked, factsHeld, tipsOf } from "./rules/facts.mjs";
|
|
|
49
47
|
import { clearsMark, decidePush, otherWritesProblem, pushOptionsProblem } from "./push-decide.mjs";
|
|
50
48
|
import { heldReceipt, receiptReads, receiptWrites, refsAnswer, refsKept, withJobs } from "./receipts.mjs";
|
|
51
49
|
import { SealedObjects, viewOf } from "./view.mjs";
|
|
50
|
+
import { notFailed } from "./events/deliver.mjs";
|
|
52
51
|
import { ownWriter, ownWritesOf } from "./own-writes.mjs";
|
|
53
|
-
import { ensureRepack } from "./repack.mjs";
|
|
54
52
|
import { publishable, unpublished } from "./publish.mjs";
|
|
55
53
|
import { peeledAll, peeledOf } from "../storage/wants.mjs";
|
|
56
54
|
import { CoreParts, ObjectsParts } from "./parts.mjs";
|
|
@@ -58,11 +56,11 @@ import { defaultPushFiles, filesChecked } from "./push-files.mjs";
|
|
|
58
56
|
import { addedBytes, defaultPushRepo, repoChecked } from "./push-repo.mjs";
|
|
59
57
|
import { Authorize, check } from "../contracts/authorize.mjs";
|
|
60
58
|
import { read } from "./objects/objects.mjs";
|
|
61
|
-
import
|
|
59
|
+
import { checkWrites, limits } from "@ref0/infra";
|
|
62
60
|
import * as Effect from "effect/Effect";
|
|
63
61
|
import * as Exit from "effect/Exit";
|
|
64
62
|
import * as Result from "effect/Result";
|
|
65
|
-
import
|
|
63
|
+
import * as Clock from "effect/Clock";
|
|
66
64
|
import * as Equal from "effect/Equal";
|
|
67
65
|
// src/core/push.ts
|
|
68
66
|
/**
|
|
@@ -206,7 +204,8 @@ const firstRead = (caller, operation, internalId) => openRepo(caller, {
|
|
|
206
204
|
}, [
|
|
207
205
|
packsRead,
|
|
208
206
|
prunedKey,
|
|
209
|
-
repoRootsKey
|
|
207
|
+
repoRootsKey,
|
|
208
|
+
looseKey
|
|
210
209
|
], internalId, "skip");
|
|
211
210
|
/** `firstRead` for a keyed push: `undefined` once `missed`'s repo moved, as `openKeyed` says. */
|
|
212
211
|
const keyedRead = (caller, operation, missed, internalId) => openKeyed(caller, {
|
|
@@ -215,7 +214,8 @@ const keyedRead = (caller, operation, missed, internalId) => openKeyed(caller, {
|
|
|
215
214
|
}, [
|
|
216
215
|
packsRead,
|
|
217
216
|
prunedKey,
|
|
218
|
-
repoRootsKey
|
|
217
|
+
repoRootsKey,
|
|
218
|
+
looseKey
|
|
219
219
|
], missed, internalId, "skip");
|
|
220
220
|
/**
|
|
221
221
|
* The first read's repo once `authorize` lets the caller push to it: its list, for the pack to be
|
|
@@ -238,6 +238,8 @@ const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operatio
|
|
|
238
238
|
};
|
|
239
239
|
const mark = yield* markOf(resolved.snapshot.results[2] ?? []);
|
|
240
240
|
const roots = yield* rootsOf(resolved.snapshot.results[3]);
|
|
241
|
+
const [looseRow] = resolved.snapshot.results[4] ?? [];
|
|
242
|
+
const loose = looseRow === void 0 ? void 0 : yield* decodeRow(LooseTally, looseRow, "The repo's object rows' tally");
|
|
241
243
|
const views = yield* Effect.forEach(decidingFor(request), (one) => viewOf(one, resolved, request.as));
|
|
242
244
|
const [view = yield* viewOf(caller, resolved, request.as)] = views;
|
|
243
245
|
return {
|
|
@@ -245,6 +247,7 @@ const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operatio
|
|
|
245
247
|
defaultBranch: headOf(resolved.record.defaultBranch),
|
|
246
248
|
mark,
|
|
247
249
|
roots,
|
|
250
|
+
hasLooseRows: (loose?.objects ?? 0) > 0,
|
|
248
251
|
repo,
|
|
249
252
|
view,
|
|
250
253
|
views,
|
|
@@ -291,13 +294,21 @@ const seenRefsOf = /* @__PURE__ */ Effect.fnUntraced(function* (view, listed, ro
|
|
|
291
294
|
*/
|
|
292
295
|
const pushedOf = (objects, listed, received) => {
|
|
293
296
|
if (received === void 0) return () => Effect.succeed(void 0);
|
|
294
|
-
const
|
|
297
|
+
const staged = stagedOwnOf(received.change);
|
|
298
|
+
const rows = staged === void 0 ? receivedRows(received.change) : void 0;
|
|
295
299
|
const own = {
|
|
296
300
|
...listed,
|
|
297
301
|
packs: received.change.add ?? []
|
|
298
302
|
};
|
|
299
303
|
return (input) => {
|
|
300
|
-
|
|
304
|
+
if (staged !== void 0) {
|
|
305
|
+
if (!staged.headers.has(input.oid)) return own.packs.length === 0 ? Effect.succeed(void 0) : objects.read(own, {
|
|
306
|
+
...input,
|
|
307
|
+
listedOnly: true
|
|
308
|
+
});
|
|
309
|
+
return Effect.flatMap(staged.readRow(input.oid), (row) => row === void 0 ? Effect.succeed(void 0) : Effect.map(receivedObject(received.change, row), gitObjectOf));
|
|
310
|
+
}
|
|
311
|
+
const row = rows?.get(input.oid);
|
|
301
312
|
if (row !== void 0) return Effect.map(receivedObject(received.change, row), gitObjectOf);
|
|
302
313
|
return own.packs.length === 0 ? Effect.succeed(void 0) : objects.read(own, {
|
|
303
314
|
...input,
|
|
@@ -310,35 +321,6 @@ const pushedOf = (objects, listed, received) => {
|
|
|
310
321
|
* reads one, its bytes let go unread. A read that fails throws, so the walk trusts nothing.
|
|
311
322
|
*/
|
|
312
323
|
const broughtCommit = (pushed) => (oid) => Effect.flatMap(pushed({ oid }), (object) => Effect.as(dropBody(object?.bytes), object?.type === "commit"));
|
|
313
|
-
/** The refs the repo mirrors, among `rows` of `mirrors`: each one an active mirror names, with its destination. */
|
|
314
|
-
const activeMirrors = /* @__PURE__ */ Effect.fnUntraced(function* (rows) {
|
|
315
|
-
const active = /* @__PURE__ */ new Map();
|
|
316
|
-
for (const row of rows) {
|
|
317
|
-
const mirror = yield* decodeRow(MirrorRow, row, `Mirror '${row.id}'`);
|
|
318
|
-
if (mirror.state === "active") active.set(row.id, mirror.destination);
|
|
319
|
-
}
|
|
320
|
-
return active;
|
|
321
|
-
});
|
|
322
|
-
/**
|
|
323
|
-
* `sync.mirror`'s row for each destination an active mirror of a ref the commit moves names, one
|
|
324
|
-
* however many of its refs move, found by name among the jobs the server knows: none until
|
|
325
|
-
* `Sync.layer` has bound them.
|
|
326
|
-
*/
|
|
327
|
-
const mirrorJobs = (core, moved, mirrored) => {
|
|
328
|
-
const definition = core.jobOf?.(mirrorJobName);
|
|
329
|
-
if (definition === void 0) return [];
|
|
330
|
-
const jobs = /* @__PURE__ */ new Map();
|
|
331
|
-
for (const { ref } of moved) {
|
|
332
|
-
const destination = mirrored.get(ref);
|
|
333
|
-
if (destination === void 0) continue;
|
|
334
|
-
const key = mirrorJobKey(destination);
|
|
335
|
-
jobs.set(key, definition.job({
|
|
336
|
-
key,
|
|
337
|
-
data: { destination }
|
|
338
|
-
}));
|
|
339
|
-
}
|
|
340
|
-
return [...jobs.values()];
|
|
341
|
-
};
|
|
342
324
|
/** The repo's stored packs and the received pack's, before the commit lists it: a push's changes read both. */
|
|
343
325
|
const withReceived = (listed, received) => received === void 0 ? listed : {
|
|
344
326
|
...listed,
|
|
@@ -347,26 +329,37 @@ const withReceived = (listed, received) => received === void 0 ? listed : {
|
|
|
347
329
|
/** The objects, with the rows a receive puts read first: they're written only by the commit. */
|
|
348
330
|
const withReceivedRows = (objects, received) => {
|
|
349
331
|
const change = received?.change;
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
332
|
+
const staged = stagedOwnOf(change);
|
|
333
|
+
const rows = staged === void 0 ? receivedRows(change) : void 0;
|
|
334
|
+
const hasOwn = (oid) => staged !== void 0 ? staged.headers.has(oid) : rows?.has(oid) ?? false;
|
|
335
|
+
if ((staged !== void 0 ? staged.headers.size : rows?.size ?? 0) === 0) return objects;
|
|
336
|
+
const rowOf = (oid) => staged !== void 0 ? staged.readRow(oid) : Effect.succeed(rows?.get(oid));
|
|
337
|
+
const rowsOf = (before) => Effect.fnUntraced(function* (oids, each) {
|
|
338
|
+
const fetched = staged !== void 0 ? yield* staged.readRows(oids) : oids.map((oid) => rows?.get(oid));
|
|
339
|
+
for (const [index, oid] of oids.entries()) {
|
|
340
|
+
const row = fetched[index];
|
|
341
|
+
if (row === void 0) continue;
|
|
342
|
+
const chunked = chunkedOf(row.value);
|
|
343
|
+
if (chunked !== void 0 && before !== void 0 && !(yield* before(oid, chunked.size))) continue;
|
|
344
|
+
yield* each(yield* receivedObject(change, row));
|
|
345
|
+
}
|
|
346
|
+
});
|
|
359
347
|
return {
|
|
360
348
|
...objects,
|
|
361
349
|
read: (listed, input) => {
|
|
362
|
-
|
|
363
|
-
return row === void 0 ? objects.read(listed, input) : Effect.map(receivedObject(change, row), gitObjectOf);
|
|
350
|
+
if (!hasOwn(input.oid)) return objects.read(listed, input);
|
|
351
|
+
return Effect.flatMap(rowOf(input.oid), (row) => row === void 0 ? objects.read(listed, input) : Effect.map(receivedObject(change, row), gitObjectOf));
|
|
364
352
|
},
|
|
365
353
|
headers: Effect.fnUntraced(function* (listed, input) {
|
|
366
354
|
const answer = /* @__PURE__ */ new Map();
|
|
367
|
-
const stored = input.oids.filter((oid) => !
|
|
355
|
+
const stored = input.oids.filter((oid) => !hasOwn(oid));
|
|
368
356
|
for (const oid of input.oids) {
|
|
369
|
-
|
|
357
|
+
if (staged !== void 0) {
|
|
358
|
+
const header = staged.headers.get(oid);
|
|
359
|
+
if (header !== void 0) answer.set(oid, header);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
const row = rows?.get(oid);
|
|
370
363
|
if (row === void 0) continue;
|
|
371
364
|
answer.set(oid, yield* headerOfRow(row));
|
|
372
365
|
}
|
|
@@ -379,17 +372,17 @@ const withReceivedRows = (objects, received) => {
|
|
|
379
372
|
objects: Effect.fnUntraced(function* (listed, input) {
|
|
380
373
|
const asked = [...new Set(input.oids)];
|
|
381
374
|
const [first] = asked;
|
|
382
|
-
if (first === void 0 || !asked.some(
|
|
375
|
+
if (first === void 0 || !asked.some(hasOwn)) return yield* objects.objects(listed, {
|
|
383
376
|
...input,
|
|
384
377
|
oids: asked
|
|
385
378
|
});
|
|
386
|
-
const fromRows =
|
|
387
|
-
const own = asked.filter((oid) =>
|
|
379
|
+
const fromRows = hasOwn(first);
|
|
380
|
+
const own = asked.filter((oid) => hasOwn(oid) === fromRows);
|
|
388
381
|
const answered = fromRows ? yield* allottedRows(rowsOf, own, input.bytes) : yield* objects.objects(listed, {
|
|
389
382
|
...input,
|
|
390
383
|
oids: own
|
|
391
384
|
});
|
|
392
|
-
const left = /* @__PURE__ */ new Set([...answered.left, ...asked.filter((oid) =>
|
|
385
|
+
const left = /* @__PURE__ */ new Set([...answered.left, ...asked.filter((oid) => hasOwn(oid) !== fromRows)]);
|
|
393
386
|
return {
|
|
394
387
|
objects: answered.objects,
|
|
395
388
|
left: asked.filter((oid) => left.has(oid))
|
|
@@ -441,7 +434,8 @@ const buildFence = (build) => [
|
|
|
441
434
|
* answers, it fails, to be sent again (Q270). `changed`: whether a row of a build's fence,
|
|
442
435
|
* `unchanged`, holds another value than its plan read.
|
|
443
436
|
*/
|
|
444
|
-
const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
437
|
+
const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (core, repo, fence, received, kept, mark, branches, touched, guard, unchanged = [], countPuts = true) {
|
|
438
|
+
const { store } = core;
|
|
445
439
|
const own = received?.quarantine === void 0 ? [] : [received.quarantine];
|
|
446
440
|
const batched = isStagedReceive(received) ? [batchesRead] : [];
|
|
447
441
|
const keyed = receiptReads(kept);
|
|
@@ -450,10 +444,16 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
450
444
|
id
|
|
451
445
|
}));
|
|
452
446
|
const linkedRows = received?.linked?.rows ?? [];
|
|
453
|
-
const rowCounts = linkedRows.map((
|
|
447
|
+
const rowCounts = linkedRows.map((prefix) => ({
|
|
454
448
|
collection: objectCollections.objects,
|
|
455
|
-
prefix
|
|
449
|
+
prefix
|
|
456
450
|
}));
|
|
451
|
+
if (countPuts) {
|
|
452
|
+
for (const { collection, id } of received?.change.put ?? []) if (rowCounts.length < limits.counts && collection === objectCollections.objects) rowCounts.push({
|
|
453
|
+
collection,
|
|
454
|
+
prefix: id
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
457
|
const { record, snapshot } = yield* readRecord(store, repo.internalId, [
|
|
458
458
|
refsRead,
|
|
459
459
|
...outboxReads,
|
|
@@ -508,7 +508,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
508
508
|
const refs = yield* wholeRefs(pushWhole, refRows);
|
|
509
509
|
const outbox = yield* decodeOutbox([headRows, cursorRows]);
|
|
510
510
|
const held = ownRow === void 0 ? void 0 : yield* decodeRow(QuarantineRow, ownRow, `The push's quarantine row '${ownRow.id}'`);
|
|
511
|
-
const
|
|
511
|
+
const mirrorJobs = core.mirrorJobs === void 0 || core.jobOf === void 0 ? void 0 : yield* core.mirrorJobs(mirrorRows, core.jobOf);
|
|
512
512
|
const revoked = yield* Effect.match(fence.check(fenced), {
|
|
513
513
|
onFailure: (error) => error,
|
|
514
514
|
onSuccess: () => void 0
|
|
@@ -547,7 +547,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
547
547
|
receipt,
|
|
548
548
|
outbox,
|
|
549
549
|
record,
|
|
550
|
-
|
|
550
|
+
mirrorJobs,
|
|
551
551
|
facts,
|
|
552
552
|
stats,
|
|
553
553
|
times,
|
|
@@ -555,6 +555,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
555
555
|
reserved,
|
|
556
556
|
indexRow,
|
|
557
557
|
changed,
|
|
558
|
+
counts: snapshot.counts.slice(linkedRows.length),
|
|
558
559
|
roots: yield* rootsOf(rootRows)
|
|
559
560
|
};
|
|
560
561
|
});
|
|
@@ -566,16 +567,17 @@ const settingsOf = (record) => ({
|
|
|
566
567
|
/** The rules, the registrations' checks, then the hook groups, once, at the first read the push decides on. */
|
|
567
568
|
const runChecks = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, facts) {
|
|
568
569
|
const context = checking(input);
|
|
569
|
-
const ruled = yield*
|
|
570
|
+
const ruled = yield* runPushRules(checks, input, context);
|
|
571
|
+
const refused = yield* registeredAfter(checks, input, ruled.updates, ruled.refused);
|
|
570
572
|
const whole = yield* runHookGroups(checks.groups?.() ?? [], context, {
|
|
571
573
|
atomic: input.atomic,
|
|
572
574
|
updates: ruled.updates,
|
|
573
|
-
refused
|
|
575
|
+
refused
|
|
574
576
|
});
|
|
575
577
|
const checked = {
|
|
576
578
|
facts,
|
|
577
579
|
updates: ruled.updates,
|
|
578
|
-
refused
|
|
580
|
+
refused,
|
|
579
581
|
filesAllowed: ruled.filesAllowed,
|
|
580
582
|
bypassed: ruled.bypassed
|
|
581
583
|
};
|
|
@@ -622,20 +624,18 @@ const checkAll = /* @__PURE__ */ Effect.fnUntraced(function* (checks, request, i
|
|
|
622
624
|
};
|
|
623
625
|
});
|
|
624
626
|
/**
|
|
625
|
-
*
|
|
626
|
-
* then registration name, on the refs none before it refused, so a ref's first
|
|
627
|
+
* `before`, the refusals so far, with the refs among `updates` the registered checks refuse: each in
|
|
628
|
+
* turn, by band then registration name, on the refs none before it refused, so a ref's first
|
|
629
|
+
* refusal is its answer.
|
|
627
630
|
*/
|
|
628
|
-
const registeredAfter = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input,
|
|
629
|
-
const refused = new Map(
|
|
631
|
+
const registeredAfter = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, moved, before) {
|
|
632
|
+
const refused = new Map(before);
|
|
630
633
|
for (const { handler } of checks.registered?.() ?? []) {
|
|
631
|
-
const updates =
|
|
634
|
+
const updates = moved.filter((update) => !refused.has(update.ref));
|
|
632
635
|
if (updates.length === 0) break;
|
|
633
636
|
for (const [ref, error] of yield* handler(input, updates)) if (!refused.has(ref)) refused.set(ref, error);
|
|
634
637
|
}
|
|
635
|
-
return
|
|
636
|
-
...ruled,
|
|
637
|
-
refused
|
|
638
|
-
};
|
|
638
|
+
return refused;
|
|
639
639
|
});
|
|
640
640
|
/** Whether a push has anything to check: a rule, a registered check, or a hook group. */
|
|
641
641
|
const checksOf = /* @__PURE__ */ Effect.fnUntraced(function* (core) {
|
|
@@ -897,7 +897,7 @@ const lists = (body, own) => body.delete.some((key) => key.collection === own.co
|
|
|
897
897
|
* only, refused as the commit would be, its `writes` or none, and answered before it, for
|
|
898
898
|
* `checkPush`: nothing before that point writes, reserves or enqueues, with no pack.
|
|
899
899
|
*/
|
|
900
|
-
const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRepo, view, views, heldAt }, key, answers, checking = false) => Effect.scoped(Effect.gen(function* () {
|
|
900
|
+
const pushOnto = (request, { listed, defaultBranch, mark, roots, hasLooseRows, repo: checkedRepo, view, views, heldAt }, key, answers, checking = false) => Effect.scoped(Effect.gen(function* () {
|
|
901
901
|
const core = yield* CoreParts;
|
|
902
902
|
const { objects: sealed, fetchLimits, files = defaultPushFiles, repo: repoSizes = defaultPushRepo } = yield* ObjectsParts;
|
|
903
903
|
const authorize = yield* Authorize;
|
|
@@ -995,7 +995,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
995
995
|
});
|
|
996
996
|
const headsOf = (edit) => edit.to === null ? void 0 : request.publishes?.get(edit.ref);
|
|
997
997
|
const publishedAt = Effect.fnUntraced(function* (refs, at, index) {
|
|
998
|
-
const plain = request.edits.filter((edit) => headsOf(edit) === void 0);
|
|
998
|
+
const plain = request.edits.filter((edit) => headsOf(edit) === void 0 && !movesAsGitsOwn(hidden, request.as, edit.ref));
|
|
999
999
|
const refused = new Map(yield* unpublishedAt(refs, at, index, refView, plain, ownOf));
|
|
1000
1000
|
for (const edit of request.edits) {
|
|
1001
1001
|
const heads = headsOf(edit);
|
|
@@ -1038,9 +1038,10 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1038
1038
|
const fence = fenceAll(request, decidingFor(request).map((one) => core.fences(one, target)));
|
|
1039
1039
|
const ready = objects.readyShallow && request.edits.some((edit) => edit.ref === defaultBranch || edit.ref.startsWith("refs/tags/"));
|
|
1040
1040
|
const jobs = (received?.change.add?.length ?? 0) > 0 || isStagedReceive(received) || ready ? [core.repackJobRow()] : [];
|
|
1041
|
-
const own = updates.filter((update) =>
|
|
1042
|
-
const outside = updates.filter((update) => !
|
|
1043
|
-
const
|
|
1041
|
+
const own = updates.filter((update) => movesAsGitsOwn(hidden, request.as, update.ref));
|
|
1042
|
+
const outside = updates.filter((update) => !movesAsGitsOwn(hidden, request.as, update.ref));
|
|
1043
|
+
const segments = own.filter((update) => anyoneMoves(hidden, update.ref));
|
|
1044
|
+
const checks = outside.length === 0 && segments.length === 0 ? void 0 : yield* checksOf(core);
|
|
1044
1045
|
const branches = request.source === "queue" ? [] : outside.map((update) => update.ref).filter((ref) => ref.startsWith("refs/heads/") && isRefName(ref));
|
|
1045
1046
|
const touched = updates.map(({ ref }) => ref).filter(isRefName);
|
|
1046
1047
|
const scope = yield* callScope;
|
|
@@ -1088,14 +1089,14 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1088
1089
|
let checked;
|
|
1089
1090
|
for (let tries = 0; tries < 10; tries += 1) {
|
|
1090
1091
|
const at = yield* Clock.currentTimeMillis;
|
|
1091
|
-
const decide = yield* finalRead(
|
|
1092
|
-
const { read, receipt, outbox, record,
|
|
1092
|
+
const decide = yield* finalRead(core, target, fence, received, key, mark, branches, touched, request.guard, request.writes?.unchanged, tries > 0 || hasLooseRows);
|
|
1093
|
+
const { read, receipt, outbox, record, mirrorJobs, facts, stats, times, queued, reserved, indexRow } = decide;
|
|
1093
1094
|
const indexed = SealedObjects.whole(sealed, pushWhole).index?.status(indexRow, at, listedIds(decide.at, received?.change));
|
|
1094
1095
|
if (receipt !== void 0) return yield* answers.held(receipt);
|
|
1095
1096
|
const published = yield* publishedAt(read.refs, decide.at, indexRow);
|
|
1096
1097
|
const { writes } = request;
|
|
1097
1098
|
if (writes !== void 0 && (writes.unchanged === void 0 ? read.version !== writes.version : decide.changed)) return yield* Effect.fail(queueMoved(repo));
|
|
1098
|
-
const rowsMoved = received === void 0 ? noRows : yield* rowsAtCommit(store, listed.repo, received.change, read.version);
|
|
1099
|
+
const rowsMoved = received === void 0 ? noRows : (times.loose?.objects ?? 0) === 0 ? received.change.rows : yield* rowsAtCommit(store, listed.repo, received.change, read.version, decide.counts);
|
|
1099
1100
|
if (rowsMoved === void 0) continue;
|
|
1100
1101
|
const added = addedBytes(received?.change, rowsMoved);
|
|
1101
1102
|
const sized = repoChecked(repoSizes, stats.ownBytes, added);
|
|
@@ -1120,17 +1121,25 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1120
1121
|
...changing,
|
|
1121
1122
|
signal: unaborted
|
|
1122
1123
|
};
|
|
1123
|
-
if (by !== void 0) judging.covered = coveredTips(read.refs, by.covers);
|
|
1124
|
+
if (by !== void 0) judging.covered = coveredTips(read.refs, (ref) => by.covers(ref) && !movesAsGitsOwn(hidden, request.as, ref));
|
|
1124
1125
|
if (by !== void 0) judging.refuses = by.refuses;
|
|
1125
1126
|
if (by?.covers(read.head) === true) judging.defaultTip = read.refs.get(read.head);
|
|
1126
1127
|
return commitChangesOf(judging, updates);
|
|
1127
1128
|
}
|
|
1128
1129
|
};
|
|
1129
|
-
|
|
1130
|
+
const ruled = outside.length === 0 ? void 0 : yield* checkAll(checks, request, input, seen, (one) => (operation) => authorize.check({
|
|
1130
1131
|
caller: one,
|
|
1131
1132
|
operation,
|
|
1132
1133
|
repo: checkedRepo
|
|
1133
1134
|
}));
|
|
1135
|
+
checked = {
|
|
1136
|
+
facts: seen,
|
|
1137
|
+
updates: [],
|
|
1138
|
+
filesAllowed: /* @__PURE__ */ new Map(),
|
|
1139
|
+
bypassed: /* @__PURE__ */ new Map(),
|
|
1140
|
+
...ruled,
|
|
1141
|
+
refused: yield* registeredAfter(checks, input, segments, ruled?.refused ?? input.refused)
|
|
1142
|
+
};
|
|
1134
1143
|
} else if (checked !== void 0 && !factsHeld(checked.facts, seen)) return yield* Effect.fail(changedWhileChecked());
|
|
1135
1144
|
if (checked?.whole !== void 0) return yield* Effect.fail(checked.whole);
|
|
1136
1145
|
const decided = checked === void 0 ? {
|
|
@@ -1183,7 +1192,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1183
1192
|
if (yield* settleName(store, scope, settling)) continue;
|
|
1184
1193
|
const envelope = repoEnvelope(caller, name);
|
|
1185
1194
|
const id = newChangeId();
|
|
1186
|
-
const shown = planned.moved.filter((move) => !
|
|
1195
|
+
const shown = planned.moved.filter((move) => !movesAsGitsOwn(core.hiddenRefs(), request.as, move.ref));
|
|
1187
1196
|
const optionsPast = pushOptionsProblem(request.pushOptions, shown.length);
|
|
1188
1197
|
if (optionsPast !== void 0) return yield* Effect.fail(optionsPast);
|
|
1189
1198
|
const push = pushOf(core.access, id, shown, request);
|
|
@@ -1212,6 +1221,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1212
1221
|
const pushed = pushedRows(core.access, shown, times, at);
|
|
1213
1222
|
const moved = planned.moves ? rowsMoved : noRows;
|
|
1214
1223
|
const loose = looseRows(times.loose, moved);
|
|
1224
|
+
const foldLoose = moved.bytes > 0 && (loose[0]?.value.bytes ?? 0) > 16777216 ? [core.repackJobRow()] : [];
|
|
1215
1225
|
const body = {
|
|
1216
1226
|
id,
|
|
1217
1227
|
expect: planned.expect,
|
|
@@ -1233,7 +1243,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1233
1243
|
jobs: withJobs([
|
|
1234
1244
|
...planned.jobs,
|
|
1235
1245
|
...appended.jobs,
|
|
1236
|
-
...mirrorJobs(
|
|
1246
|
+
...mirrorJobs?.(planned.moved) ?? [],
|
|
1237
1247
|
...writes?.jobs ?? [],
|
|
1238
1248
|
...woken,
|
|
1239
1249
|
...shown.length > 0 ? indexJobs(core, indexed) : [],
|
|
@@ -1241,7 +1251,8 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1241
1251
|
], [
|
|
1242
1252
|
...kept.jobs,
|
|
1243
1253
|
...also?.jobs ?? [],
|
|
1244
|
-
...rooted?.jobs ?? []
|
|
1254
|
+
...rooted?.jobs ?? [],
|
|
1255
|
+
...foldLoose
|
|
1245
1256
|
])
|
|
1246
1257
|
};
|
|
1247
1258
|
const objects = (received?.change.put?.length ?? 0) + (received?.change.delete?.length ?? 0);
|
|
@@ -1338,4 +1349,24 @@ const keyedPushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answ
|
|
|
1338
1349
|
});
|
|
1339
1350
|
/** `keyedPushWith` for `refs.update`, answering the decide's ref answer. */
|
|
1340
1351
|
const keyedPush = (request, keyed) => keyedPushWith(request, refsAnswers, keyed);
|
|
1341
|
-
|
|
1352
|
+
/**
|
|
1353
|
+
* Whether `error` refuses a push until upkeep runs, by its reason: `awaitingRepack`'s, or
|
|
1354
|
+
* `awaitingUpkeep`'s for a repo whose published batches are at `batchesMost`.
|
|
1355
|
+
*/
|
|
1356
|
+
const isAwaitingUpkeep = (error) => error.code === "UNAVAILABLE" && (error.context?.reason === "packs-awaiting-repack" || error.context?.reason === "batches-awaiting-upkeep");
|
|
1357
|
+
/**
|
|
1358
|
+
* The repo's `git.repack` row made due, for a push refused `packs-awaiting-repack`, so its hint
|
|
1359
|
+
* holds: added if it's gone, and retried if it spent its tries, since an add leaves a failed row
|
|
1360
|
+
* failed, its data rebuilt once it has compacted. A row already waiting or running is left as it is.
|
|
1361
|
+
* A repo deleted since the push read it takes none, as its purge may have dropped its scope (#1911).
|
|
1362
|
+
*/
|
|
1363
|
+
const ensureRepack = /* @__PURE__ */ Effect.fnUntraced(function* (core, jobs, repo, fetchLimits) {
|
|
1364
|
+
if (!(yield* heldAdd(heldStore(core.store), repo, fetchLimits, { jobs: [core.repackJobRow()] }).pipe(Effect.as(true), Effect.catchTag("RepoGone", () => Effect.succeed(false))))) return;
|
|
1365
|
+
const scope = repoScope(repo);
|
|
1366
|
+
const job = {
|
|
1367
|
+
name: repackJobName,
|
|
1368
|
+
key: repackJobKey
|
|
1369
|
+
};
|
|
1370
|
+
yield* storeCall(jobs.retry(scope, job)).pipe(Effect.catchIf(notFailed, () => Effect.void));
|
|
1371
|
+
});
|
|
1372
|
+
export { buildFence, checkPush, ensureRepack, gitPush, isQueueMoved, keyedGitPush, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|
package/dist/core/receipts.d.mts
CHANGED
|
@@ -3,6 +3,6 @@ import "../contracts/refs.mjs";
|
|
|
3
3
|
import "../contracts/repos.mjs";
|
|
4
4
|
import "../contracts/result.mjs";
|
|
5
5
|
import "../store/records.mjs";
|
|
6
|
-
import "
|
|
6
|
+
import { JobInput, Key, Moment, Read, Row } from "@ref0/infra";
|
|
7
7
|
import "effect/Schema";
|
|
8
|
-
import
|
|
8
|
+
import "effect/Effect";
|
package/dist/core/receipts.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { fail, gitErrorFrom, httpStatus } from "../contracts/result.mjs";
|
|
|
2
2
|
import { decodeRow } from "../store/errors.mjs";
|
|
3
3
|
import { KeptRepoInfo, keyLive } from "../store/records.mjs";
|
|
4
4
|
import { collections } from "../store/scopes.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
|
// src/core/receipts.ts
|
|
8
8
|
/**
|
|
9
9
|
* A receipt row's day, in milliseconds. It's `keyKept` at least, so a receipt `keyKept` hasn't
|
|
@@ -63,7 +63,13 @@ const KeptAnswer = /* @__PURE__ */ Schema.Union([
|
|
|
63
63
|
answer: Schema.Json
|
|
64
64
|
}),
|
|
65
65
|
Schema.Struct({ kind: Schema.Literal("done") }),
|
|
66
|
-
Schema.Struct({ kind: Schema.Literal("fork") })
|
|
66
|
+
Schema.Struct({ kind: Schema.Literal("fork") }),
|
|
67
|
+
Schema.Struct({
|
|
68
|
+
kind: Schema.Literal("deepen"),
|
|
69
|
+
run: Schema.String,
|
|
70
|
+
info: Schema.optionalKey(KeptRepoInfo),
|
|
71
|
+
error: Schema.optionalKey(KeptError)
|
|
72
|
+
})
|
|
67
73
|
]);
|
|
68
74
|
/**
|
|
69
75
|
* A keyed write's receipt, in the scope it wrote, saved in the write's own commit: the input its
|
|
@@ -260,6 +266,7 @@ const receiptAnswered = (held) => {
|
|
|
260
266
|
case "queue":
|
|
261
267
|
case "done": return true;
|
|
262
268
|
case "fork": return true;
|
|
269
|
+
case "deepen": return held.answer.info !== void 0 || held.answer.error !== void 0;
|
|
263
270
|
}
|
|
264
271
|
};
|
|
265
272
|
/** The answer a repo create, update or rename's receipt kept, for the write sent again. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { storeCommit } from "../store/errors.mjs";
|
|
2
|
-
import { currentRepo, gitJob } from "../store/job-try.mjs";
|
|
2
|
+
import { currentRepo, gitJob, jobTryTimeout } from "../store/job-try.mjs";
|
|
3
3
|
import { readRecord } from "../store/repo-record.mjs";
|
|
4
4
|
import { newChangeId, repoScope, selfKey } from "../store/scopes.mjs";
|
|
5
5
|
import { copyRead, indexCopies, indexRowKeys, otherRowsReads, ownRowsRead } from "./ref-index.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Schema from "effect/Schema";
|
|
8
6
|
import { Job } from "@ref0/infra";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
9
|
// src/core/ref-index-job.ts
|
|
10
10
|
/**
|
|
11
11
|
* `git.ref-index`, a repo's ref index rebuilt under the server's stamp (#668), as
|
|
@@ -157,7 +157,7 @@ const rebuildTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
|
|
|
157
157
|
const rebuildFailed = (_data, failure) => Effect.flatMap(currentRepo, (repo) => Effect.logError(`git.ref-index left repo ${repo}'s ref index stale: ${failure.error instanceof Error ? failure.error.message : String(failure.error)}`));
|
|
158
158
|
const RefIndexJob = /* @__PURE__ */ Job.make(refIndexJobName, {
|
|
159
159
|
payload: RefIndexJobData,
|
|
160
|
-
timeout:
|
|
160
|
+
timeout: jobTryTimeout,
|
|
161
161
|
retry: {
|
|
162
162
|
limit: 10,
|
|
163
163
|
delay: "1 second",
|