@ref0/git 0.12.0 → 0.20.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 +3 -3
- package/dist/auth/access-jwt.mjs +2 -2
- package/dist/auth/auth.d.mts +2 -2
- package/dist/auth/auth.mjs +3 -6
- package/dist/auth/authorize.mjs +4 -20
- package/dist/auth/fences.d.mts +1 -2
- package/dist/auth/fences.mjs +3 -3
- package/dist/auth/grants.mjs +4 -4
- package/dist/auth/helpers.mjs +3 -11
- package/dist/auth/host-function.mjs +18 -1
- package/dist/auth/host-services.mjs +11 -0
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +3 -3
- package/dist/auth/policy.d.mts +27 -7
- package/dist/auth/policy.mjs +8 -4
- package/dist/auth/token-cleanup.mjs +67 -0
- package/dist/auth/token-rows.mjs +1 -1
- package/dist/auth/token-text.mjs +9 -1
- package/dist/auth/tokens-base.d.mts +35 -0
- package/dist/auth/tokens-base.mjs +13 -0
- package/dist/auth/tokens-layer.d.mts +2 -28
- package/dist/auth/tokens-layer.mjs +6 -12
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +7 -17
- package/dist/auth/tokens.mjs +9 -87
- package/dist/auth.d.mts +1 -4
- package/dist/auth.mjs +1 -3
- package/dist/client/answer.mjs +21 -42
- package/dist/client/client.d.mts +2 -4
- package/dist/client/git-http.mjs +35 -11
- package/dist/client/local.mjs +14 -13
- package/dist/client/push-upload.mjs +39 -12
- package/dist/client/remote.mjs +95 -31
- package/dist/client/run-remote-helper.d.mts +1 -0
- package/dist/client/run-remote-helper.mjs +58 -24
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +105 -46
- package/dist/contracts/access.d.mts +8 -8
- package/dist/contracts/actors.d.mts +2 -34
- package/dist/contracts/blobs.d.mts +57 -10
- package/dist/contracts/blobs.mjs +16 -2
- package/dist/contracts/call-allowance.d.mts +13 -0
- package/dist/contracts/call-allowance.mjs +44 -0
- package/dist/contracts/calls-spent.mjs +8 -3
- package/dist/contracts/client.d.mts +23 -19
- package/dist/contracts/commits.d.mts +34 -26
- package/dist/contracts/commits.mjs +9 -1
- package/dist/contracts/engine.d.mts +6 -1
- package/dist/contracts/engine.mjs +10 -1
- package/dist/contracts/files.d.mts +12 -12
- package/dist/contracts/forks.d.mts +27 -17
- package/dist/contracts/git-events.d.mts +29 -1
- package/dist/contracts/git-hooks.d.mts +1 -1
- package/dist/contracts/git.d.mts +39 -7
- package/dist/contracts/git.mjs +3 -2
- package/dist/contracts/grants.d.mts +24 -4
- package/dist/contracts/handlers.d.mts +1 -1
- package/dist/contracts/lfs.d.mts +28 -9
- package/dist/contracts/merges.d.mts +3 -2
- package/dist/contracts/objects.d.mts +103 -35
- package/dist/contracts/operations.d.mts +3 -0
- package/dist/contracts/operations.mjs +12 -2
- package/dist/contracts/push-uploads.d.mts +44 -5
- package/dist/contracts/push-uploads.mjs +7 -3
- package/dist/contracts/queue.d.mts +40 -12
- package/dist/contracts/queue.mjs +3 -4
- package/dist/contracts/refs.d.mts +50 -25
- package/dist/contracts/remote.d.mts +6 -7
- package/dist/contracts/remote.mjs +5 -4
- package/dist/contracts/repo-records.d.mts +1 -0
- package/dist/contracts/repos.d.mts +106 -127
- package/dist/contracts/repos.mjs +33 -4
- package/dist/contracts/result.d.mts +49 -25
- package/dist/contracts/result.mjs +52 -11
- package/dist/contracts/rules.d.mts +22 -22
- package/dist/contracts/server.d.mts +37 -111
- package/dist/contracts/services.d.mts +1 -1
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/store.d.mts +6 -5
- package/dist/contracts/sync.d.mts +90 -26
- package/dist/contracts/sync.mjs +45 -11
- package/dist/contracts/tags.d.mts +10 -10
- package/dist/contracts/time.d.mts +3 -0
- package/dist/contracts/{promises.mjs → time.mjs} +1 -1
- package/dist/contracts/tokens.d.mts +15 -22
- package/dist/contracts/tokens.mjs +3 -3
- package/dist/contracts/topics.d.mts +1 -6
- package/dist/contracts/trees.d.mts +12 -12
- package/dist/contracts/work.d.mts +87 -12
- package/dist/contracts/work.mjs +8 -1
- package/dist/core/access.d.mts +1 -2
- package/dist/core/access.mjs +46 -13
- package/dist/core/ancestry.d.mts +10 -0
- package/dist/core/ancestry.mjs +6 -6
- package/dist/core/asked.mjs +43 -5
- package/dist/core/call-names.mjs +7 -1
- package/dist/core/call-services.mjs +13 -4
- package/dist/core/events/deliver.d.mts +1 -2
- package/dist/core/events/deliver.mjs +48 -33
- package/dist/core/events/retired.mjs +119 -0
- package/dist/core/forks.mjs +931 -435
- package/dist/core/hooks/groups.mjs +1 -1
- package/dist/core/imports.mjs +159 -15
- package/dist/core/index-job.mjs +128 -37
- package/dist/core/index-lost.d.mts +1 -2
- package/dist/core/index-lost.mjs +2 -2
- package/dist/core/job-view.mjs +8 -9
- package/dist/core/loose-tally.mjs +1 -1
- package/dist/core/mirror-rows.mjs +19 -4
- package/dist/core/objects/blobs.mjs +129 -3
- package/dist/core/objects/commits.mjs +16 -6
- package/dist/core/objects/lines.mjs +2 -2
- package/dist/core/objects/merges.mjs +4 -1
- package/dist/core/objects/objects-layer.d.mts +1 -1
- package/dist/core/objects/objects-layer.mjs +3 -3
- package/dist/core/objects/reading.mjs +24 -13
- package/dist/core/objects/tags.mjs +4 -1
- package/dist/core/objects/trees.mjs +2 -2
- package/dist/core/objects/writing.mjs +2 -2
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +10 -6
- package/dist/core/parts.mjs +3 -11
- package/dist/core/promise.mjs +9 -12
- package/dist/core/purge.mjs +316 -42
- package/dist/core/push-decide.mjs +3 -1
- package/dist/core/push-files.d.mts +12 -0
- package/dist/core/push-files.mjs +225 -0
- package/dist/core/push-repo.d.mts +8 -0
- package/dist/core/push-repo.mjs +56 -0
- package/dist/core/push.d.mts +17 -0
- package/dist/core/push.mjs +153 -70
- package/dist/core/receipts.mjs +34 -13
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +61 -7
- package/dist/core/refs.mjs +18 -13
- package/dist/core/registered-rows.mjs +2 -2
- package/dist/core/repack.mjs +46 -28
- package/dist/core/repo-info.mjs +19 -12
- package/dist/core/repos.mjs +50 -22
- package/dist/core/rules/commit-changes.d.mts +0 -1
- package/dist/core/saved-caller-views.d.mts +7 -2
- package/dist/core/saved-caller-views.mjs +2 -2
- package/dist/core/saved-callers.d.mts +19 -2
- package/dist/core/seam.d.mts +16 -26
- package/dist/core/seam.mjs +7 -28
- package/dist/core/tokens.mjs +1 -1
- package/dist/core/view.d.mts +6 -0
- package/dist/core/view.mjs +51 -26
- package/dist/core/work.mjs +105 -35
- package/dist/effect.d.mts +5 -12
- package/dist/effect.mjs +3 -10
- package/dist/engine/failures.mjs +2 -1
- package/dist/engine/reads.mjs +17 -10
- package/dist/engine/walk.mjs +4 -4
- 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 +3 -3
- package/dist/event-streams/stream.mjs +38 -15
- package/dist/extend.d.mts +4 -5
- package/dist/extend.mjs +3 -2
- package/dist/http/answers.mjs +12 -7
- package/dist/http/core-parts.mjs +129 -64
- package/dist/http/handler.mjs +36 -9
- package/dist/http/node.d.mts +14 -1
- package/dist/http/node.mjs +61 -31
- package/dist/http/parts.d.mts +2 -0
- package/dist/http/push-upload-job.mjs +507 -0
- package/dist/http/push-uploads.d.mts +1 -0
- package/dist/http/push-uploads.mjs +142 -69
- package/dist/http/upload-pack.mjs +10 -9
- package/dist/index.d.mts +27 -28
- package/dist/index.mjs +5 -8
- package/dist/lfs/answer.mjs +37 -0
- package/dist/lfs/base.d.mts +9 -3
- package/dist/lfs/base.mjs +27 -2
- package/dist/lfs/copy.d.mts +60 -0
- package/dist/lfs/copy.mjs +109 -0
- package/dist/lfs/layer.d.mts +15 -1
- package/dist/lfs/layer.mjs +28 -13
- package/dist/lfs/locks.mjs +2 -2
- package/dist/lfs/objects.d.mts +7 -0
- package/dist/lfs/objects.mjs +152 -55
- package/dist/lfs/pointers.mjs +2 -2
- package/dist/lfs/rows.d.mts +13 -0
- package/dist/lfs/rows.mjs +42 -8
- package/dist/lfs/service.d.mts +1 -7
- package/dist/lfs/service.mjs +1 -9
- package/dist/lfs/upkeep.mjs +48 -14
- package/dist/lfs/upload-most.mjs +5 -5
- package/dist/lfs/wire.mjs +6 -31
- package/dist/merges/merges.mjs +2 -2
- package/dist/node.d.mts +3 -3
- package/dist/protocol/bytes/buffers.mjs +13 -5
- package/dist/protocol/bytes/reader.mjs +6 -1
- package/dist/protocol/bytes/sha256-hasher.d.mts +15 -0
- package/dist/protocol/bytes/sha256.d.mts +32 -0
- package/dist/protocol/bytes/sha256.mjs +105 -49
- package/dist/protocol/bytes/streams.mjs +27 -1
- package/dist/protocol/diff/read.d.mts +4 -3
- package/dist/protocol/diff/read.mjs +8 -3
- package/dist/protocol/objects/lfs-pointer.d.mts +14 -2
- package/dist/protocol/objects/lfs-pointer.mjs +1 -3
- package/dist/protocol/objects/links-raw.mjs +24 -10
- package/dist/protocol/objects/tag.d.mts +1 -1
- package/dist/protocol/objects/tree.mjs +23 -6
- package/dist/protocol/packs/delta.d.mts +6 -3
- package/dist/protocol/packs/delta.mjs +96 -32
- package/dist/protocol/packs/idx.d.mts +2 -1
- package/dist/protocol/packs/idx.mjs +22 -3
- package/dist/protocol/packs/parts.d.mts +4 -1
- package/dist/protocol/packs/parts.mjs +10 -7
- package/dist/protocol/packs/reader.d.mts +5 -0
- package/dist/protocol/packs/reader.mjs +3 -2
- package/dist/protocol/packs/writer.mjs +26 -8
- package/dist/protocol/wire/advertisement.mjs +9 -4
- package/dist/protocol/wire/lines.d.mts +4 -2
- package/dist/protocol/wire/lines.mjs +11 -5
- package/dist/protocol/wire/push-uploads.mjs +13 -1
- package/dist/protocol/wire/v2.mjs +2 -2
- package/dist/protocol.d.mts +3 -1
- package/dist/protocol.mjs +3 -1
- package/dist/queue/advance.mjs +22 -25
- package/dist/queue/base.d.mts +55 -0
- package/dist/queue/base.mjs +44 -0
- package/dist/queue/calls.mjs +51 -54
- package/dist/queue/commit.mjs +1 -1
- package/dist/queue/host.d.mts +2 -22
- package/dist/queue/host.mjs +2 -13
- package/dist/queue/layer.d.mts +2 -1
- package/dist/queue/layer.mjs +11 -4
- package/dist/queue/limits.mjs +2 -0
- package/dist/queue/push-option.mjs +9 -24
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/state.mjs +2 -10
- package/dist/queue/trim.mjs +6 -4
- package/dist/rest/blobs.mjs +29 -5
- package/dist/rest/caller.d.mts +4 -4231
- package/dist/rest/caller.mjs +5 -1
- package/dist/rest/client.d.mts +15 -5
- package/dist/rest/client.mjs +23 -2
- package/dist/rest/events.mjs +1 -2
- package/dist/rest/handler.mjs +4 -57
- package/dist/rest/handlers.mjs +68 -9
- package/dist/rest/layer.d.mts +2 -2
- package/dist/rest/layer.mjs +7 -13
- package/dist/rest/me.d.mts +3 -428
- package/dist/rest/paths.mjs +1 -0
- package/dist/rest/work.mjs +8 -0
- package/dist/server/check-fetch.mjs +3 -3
- package/dist/server/edge-node.d.mts +14 -15
- package/dist/server/edge-node.mjs +12 -12
- package/dist/server/edge.d.mts +21 -7
- package/dist/server/edge.mjs +32 -11
- package/dist/server/extension.mjs +1 -1
- package/dist/server/git-layer.d.mts +6 -11
- package/dist/server/git-layer.mjs +29 -23
- package/dist/server/git-namespace.d.mts +5 -4
- package/dist/server/git-namespace.mjs +3 -2
- package/dist/server/joined.d.mts +21 -40
- package/dist/server/joined.mjs +11 -62
- package/dist/server/lifecycle.mjs +65 -69
- package/dist/server/registry.mjs +28 -3
- package/dist/server/server.mjs +245 -465
- package/dist/signin/context.d.mts +1 -2
- package/dist/signin/layer.d.mts +1 -1
- package/dist/signin/layer.mjs +1 -1
- package/dist/storage/allotted.mjs +18 -3
- package/dist/storage/batch-upkeep.mjs +274 -0
- package/dist/{core/purge.d.mts → storage/batches.d.mts} +4 -4
- package/dist/storage/batches.mjs +344 -0
- package/dist/storage/budget.mjs +2 -2
- package/dist/storage/calls.d.mts +1 -2
- package/dist/storage/calls.mjs +144 -158
- package/dist/storage/chunks.d.mts +9 -0
- package/dist/storage/chunks.mjs +297 -0
- package/dist/storage/clean-up.mjs +85 -19
- package/dist/storage/counted-bucket.mjs +4 -4
- package/dist/storage/fetch.d.mts +1 -0
- package/dist/storage/fetch.mjs +298 -216
- package/dist/storage/file-limits.mjs +24 -0
- package/dist/storage/host-bucket.mjs +1 -2
- package/dist/storage/id-mix.mjs +19 -5
- package/dist/storage/index-bitmaps.mjs +9 -2
- package/dist/storage/index-build.d.mts +1 -1
- package/dist/storage/index-build.mjs +185 -84
- package/dist/storage/index-fetch.mjs +128 -74
- package/dist/storage/index-files.d.mts +3 -0
- package/dist/storage/index-files.mjs +10 -5
- package/dist/storage/index-graph.mjs +72 -22
- package/dist/storage/index-reach.mjs +33 -5
- package/dist/storage/index-remap.mjs +208 -65
- package/dist/storage/index-shallow.mjs +5 -3
- package/dist/storage/index-whole.mjs +127 -0
- package/dist/storage/largest-files.mjs +48 -0
- package/dist/storage/layout.mjs +23 -0
- package/dist/storage/lfs-pointers.mjs +10 -1
- package/dist/storage/loose.d.mts +7 -4
- package/dist/storage/loose.mjs +214 -67
- package/dist/storage/memory-budget.mjs +44 -8
- package/dist/storage/merge-plan.mjs +3 -2
- package/dist/storage/merge-row.mjs +7 -1
- package/dist/storage/merge-stream.mjs +164 -25
- package/dist/storage/merge-walk.mjs +8 -4
- package/dist/storage/merge-write.mjs +1 -1
- package/dist/storage/merge.d.mts +1 -1
- package/dist/storage/merge.mjs +1 -1
- package/dist/storage/object-rows.d.mts +1 -0
- package/dist/storage/object-rows.mjs +385 -65
- package/dist/storage/oid-table.mjs +171 -0
- package/dist/storage/pack-order.mjs +8 -4
- package/dist/storage/pack-ranges.d.mts +1 -2
- package/dist/storage/pack-ranges.mjs +4 -5
- package/dist/storage/pack-reads.d.mts +2 -1
- package/dist/storage/pack-reads.mjs +165 -49
- package/dist/storage/pack-receive.d.mts +1 -1
- package/dist/storage/pack-receive.mjs +85 -27
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +172 -86
- package/dist/storage/placed-reads.mjs +1 -1
- package/dist/storage/plan-columns.d.mts +4 -0
- package/dist/storage/plan-columns.mjs +238 -0
- package/dist/storage/prune-keep.mjs +299 -37
- package/dist/storage/prune-walk.mjs +240 -62
- package/dist/storage/prune.mjs +749 -213
- package/dist/storage/push-allotment.mjs +91 -12
- package/dist/storage/push-uploads.mjs +40 -16
- package/dist/storage/pushed-commits.mjs +4 -2
- package/dist/storage/quarantine.d.mts +1 -1
- package/dist/storage/quarantine.mjs +9 -9
- package/dist/storage/range-cache.mjs +125 -8
- package/dist/storage/ready.d.mts +1 -1
- package/dist/storage/ready.mjs +55 -25
- package/dist/storage/receive-bounds.mjs +51 -15
- package/dist/storage/receive-state.mjs +8 -0
- package/dist/storage/receive-steps.mjs +71 -18
- package/dist/storage/repack-backlog.mjs +6 -3
- package/dist/storage/repack.d.mts +2 -2
- package/dist/storage/repack.mjs +1 -8
- package/dist/storage/rows.d.mts +1 -1
- package/dist/storage/rows.mjs +13 -2
- package/dist/storage/runs.mjs +195 -43
- package/dist/storage/send-list.d.mts +1 -0
- package/dist/storage/send-list.mjs +54 -10
- package/dist/storage/shallow.d.mts +1 -0
- package/dist/storage/shallow.mjs +26 -4
- package/dist/storage/single-flight.mjs +13 -7
- package/dist/storage/stream-whole.mjs +132 -28
- package/dist/storage/unpack.mjs +371 -79
- package/dist/storage/visible.mjs +31 -3
- package/dist/storage/walk.mjs +194 -39
- package/dist/storage/wants.mjs +5 -5
- package/dist/store/bodies.mjs +38 -0
- package/dist/store/call-count.d.mts +8 -12
- package/dist/store/call-count.mjs +34 -46
- package/dist/store/catalogue.d.mts +2 -2
- package/dist/store/catalogue.mjs +146 -35
- package/dist/store/crossing.mjs +1 -3
- package/dist/store/cursor-seal-namespace.d.mts +2 -0
- package/dist/store/cursor-seal-public.d.mts +5 -0
- package/dist/store/cursor-seal-public.mjs +5 -0
- package/dist/store/cursor-seal.d.mts +16 -3
- package/dist/store/cursor-seal.mjs +40 -18
- package/dist/store/door.mjs +183 -0
- package/dist/store/errors.d.mts +3 -4
- package/dist/store/errors.mjs +24 -34
- package/dist/store/git-store.mjs +25 -7
- package/dist/store/job-try.mjs +9 -32
- package/dist/store/list-job.mjs +44 -8
- package/dist/store/records.d.mts +5 -0
- package/dist/store/records.mjs +12 -6
- package/dist/store/repo-record.d.mts +10 -9
- package/dist/store/repo-record.mjs +123 -28
- package/dist/store/reservations.mjs +1 -1
- package/dist/store/scopes.mjs +21 -2
- package/dist/store/settle.mjs +4 -4
- package/dist/sync/bound.d.mts +2 -0
- package/dist/sync/bound.mjs +11 -2
- package/dist/sync/github.d.mts +6 -1
- package/dist/sync/github.mjs +56 -44
- package/dist/sync/http.mjs +36 -1
- package/dist/sync/import.mjs +32 -18
- package/dist/sync/layer.mjs +6 -2
- package/dist/sync/lfs-batch.mjs +118 -0
- package/dist/sync/lfs-copy.mjs +262 -0
- package/dist/sync/mirror.mjs +227 -151
- package/dist/sync/said.mjs +16 -37
- package/dist/sync/smart-http.mjs +4 -2
- package/dist/sync/step.mjs +58 -30
- package/dist/sync/tries.mjs +52 -21
- package/dist/sync.d.mts +2 -2
- package/dist/topics/advance.mjs +10 -11
- package/dist/topics/base.d.mts +15 -0
- package/dist/topics/base.mjs +8 -0
- package/dist/topics/host.mjs +2 -20
- package/dist/topics/layer.d.mts +4 -9
- package/dist/topics/layer.mjs +3 -4
- package/dist/topics/members.mjs +4 -4
- package/dist/topics/public.d.mts +2 -1
- package/dist/topics/topic.mjs +2 -2
- package/package.json +5 -9
- package/dist/auth/bridge.mjs +0 -30
- package/dist/auth/helpers.d.mts +0 -17
- package/dist/contracts/promises.d.mts +0 -39
- package/dist/core/call-names.d.mts +0 -3
- package/dist/core/clock.mjs +0 -18
- package/dist/core/registered-rows.d.mts +0 -5
- package/dist/core/repack.d.mts +0 -11
- package/dist/http/handler.d.mts +0 -2
- package/dist/lfs/calls.mjs +0 -26
- package/dist/rest/api.d.mts +0 -23
- package/dist/rest/blobs.d.mts +0 -825
- package/dist/rest/commits.d.mts +0 -3510
- package/dist/rest/errors.d.mts +0 -2104
- package/dist/rest/events.d.mts +0 -423
- package/dist/rest/files.d.mts +0 -1330
- package/dist/rest/forks.d.mts +0 -2136
- package/dist/rest/handler.d.mts +0 -21
- package/dist/rest/handlers.d.mts +0 -8
- package/dist/rest/merges.d.mts +0 -473
- package/dist/rest/queue.d.mts +0 -5861
- package/dist/rest/refs.d.mts +0 -2959
- package/dist/rest/repos.d.mts +0 -2539
- package/dist/rest/tags.d.mts +0 -1304
- package/dist/rest/tokens.d.mts +0 -2590
- package/dist/rest/topics.d.mts +0 -2204
- package/dist/rest/trees.d.mts +0 -1693
- package/dist/rest/work.d.mts +0 -1248
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -1
- package/dist/server/lifecycle.d.mts +0 -2
- package/dist/server/registry.d.mts +0 -16
- package/dist/server/server.d.mts +0 -36
- package/dist/storage/repack-job.d.mts +0 -3
- package/dist/store/promises.d.mts +0 -11
- package/dist/store/promises.mjs +0 -327
- package/dist/topics/host.d.mts +0 -7
package/dist/core/push.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fail, gitError } from "../contracts/result.mjs";
|
|
2
2
|
import { openTreeBytes } from "../storage/budget.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { scopedReceive, walkObjects } from "../storage/calls.mjs";
|
|
4
4
|
import { isUnindexedRead } from "../storage/index-visible.mjs";
|
|
5
5
|
import { openTreesRefusal } from "../storage/push-allotment.mjs";
|
|
6
6
|
import { isLoose } from "../storage/loose.mjs";
|
|
@@ -8,26 +8,30 @@ import { listedIds } from "../storage/listed-ids.mjs";
|
|
|
8
8
|
import { indexRowKey, isPackId, objectCollections } 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 { isAwaitingUpkeep } from "../storage/repack-backlog.mjs";
|
|
12
12
|
import { allottedRows } from "../storage/allotted.mjs";
|
|
13
|
-
import {
|
|
13
|
+
import { chunkedOf } from "../storage/chunks.mjs";
|
|
14
|
+
import { gitObjectOf, headerOfRow, noRows, receivedObject, receivedRows } from "../storage/object-rows.mjs";
|
|
14
15
|
import { pruneClearedKey } from "../storage/prune.mjs";
|
|
15
16
|
import { abandonOwn } from "../storage/quarantine.mjs";
|
|
16
17
|
import { readyBytesOf, readyKey } from "../storage/ready.mjs";
|
|
17
|
-
import { QuarantineRow
|
|
18
|
-
import {
|
|
18
|
+
import { QuarantineRow } from "../storage/rows.mjs";
|
|
19
|
+
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
22
|
import { callScope } from "../store/call-count.mjs";
|
|
20
23
|
import { decodePacks, gitStore } from "../store/git-store.mjs";
|
|
21
24
|
import { WholeRepo, refBytesOf, storesPeel, wholeRefs } from "../store/ref-rows.mjs";
|
|
25
|
+
import { dropBody } from "../protocol/bytes/reader.mjs";
|
|
22
26
|
import { gitsOwnMove, hiddenUnder } from "../protocol/wire/lines.mjs";
|
|
23
27
|
import { sliceOf } from "../protocol/wire/push-limits.mjs";
|
|
24
28
|
import { pushCounts } from "./events/seen.mjs";
|
|
25
29
|
import { refViewIn } from "./ref-view.mjs";
|
|
26
30
|
import { appendEvents, decodeOutbox, firstSeq, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
27
31
|
import { rowsAtCommit } from "./loose-tally.mjs";
|
|
28
|
-
import { MirrorRow } from "./mirror-rows.mjs";
|
|
32
|
+
import { MirrorRow, mirrorJobKey } from "./mirror-rows.mjs";
|
|
29
33
|
import { PrunedMark, mirrorJobName } from "../store/records.mjs";
|
|
30
|
-
import { HeldBy, decodeStats, heldUntil, looseRows, readRecord, repoStats, rootsOf, timeRow } from "../store/repo-record.mjs";
|
|
34
|
+
import { HeldBy, decodeStats, heldUntil, looseRows, movedRoots, readRecord, repoStats, rootsMoved, rootsOf, timeRow } from "../store/repo-record.mjs";
|
|
31
35
|
import { advanceRow } from "../store/queue-jobs.mjs";
|
|
32
36
|
import { liveReservations, reservedTarget } from "../store/reservations.mjs";
|
|
33
37
|
import { settleName } from "../store/settle.mjs";
|
|
@@ -50,9 +54,11 @@ import { ensureRepack } from "./repack.mjs";
|
|
|
50
54
|
import { publishable, unpublished } from "./publish.mjs";
|
|
51
55
|
import { peeledAll, peeledOf } from "../storage/wants.mjs";
|
|
52
56
|
import { CoreParts, ObjectsParts } from "./parts.mjs";
|
|
57
|
+
import { defaultPushFiles, filesChecked } from "./push-files.mjs";
|
|
58
|
+
import { addedBytes, defaultPushRepo, repoChecked } from "./push-repo.mjs";
|
|
53
59
|
import { Authorize, check } from "../contracts/authorize.mjs";
|
|
54
60
|
import { read } from "./objects/objects.mjs";
|
|
55
|
-
import * as Clock
|
|
61
|
+
import * as Clock from "effect/Clock";
|
|
56
62
|
import * as Effect from "effect/Effect";
|
|
57
63
|
import * as Exit from "effect/Exit";
|
|
58
64
|
import * as Result from "effect/Result";
|
|
@@ -164,9 +170,9 @@ const bypassNotes = (updated, bypassed) => updated.updates.flatMap((update) => {
|
|
|
164
170
|
});
|
|
165
171
|
/** A `git push`'s answers: unkeyed, so never kept or held but as `refs.update`'s are. */
|
|
166
172
|
const gitAnswers = {
|
|
167
|
-
answer: (updated, _, bypassed) => Effect.succeed({
|
|
173
|
+
answer: (updated, _, bypassed, warned) => Effect.succeed({
|
|
168
174
|
updated,
|
|
169
|
-
notes: bypassNotes(updated, bypassed)
|
|
175
|
+
notes: [...warned, ...bypassNotes(updated, bypassed)]
|
|
170
176
|
}),
|
|
171
177
|
kept: ({ updated }) => refsKept(updated),
|
|
172
178
|
held: (receipt) => Effect.map(refsAnswer(receipt), (updated) => ({
|
|
@@ -249,8 +255,8 @@ const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operatio
|
|
|
249
255
|
* The refs a push's objects follow, for its view: none read when the view's objects are whole, as
|
|
250
256
|
* for a caller who sees every ref of a repo that isn't a fork under `access`; else every ref the
|
|
251
257
|
* caller sees, read after `authorize` let the caller in, at a version of their own, which the
|
|
252
|
-
* push's objects read at too. `roots` are the first read's:
|
|
253
|
-
*
|
|
258
|
+
* push's objects read at too. `roots` are the first read's: `rootsMoved`, their one writer, moves
|
|
259
|
+
* them with the refs whose history they stop, in one commit.
|
|
254
260
|
*/
|
|
255
261
|
const seenRefsOf = /* @__PURE__ */ Effect.fnUntraced(function* (view, listed, roots) {
|
|
256
262
|
const core = yield* CoreParts;
|
|
@@ -292,7 +298,7 @@ const pushedOf = (objects, listed, received) => {
|
|
|
292
298
|
};
|
|
293
299
|
return (input) => {
|
|
294
300
|
const row = rows.get(input.oid);
|
|
295
|
-
if (row !== void 0) return Effect.map(
|
|
301
|
+
if (row !== void 0) return Effect.map(receivedObject(received.change, row), gitObjectOf);
|
|
296
302
|
return own.packs.length === 0 ? Effect.succeed(void 0) : objects.read(own, {
|
|
297
303
|
...input,
|
|
298
304
|
listedOnly: true
|
|
@@ -303,24 +309,35 @@ const pushedOf = (objects, listed, received) => {
|
|
|
303
309
|
* Whether the push brings commit `oid`, for the file rules' walk: its own object, read as `pushed`
|
|
304
310
|
* reads one, its bytes let go unread. A read that fails throws, so the walk trusts nothing.
|
|
305
311
|
*/
|
|
306
|
-
const broughtCommit = (pushed) => (oid) => Effect.flatMap(pushed({ oid }), (object) => Effect.as(
|
|
307
|
-
/** The refs the repo mirrors, among `rows` of `mirrors`: each one an active mirror names. */
|
|
312
|
+
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. */
|
|
308
314
|
const activeMirrors = /* @__PURE__ */ Effect.fnUntraced(function* (rows) {
|
|
309
|
-
const active = /* @__PURE__ */ new
|
|
310
|
-
for (const row of 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
|
+
}
|
|
311
320
|
return active;
|
|
312
321
|
});
|
|
313
322
|
/**
|
|
314
|
-
* `sync.mirror`'s row for each ref the commit moves
|
|
315
|
-
* name among the jobs the server knows: none until
|
|
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.
|
|
316
326
|
*/
|
|
317
327
|
const mirrorJobs = (core, moved, mirrored) => {
|
|
318
328
|
const definition = core.jobOf?.(mirrorJobName);
|
|
319
329
|
if (definition === void 0) return [];
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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()];
|
|
324
341
|
};
|
|
325
342
|
/** The repo's stored packs and the received pack's, before the commit lists it: a push's changes read both. */
|
|
326
343
|
const withReceived = (listed, received) => received === void 0 ? listed : {
|
|
@@ -329,17 +346,21 @@ const withReceived = (listed, received) => received === void 0 ? listed : {
|
|
|
329
346
|
};
|
|
330
347
|
/** The objects, with the rows a receive puts read first: they're written only by the commit. */
|
|
331
348
|
const withReceivedRows = (objects, received) => {
|
|
332
|
-
const
|
|
349
|
+
const change = received?.change;
|
|
350
|
+
const rows = receivedRows(change);
|
|
333
351
|
if (rows.size === 0) return objects;
|
|
334
|
-
const rowsOf = (oids, each) => Effect.forEach(oids, (oid)
|
|
352
|
+
const rowsOf = (before) => (oids, each) => Effect.forEach(oids, Effect.fnUntraced(function* (oid) {
|
|
335
353
|
const row = rows.get(oid);
|
|
336
|
-
|
|
337
|
-
|
|
354
|
+
if (row === void 0) return;
|
|
355
|
+
const chunked = chunkedOf(row.value);
|
|
356
|
+
if (chunked !== void 0 && before !== void 0 && !(yield* before(oid, chunked.size))) return;
|
|
357
|
+
yield* each(yield* receivedObject(change, row));
|
|
358
|
+
}), { discard: true });
|
|
338
359
|
return {
|
|
339
360
|
...objects,
|
|
340
361
|
read: (listed, input) => {
|
|
341
362
|
const row = rows.get(input.oid);
|
|
342
|
-
return row === void 0 ? objects.read(listed, input) : Effect.map(
|
|
363
|
+
return row === void 0 ? objects.read(listed, input) : Effect.map(receivedObject(change, row), gitObjectOf);
|
|
343
364
|
},
|
|
344
365
|
headers: Effect.fnUntraced(function* (listed, input) {
|
|
345
366
|
const answer = /* @__PURE__ */ new Map();
|
|
@@ -347,11 +368,7 @@ const withReceivedRows = (objects, received) => {
|
|
|
347
368
|
for (const oid of input.oids) {
|
|
348
369
|
const row = rows.get(oid);
|
|
349
370
|
if (row === void 0) continue;
|
|
350
|
-
|
|
351
|
-
answer.set(oid, {
|
|
352
|
-
type: object.type,
|
|
353
|
-
size: object.bytes.byteLength
|
|
354
|
-
});
|
|
371
|
+
answer.set(oid, yield* headerOfRow(row));
|
|
355
372
|
}
|
|
356
373
|
if (stored.length > 0) for (const [oid, header] of yield* objects.headers(listed, {
|
|
357
374
|
...input,
|
|
@@ -426,6 +443,7 @@ const buildFence = (build) => [
|
|
|
426
443
|
*/
|
|
427
444
|
const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fence, received, kept, mark, branches, touched, guard, unchanged = []) {
|
|
428
445
|
const own = received?.quarantine === void 0 ? [] : [received.quarantine];
|
|
446
|
+
const batched = isStagedReceive(received) ? [batchesRead] : [];
|
|
429
447
|
const keyed = receiptReads(kept);
|
|
430
448
|
const targets = branches.map((id) => ({
|
|
431
449
|
collection: collections.queueReservations,
|
|
@@ -446,6 +464,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
446
464
|
indexRowKey,
|
|
447
465
|
reachedKey,
|
|
448
466
|
readyKey,
|
|
467
|
+
repoRootsKey,
|
|
449
468
|
...own,
|
|
450
469
|
...keyed,
|
|
451
470
|
...targets,
|
|
@@ -455,6 +474,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
455
474
|
collection,
|
|
456
475
|
id
|
|
457
476
|
})),
|
|
477
|
+
...batched,
|
|
458
478
|
...touched.map((id) => ({
|
|
459
479
|
collection: collections.mirrors,
|
|
460
480
|
id
|
|
@@ -462,7 +482,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
462
482
|
], rowCounts);
|
|
463
483
|
if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${repo.name}'`);
|
|
464
484
|
const [, refRows = [], headRows = [], cursorRows = [], packRows = [], ...more] = snapshot.results;
|
|
465
|
-
const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], reachedRows = [], readyRows = [], ...rest] = more;
|
|
485
|
+
const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], reachedRows = [], readyRows = [], rootRows = [], ...rest] = more;
|
|
466
486
|
const receipt = yield* heldReceipt(rest.slice(own.length, own.length + keyed.length), kept);
|
|
467
487
|
if (receipt === void 0 && (yield* markOf(markRows)) !== mark) return yield* fail("UNAVAILABLE", "The repo was pruned during the push", { hint: "Push again" });
|
|
468
488
|
const targeted = rest.slice(own.length + keyed.length, own.length + keyed.length + targets.length);
|
|
@@ -478,14 +498,16 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
478
498
|
const guardedAt = guardAt + (guard?.reads.length ?? 0);
|
|
479
499
|
if (guard !== void 0) yield* guard.check(rest.slice(guardAt, guardedAt));
|
|
480
500
|
const now = rest.slice(guardedAt, guardedAt + unchanged.length);
|
|
481
|
-
const
|
|
501
|
+
const batchedAt = guardedAt + unchanged.length;
|
|
502
|
+
const batchRows = batched.length === 0 ? void 0 : rest[batchedAt] ?? [];
|
|
503
|
+
const mirrorRows = rest.slice(batchedAt + batched.length).flat();
|
|
482
504
|
const changed = unchanged.some((row, at) => !Equal.equals(row.value, now[at]?.[0]?.value));
|
|
483
505
|
const packs = yield* decodePacks(packRows);
|
|
484
506
|
const times = yield* decodeStats(timeRows);
|
|
485
507
|
const [ownRow] = own.length === 0 ? [] : rest[0] ?? [];
|
|
486
508
|
const refs = yield* wholeRefs(pushWhole, refRows);
|
|
487
509
|
const outbox = yield* decodeOutbox([headRows, cursorRows]);
|
|
488
|
-
const held = ownRow === void 0 ? void 0 : yield*
|
|
510
|
+
const held = ownRow === void 0 ? void 0 : yield* decodeRow(QuarantineRow, ownRow, `The push's quarantine row '${ownRow.id}'`);
|
|
489
511
|
const mirrored = yield* activeMirrors(mirrorRows);
|
|
490
512
|
const revoked = yield* Effect.match(fence.check(fenced), {
|
|
491
513
|
onFailure: (error) => error,
|
|
@@ -504,7 +526,8 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
504
526
|
version: snapshot.version,
|
|
505
527
|
packs
|
|
506
528
|
};
|
|
507
|
-
if (held !== void 0) read.quarantine = held.
|
|
529
|
+
if (held !== void 0) read.quarantine = held.state;
|
|
530
|
+
if (batchRows !== void 0) read.batches = batchRows.length;
|
|
508
531
|
if (revoked !== void 0) read.revoked = revoked;
|
|
509
532
|
if (cruftRows.length <= 64) read.packs = {
|
|
510
533
|
listed: new Set(packs.map(({ id }) => id)),
|
|
@@ -531,7 +554,8 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
531
554
|
queued,
|
|
532
555
|
reserved,
|
|
533
556
|
indexRow,
|
|
534
|
-
changed
|
|
557
|
+
changed,
|
|
558
|
+
roots: yield* rootsOf(rootRows)
|
|
535
559
|
};
|
|
536
560
|
});
|
|
537
561
|
const settingsOf = (record) => ({
|
|
@@ -644,6 +668,38 @@ const clearedAt = (decision, at) => decision.kind === "commit" ? {
|
|
|
644
668
|
}
|
|
645
669
|
} : decision;
|
|
646
670
|
/**
|
|
671
|
+
* `decision` with a fetch's roots in its commit, the reached mark's delete once. A decision that
|
|
672
|
+
* commits nothing commits the roots alone, at `version`, so a deepen that moves no ref keeps its
|
|
673
|
+
* edge. A refusal stays one.
|
|
674
|
+
*/
|
|
675
|
+
const withRoots = (decision, write, version) => {
|
|
676
|
+
if (write === void 0) return decision;
|
|
677
|
+
if (decision.kind === "answer") {
|
|
678
|
+
const { answer } = decision;
|
|
679
|
+
if (answer.kind === "error") return decision;
|
|
680
|
+
return {
|
|
681
|
+
kind: "commit",
|
|
682
|
+
expect: version,
|
|
683
|
+
change: {
|
|
684
|
+
put: [...write.put],
|
|
685
|
+
delete: [...write.delete]
|
|
686
|
+
},
|
|
687
|
+
answer: answer.value,
|
|
688
|
+
moved: []
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
const held = decision.change.delete ?? [];
|
|
692
|
+
const drops = write.delete.filter((key) => !held.includes(key));
|
|
693
|
+
const change = {
|
|
694
|
+
put: [...decision.change.put, ...write.put],
|
|
695
|
+
delete: [...held, ...drops]
|
|
696
|
+
};
|
|
697
|
+
return {
|
|
698
|
+
...decision,
|
|
699
|
+
change
|
|
700
|
+
};
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
647
703
|
* What a decision commits: its writes and jobs at `expect`, or, for an answer that moves no ref,
|
|
648
704
|
* nothing, which a keyed write's receipt still commits at the read's version. A refusal fails.
|
|
649
705
|
*/
|
|
@@ -770,6 +826,10 @@ const receive = (objects, listed, request) => {
|
|
|
770
826
|
received: pack.received,
|
|
771
827
|
rooted: void 0
|
|
772
828
|
});
|
|
829
|
+
if ("rooted" in pack) return Effect.succeed({
|
|
830
|
+
received: void 0,
|
|
831
|
+
rooted: pack.rooted
|
|
832
|
+
});
|
|
773
833
|
const input = {
|
|
774
834
|
pack: pack.bytes,
|
|
775
835
|
objects: pack.objects
|
|
@@ -819,17 +879,14 @@ const movedKinds = (updates, moved) => {
|
|
|
819
879
|
kind: kinds.get(move.ref) ?? "force"
|
|
820
880
|
}));
|
|
821
881
|
};
|
|
822
|
-
|
|
823
|
-
* The pack a push's own receive put under its `quarantine` row: none for a push with no pack, one
|
|
824
|
-
* of rows alone, or a caller's `received`, which stays its caller's to end.
|
|
825
|
-
*/
|
|
826
|
-
const ownPack = (request, received) => {
|
|
882
|
+
function ownPack(request, received, staged) {
|
|
827
883
|
const id = received?.quarantine?.id;
|
|
828
|
-
if (request.pack === void 0 || "
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
884
|
+
if (request.pack === void 0 || !("bytes" in request.pack) || id === void 0) return void 0;
|
|
885
|
+
if (staged === true) return stagedBatchOf(received);
|
|
886
|
+
return received?.quarantine?.collection === objectCollections.quarantine && isPackId(id) ? id : void 0;
|
|
887
|
+
}
|
|
888
|
+
/** Whether a commit lists `pack` or publishes a batch: its change deletes its quarantine row. */
|
|
889
|
+
const lists = (body, own) => body.delete.some((key) => key.collection === own.collection && key.id === own.id);
|
|
833
890
|
/**
|
|
834
891
|
* The push decide's loop past its first read, onto `listed`, keeping its answer under `key`:
|
|
835
892
|
* the pack received into its quarantine; each edit's kind from the objects; then a read of the
|
|
@@ -842,7 +899,7 @@ const lists = (body, pack) => body.delete.some((key) => key.collection === objec
|
|
|
842
899
|
*/
|
|
843
900
|
const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRepo, view, views, heldAt }, key, answers, checking = false) => Effect.scoped(Effect.gen(function* () {
|
|
844
901
|
const core = yield* CoreParts;
|
|
845
|
-
const { objects: sealed, fetchLimits } = yield* ObjectsParts;
|
|
902
|
+
const { objects: sealed, fetchLimits, files = defaultPushFiles, repo: repoSizes = defaultPushRepo } = yield* ObjectsParts;
|
|
846
903
|
const authorize = yield* Authorize;
|
|
847
904
|
const { store } = core;
|
|
848
905
|
const { caller, repo, signal } = request;
|
|
@@ -851,37 +908,45 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
851
908
|
const { received, rooted } = yield* receive(yield* read({
|
|
852
909
|
view,
|
|
853
910
|
at: seen
|
|
854
|
-
}), listed, request).pipe(Effect.provideService(HeldBy, heldUntil(heldAt, fetchLimits)), Effect.tapError((error) =>
|
|
911
|
+
}), listed, request).pipe(Effect.provideService(HeldBy, heldUntil(heldAt, fetchLimits)), Effect.tapError((error) => isAwaitingUpkeep(error) ? bestEffort(ensureRepack(core, core.jobs, listed.repo, fetchLimits)) : Effect.void), Effect.mapError(asPushCheck));
|
|
855
912
|
const ownedPack = ownPack(request, received);
|
|
856
913
|
let listing = false;
|
|
857
|
-
if (ownedPack !== void 0) yield* Effect.addFinalizer((exit) => listing || Exit.hasInterrupts(exit) ? Effect.void : Effect.flatMap(Clock
|
|
914
|
+
if (ownedPack !== void 0) yield* Effect.addFinalizer((exit) => listing || Exit.hasInterrupts(exit) ? Effect.void : Effect.flatMap(Clock.currentTimeMillis, (at) => abandonOwn({
|
|
858
915
|
store: gitStore(store),
|
|
859
916
|
repo: listed.repo,
|
|
860
917
|
pack: ownedPack,
|
|
861
918
|
at,
|
|
862
919
|
repackJobRow: core.repackJobRow
|
|
863
920
|
})));
|
|
921
|
+
const ownedBatch = ownPack(request, received, true);
|
|
922
|
+
if (ownedBatch !== void 0) yield* Effect.addFinalizer((exit) => listing || Exit.hasInterrupts(exit) ? Effect.void : abandonBatch(gitStore(store), listed.repo, ownedBatch));
|
|
864
923
|
const viewed = received === void 0 ? seen : {
|
|
865
924
|
...seen,
|
|
866
925
|
pushed: received
|
|
867
926
|
};
|
|
868
|
-
const objects = yield* walkObjects(
|
|
927
|
+
const objects = yield* walkObjects(yield* read({
|
|
869
928
|
view,
|
|
870
929
|
at: viewed
|
|
871
|
-
})
|
|
930
|
+
}), received?.allotment);
|
|
872
931
|
const pushedObjects = withReceivedRows(objects, received);
|
|
873
932
|
const pushedListed = withReceived(listed, received);
|
|
874
933
|
const pushed = pushedOf(objects, listed, received);
|
|
934
|
+
const walked = request.roots === void 0 ? roots : movedRoots(roots, request.roots);
|
|
875
935
|
const kindsInput = {
|
|
876
936
|
objects: pushedObjects,
|
|
877
937
|
listed: pushedListed,
|
|
878
938
|
pushed,
|
|
879
939
|
edits: request.edits,
|
|
880
|
-
roots,
|
|
940
|
+
roots: walked,
|
|
881
941
|
...call
|
|
882
942
|
};
|
|
883
943
|
if (rooted !== void 0) kindsInput.missing = rooted;
|
|
884
944
|
const kinds = yield* kindsOf(kindsInput).pipe(Effect.mapError(asPushCheck));
|
|
945
|
+
const tips = kinds.updates.flatMap(({ ref, to }) => to === null ? [] : [{
|
|
946
|
+
ref,
|
|
947
|
+
oid: to
|
|
948
|
+
}]);
|
|
949
|
+
const warned = yield* filesChecked(files, received, pushed, tips);
|
|
885
950
|
const fetchedOff = yield* fetchedRefused(kinds, request);
|
|
886
951
|
const { forced } = fetchedOff;
|
|
887
952
|
const refused = new Map(fetchedOff.refused);
|
|
@@ -898,7 +963,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
898
963
|
for (const [ref, error] of unseen) refused.set(ref, error);
|
|
899
964
|
const { access } = core;
|
|
900
965
|
const barred = access?.patterns.some((pattern) => refViews.some((refView) => !publishable(refView, pattern))) === true;
|
|
901
|
-
const whole =
|
|
966
|
+
const whole = SealedObjects.whole(sealed, pushWhole);
|
|
902
967
|
const wholePushed = access === void 0 || !barred && request.publishes === void 0 ? void 0 : withReceivedRows(yield* walkObjects(whole, received?.allotment), received);
|
|
903
968
|
const refView = refViews[0] ?? (yield* view.refView);
|
|
904
969
|
const publishedRefs = (refs) => new Map([...refs].filter(([ref]) => hiddenUnder(hidden, ref) === void 0));
|
|
@@ -908,7 +973,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
908
973
|
const here = oids.filter((oid) => made.has(oid));
|
|
909
974
|
const stored = oids.filter((oid) => !made.has(oid));
|
|
910
975
|
if (stored.length === 0) return Effect.succeed(new Set(here));
|
|
911
|
-
return Effect.map(Effect.flatMap(Clock
|
|
976
|
+
return Effect.map(Effect.flatMap(Clock.currentTimeMillis, (now) => ownWritesOf(core.store, listed.repo, writer, stored, now)), (kept) => /* @__PURE__ */ new Set([...here, ...kept]));
|
|
912
977
|
};
|
|
913
978
|
const unpublishedAt = (refs, at, index, judging, edits, own) => access === void 0 || wholePushed === void 0 ? Effect.succeed(/* @__PURE__ */ new Map()) : unpublished({
|
|
914
979
|
access,
|
|
@@ -972,7 +1037,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
972
1037
|
};
|
|
973
1038
|
const fence = fenceAll(request, decidingFor(request).map((one) => core.fences(one, target)));
|
|
974
1039
|
const ready = objects.readyShallow && request.edits.some((edit) => edit.ref === defaultBranch || edit.ref.startsWith("refs/tags/"));
|
|
975
|
-
const jobs = (received?.change.add?.length ?? 0) > 0 || ready ? [core.repackJobRow()] : [];
|
|
1040
|
+
const jobs = (received?.change.add?.length ?? 0) > 0 || isStagedReceive(received) || ready ? [core.repackJobRow()] : [];
|
|
976
1041
|
const own = updates.filter((update) => gitsOwnMove(hidden, request.as, update.ref));
|
|
977
1042
|
const outside = updates.filter((update) => !gitsOwnMove(hidden, request.as, update.ref));
|
|
978
1043
|
const checks = outside.length === 0 ? void 0 : yield* checksOf(core);
|
|
@@ -1022,7 +1087,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1022
1087
|
if (request.request !== void 0) base.request = request.request;
|
|
1023
1088
|
let checked;
|
|
1024
1089
|
for (let tries = 0; tries < 10; tries += 1) {
|
|
1025
|
-
const at = yield* Clock
|
|
1090
|
+
const at = yield* Clock.currentTimeMillis;
|
|
1026
1091
|
const decide = yield* finalRead(store, target, fence, received, key, mark, branches, touched, request.guard, request.writes?.unchanged);
|
|
1027
1092
|
const { read, receipt, outbox, record, mirrored, facts, stats, times, queued, reserved, indexRow } = decide;
|
|
1028
1093
|
const indexed = SealedObjects.whole(sealed, pushWhole).index?.status(indexRow, at, listedIds(decide.at, received?.change));
|
|
@@ -1030,6 +1095,11 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1030
1095
|
const published = yield* publishedAt(read.refs, decide.at, indexRow);
|
|
1031
1096
|
const { writes } = request;
|
|
1032
1097
|
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
|
+
if (rowsMoved === void 0) continue;
|
|
1100
|
+
const added = addedBytes(received?.change, rowsMoved);
|
|
1101
|
+
const sized = repoChecked(repoSizes, stats.ownBytes, added);
|
|
1102
|
+
if (sized.refused !== void 0) return yield* Effect.fail(sized.refused);
|
|
1033
1103
|
const seen = {
|
|
1034
1104
|
...facts,
|
|
1035
1105
|
tips: tipsOf(read.refs, outside)
|
|
@@ -1081,23 +1151,25 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1081
1151
|
...unseen
|
|
1082
1152
|
])
|
|
1083
1153
|
};
|
|
1084
|
-
const
|
|
1154
|
+
const rooted = request.roots === void 0 ? void 0 : yield* rootsMoved(decide.roots, request.roots, indexJobs(core, indexed));
|
|
1155
|
+
const chosen = withRoots(decidePush({
|
|
1085
1156
|
read,
|
|
1086
1157
|
command: decided,
|
|
1087
1158
|
index: core.refIndex
|
|
1088
|
-
});
|
|
1159
|
+
}), rooted, read.version);
|
|
1089
1160
|
const clears = read.marked === true && clearsMark(chosen);
|
|
1090
1161
|
const decision = clears ? clearedAt(chosen, at) : chosen;
|
|
1091
1162
|
const upkept = clears && jobs.length === 0 ? [core.repackJobRow()] : jobs;
|
|
1163
|
+
if (decision.kind === "answer" && decision.answer.kind === "error" && isAwaitingUpkeep(decision.answer.error)) yield* bestEffort(ensureRepack(core, core.jobs, listed.repo, fetchLimits));
|
|
1092
1164
|
const planned = yield* planOf(decision, read.version, upkept);
|
|
1093
1165
|
const { change } = planned;
|
|
1094
1166
|
const refusal = writes === void 0 && !checking ? void 0 : refusalOf(planned.answer);
|
|
1095
1167
|
if (refusal !== void 0) return yield* Effect.fail(refusal);
|
|
1096
1168
|
const movedRefs = new Set(planned.moved.map((move) => move.ref));
|
|
1097
1169
|
const liftedOnMoves = [...checked?.bypassed ?? none].filter(([ref]) => movedRefs.has(ref));
|
|
1098
|
-
const answer = yield* answers.answer(planned.answer, forced, new Map(liftedOnMoves));
|
|
1170
|
+
const answer = yield* answers.answer(planned.answer, forced, new Map(liftedOnMoves), [...warned, ...sized.warned]);
|
|
1099
1171
|
if (checking) return answer;
|
|
1100
|
-
const also = planned.answer.updates.some((update) => update.kind === "rejected") || request.also === void 0 ? void 0 : request.also(yield* Clock
|
|
1172
|
+
const also = planned.answer.updates.some((update) => update.kind === "rejected") || request.also === void 0 ? void 0 : request.also(yield* Clock.currentTimeMillis, received);
|
|
1101
1173
|
const alsoWrites = (also?.put.length ?? 0) + (also?.delete?.length ?? 0);
|
|
1102
1174
|
const quiet = key === void 0 && alsoWrites === 0 && writes === void 0;
|
|
1103
1175
|
if (!planned.moves && quiet) return answer;
|
|
@@ -1138,8 +1210,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1138
1210
|
const kept = receiptWrites(key, answers.kept(final), core.repackJobRow);
|
|
1139
1211
|
const woken = shown.filter((move) => queued.has(move.ref)).map((move) => advanceRow(move.ref));
|
|
1140
1212
|
const pushed = pushedRows(core.access, shown, times, at);
|
|
1141
|
-
const moved =
|
|
1142
|
-
if (moved === void 0) continue;
|
|
1213
|
+
const moved = planned.moves ? rowsMoved : noRows;
|
|
1143
1214
|
const loose = looseRows(times.loose, moved);
|
|
1144
1215
|
const body = {
|
|
1145
1216
|
id,
|
|
@@ -1167,7 +1238,11 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1167
1238
|
...woken,
|
|
1168
1239
|
...shown.length > 0 ? indexJobs(core, indexed) : [],
|
|
1169
1240
|
...planned.moves ? refIndexJobs(core, record) : []
|
|
1170
|
-
], [
|
|
1241
|
+
], [
|
|
1242
|
+
...kept.jobs,
|
|
1243
|
+
...also?.jobs ?? [],
|
|
1244
|
+
...rooted?.jobs ?? []
|
|
1245
|
+
])
|
|
1171
1246
|
};
|
|
1172
1247
|
const objects = (received?.change.put?.length ?? 0) + (received?.change.delete?.length ?? 0);
|
|
1173
1248
|
const written = body.put.length + body.delete.length + body.jobs.length;
|
|
@@ -1181,8 +1256,10 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
1181
1256
|
try: () => checkWrites(body),
|
|
1182
1257
|
catch: (cause) => fromInfra(cause)
|
|
1183
1258
|
}).pipe(Effect.mapError(commitTooLarge(received, body)));
|
|
1184
|
-
if ((yield*
|
|
1185
|
-
|
|
1259
|
+
if ((yield* storeCommit(store.commit(scope, body)).pipe(Effect.mapError(commitTooLarge(received, body)))).ok) {
|
|
1260
|
+
const own = received?.quarantine;
|
|
1261
|
+
listing = own !== void 0 && lists(body, own);
|
|
1262
|
+
if (listing && ownedBatch !== void 0) yield* promoteOwn(gitStore(store), listed.repo, ownedBatch, 4);
|
|
1186
1263
|
return final;
|
|
1187
1264
|
}
|
|
1188
1265
|
}
|
|
@@ -1206,7 +1283,7 @@ const pushWith = (request, answers, key) => pushThrough(request, answers, key, f
|
|
|
1206
1283
|
/** `pushWith`, or with `checking`, its checks alone, as `pushOnto` says. */
|
|
1207
1284
|
const pushThrough = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, key, checking) {
|
|
1208
1285
|
const operation = operationOf(request);
|
|
1209
|
-
const heldAt = yield* Clock
|
|
1286
|
+
const heldAt = yield* Clock.currentTimeMillis;
|
|
1210
1287
|
const resolved = yield* firstRead(request.caller, operation, request.internalId).pipe(Effect.tapError((error) => retriedCodes.has(error.code) ? Effect.void : refuseQueued(request, [error], "access")));
|
|
1211
1288
|
const opened = yield* listedFor(request, operation, resolved, heldAt);
|
|
1212
1289
|
return yield* pushOnto(request, opened, key, answers, checking);
|
|
@@ -1222,6 +1299,12 @@ const push = (request) => pushWith(request, refsAnswers);
|
|
|
1222
1299
|
const checkPush = (request) => request.pack === void 0 ? pushThrough(request, refsAnswers, void 0, true) : fail("INTERNAL", "A push is checked with no pack");
|
|
1223
1300
|
/** A `git push`, as `push`, with the lines Git prints for the rules `authorize` lifted. */
|
|
1224
1301
|
const gitPush = (request) => pushWith(request, gitAnswers);
|
|
1302
|
+
/**
|
|
1303
|
+
* `gitPush` for a write's key, whose receipt keeps each ref's answer, as a push upload's job lands:
|
|
1304
|
+
* sent again, it answers what its receipt kept, with no lines for band 2. `undefined` when the
|
|
1305
|
+
* name holds a repo other than the one its key's lookup saw.
|
|
1306
|
+
*/
|
|
1307
|
+
const keyedGitPush = (request, keyed) => keyedPushWith(request, gitAnswers, keyed);
|
|
1225
1308
|
/** A ref a forced fetch moved past its diverged tip, answered `force`; the rest as they are. */
|
|
1226
1309
|
const forcedOf = (forced) => (update) => update.kind === "applied" && forced.has(update.ref) ? {
|
|
1227
1310
|
kind: "force",
|
|
@@ -1247,7 +1330,7 @@ const pushFetched = (request) => pushWith(request, {
|
|
|
1247
1330
|
*/
|
|
1248
1331
|
const keyedPushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, keyed) {
|
|
1249
1332
|
const operation = operationOf(request);
|
|
1250
|
-
const heldAt = yield* Clock
|
|
1333
|
+
const heldAt = yield* Clock.currentTimeMillis;
|
|
1251
1334
|
const resolved = yield* keyedRead(request.caller, operation, keyed.missed, request.internalId);
|
|
1252
1335
|
if (resolved === void 0) return void 0;
|
|
1253
1336
|
const opened = yield* listedFor(request, operation, resolved, heldAt);
|
|
@@ -1255,4 +1338,4 @@ const keyedPushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answ
|
|
|
1255
1338
|
});
|
|
1256
1339
|
/** `keyedPushWith` for `refs.update`, answering the decide's ref answer. */
|
|
1257
1340
|
const keyedPush = (request, keyed) => keyedPushWith(request, refsAnswers, keyed);
|
|
1258
|
-
export { buildFence, checkPush, gitPush, isQueueMoved, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|
|
1341
|
+
export { buildFence, checkPush, gitPush, isQueueMoved, keyedGitPush, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|
package/dist/core/receipts.mjs
CHANGED
|
@@ -25,6 +25,7 @@ const KeptError = /* @__PURE__ */ Schema.Struct({
|
|
|
25
25
|
hint: Schema.optionalKey(Schema.String),
|
|
26
26
|
context: Schema.optionalKey(Schema.Record(Schema.String, ContextValue))
|
|
27
27
|
});
|
|
28
|
+
/** One ref's answer as a receipt keeps it. */
|
|
28
29
|
const KeptUpdate = /* @__PURE__ */ Schema.Union([Schema.Struct({
|
|
29
30
|
kind: Schema.Literal("applied"),
|
|
30
31
|
ref: Schema.String
|
|
@@ -47,7 +48,9 @@ const KeptAnswer = /* @__PURE__ */ Schema.Union([
|
|
|
47
48
|
}),
|
|
48
49
|
Schema.Struct({
|
|
49
50
|
kind: Schema.Literal("repo"),
|
|
50
|
-
info: KeptRepoInfo
|
|
51
|
+
info: KeptRepoInfo,
|
|
52
|
+
/** A rename's `repo.renamed` place in its sequence, when the server keeps events. */
|
|
53
|
+
seq: Schema.optionalKey(Schema.Int)
|
|
51
54
|
}),
|
|
52
55
|
Schema.Struct({
|
|
53
56
|
kind: Schema.Literal("object"),
|
|
@@ -65,12 +68,15 @@ const KeptAnswer = /* @__PURE__ */ Schema.Union([
|
|
|
65
68
|
/**
|
|
66
69
|
* A keyed write's receipt, in the scope it wrote, saved in the write's own commit: the input its
|
|
67
70
|
* key came with, when, and what it answered. A work write's receipt is `pending`, with no
|
|
68
|
-
* answer, from when it takes the key until the queue answered (Q150)
|
|
71
|
+
* answer, from when it takes the key until the queue answered (Q150), and `failed` holds the claim
|
|
72
|
+
* its job had failed under then, when it had: the write sent again calls the queue only while that
|
|
73
|
+
* failure stands. Errors are never kept.
|
|
69
74
|
*/
|
|
70
75
|
const ReceiptRow = /* @__PURE__ */ Schema.Struct({
|
|
71
76
|
input: Schema.String,
|
|
72
77
|
at: Schema.Int,
|
|
73
78
|
pending: Schema.optionalKey(Schema.Literal(true)),
|
|
79
|
+
failed: Schema.optionalKey(Schema.Int),
|
|
74
80
|
answer: Schema.optionalKey(KeptAnswer)
|
|
75
81
|
});
|
|
76
82
|
/** A row's day, padded so a collection keyed by it reads the oldest first. */
|
|
@@ -137,8 +143,10 @@ const receiptRow = (kept, answer) => {
|
|
|
137
143
|
input: kept.input,
|
|
138
144
|
at: kept.at
|
|
139
145
|
};
|
|
140
|
-
if (answer === "pending")
|
|
141
|
-
|
|
146
|
+
if (answer.kind === "pending") {
|
|
147
|
+
value.pending = true;
|
|
148
|
+
if (answer.failed !== void 0) value.failed = answer.failed;
|
|
149
|
+
} else value.answer = answer;
|
|
142
150
|
return {
|
|
143
151
|
...receiptKey(kept),
|
|
144
152
|
value
|
|
@@ -215,20 +223,24 @@ const keptError = (error) => {
|
|
|
215
223
|
* rejected ref, or an import's failure.
|
|
216
224
|
*/
|
|
217
225
|
const heldError = (kept) => gitErrorFrom(kept);
|
|
226
|
+
/** Each ref's answer as a row keeps it: an applied ref as it is, a rejected one's error kept. */
|
|
227
|
+
const keptUpdates = (answer) => answer.updates.map((update) => update.kind === "applied" ? update : {
|
|
228
|
+
...update,
|
|
229
|
+
error: keptError(update.error)
|
|
230
|
+
});
|
|
231
|
+
/** Kept answers as `RefsUpdated` again, each rejected ref's error tagged. */
|
|
232
|
+
const heldUpdates = (updates) => ({ updates: updates.map((update) => update.kind === "applied" ? update : {
|
|
233
|
+
...update,
|
|
234
|
+
error: heldError(update.error)
|
|
235
|
+
}) });
|
|
218
236
|
/** A `refs.update`'s answer as its receipt keeps it. */
|
|
219
237
|
const refsKept = (answer) => ({
|
|
220
238
|
kind: "refs",
|
|
221
|
-
updates: answer
|
|
222
|
-
...update,
|
|
223
|
-
error: keptError(update.error)
|
|
224
|
-
})
|
|
239
|
+
updates: keptUpdates(answer)
|
|
225
240
|
});
|
|
226
241
|
const noAnswer = (held, kind) => fail("DATA_LOSS", `A receipt kept no ${kind} answer`, { context: { input: held.input } });
|
|
227
242
|
/** The answer a `refs.update`'s receipt kept, for the write sent again. */
|
|
228
|
-
const refsAnswer = (held) => held.answer?.kind === "refs" ? Effect.succeed(
|
|
229
|
-
...update,
|
|
230
|
-
error: heldError(update.error)
|
|
231
|
-
}) }) : noAnswer(held, "refs");
|
|
243
|
+
const refsAnswer = (held) => held.answer?.kind === "refs" ? Effect.succeed(heldUpdates(held.answer.updates)) : noAnswer(held, "refs");
|
|
232
244
|
/**
|
|
233
245
|
* A fork create's receipt: its answer is asked of the view after its commit, so it keeps none, and
|
|
234
246
|
* the create sent again reads the fork again.
|
|
@@ -252,6 +264,15 @@ const receiptAnswered = (held) => {
|
|
|
252
264
|
};
|
|
253
265
|
/** The answer a repo create, update or rename's receipt kept, for the write sent again. */
|
|
254
266
|
const repoAnswer = (held) => held.answer?.kind === "repo" ? Effect.succeed(held.answer.info) : noAnswer(held, "repo");
|
|
267
|
+
/** The answer a rename's receipt kept, with its event's `seq` when it kept one. */
|
|
268
|
+
const renamedAnswer = (held) => {
|
|
269
|
+
const { answer } = held;
|
|
270
|
+
if (answer?.kind !== "repo") return noAnswer(held, "repo");
|
|
271
|
+
return Effect.succeed(answer.seq === void 0 ? answer.info : {
|
|
272
|
+
...answer.info,
|
|
273
|
+
seq: answer.seq
|
|
274
|
+
});
|
|
275
|
+
};
|
|
255
276
|
/** The object a create, merge, revert or pick's receipt kept, for the write sent again. */
|
|
256
277
|
const objectAnswer = (held) => held.answer?.kind === "object" ? Effect.succeed(writtenOf(held.answer)) : noAnswer(held, "object");
|
|
257
278
|
/** A kept object answer as its write answered it, `renamesSkipped` only where it was kept. */
|
|
@@ -263,4 +284,4 @@ const writtenOf = (kept) => {
|
|
|
263
284
|
if (kept.renamesSkipped !== void 0) written.renamesSkipped = kept.renamesSkipped;
|
|
264
285
|
return written;
|
|
265
286
|
};
|
|
266
|
-
export { KeptError, ReceiptRow, dayMs, dayOf, forkKept, heldError, heldReceipt, keptError, liveReceipt, matchedReceipt, objectAnswer, receiptAnswered, receiptId, receiptKeys, receiptReads, receiptRow, receiptWrites, refsAnswer, refsKept, repoAnswer, sweepDue, sweepOf, sweepRead, withJobs };
|
|
287
|
+
export { KeptError, KeptUpdate, ReceiptRow, dayMs, dayOf, forkKept, heldError, heldReceipt, heldUpdates, keptError, keptUpdates, liveReceipt, matchedReceipt, objectAnswer, receiptAnswered, receiptId, receiptKeys, receiptReads, receiptRow, receiptWrites, refsAnswer, refsKept, renamedAnswer, repoAnswer, sweepDue, sweepOf, sweepRead, withJobs };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { currentRepo, gitJob
|
|
1
|
+
import { storeCommit } from "../store/errors.mjs";
|
|
2
|
+
import { currentRepo, gitJob } 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";
|
|
@@ -145,7 +145,7 @@ const rebuildTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
|
|
|
145
145
|
if (!sameStep(step, planned)) return again;
|
|
146
146
|
const write = writeOf(index, record, step, snapshot.results.slice(1), rows);
|
|
147
147
|
if (write === void 0) return void 0;
|
|
148
|
-
yield*
|
|
148
|
+
yield* storeCommit(store.commit(repoScope(internalId), {
|
|
149
149
|
id: newChangeId(),
|
|
150
150
|
expect: snapshot.version,
|
|
151
151
|
put: write.put,
|
|
@@ -167,7 +167,7 @@ const RefIndexJob = /* @__PURE__ */ Job.make(refIndexJobName, {
|
|
|
167
167
|
rebuild: () => ({})
|
|
168
168
|
});
|
|
169
169
|
/** `git.ref-index`, over the server's ref index: each try one step of its rebuild, whose `more` starts its tries again. */
|
|
170
|
-
const refIndexJob = (parts) => gitJob(RefIndexJob, () =>
|
|
170
|
+
const refIndexJob = (parts) => gitJob(RefIndexJob, () => Effect.flatMap(currentRepo, (repo) => rebuildTry(parts, parts.store, repo)), { onFailure: rebuildFailed });
|
|
171
171
|
/** The repo's `git.ref-index` row, due now. */
|
|
172
172
|
const refIndexJobRow = (job) => job.job({
|
|
173
173
|
key: refIndexJobKey,
|