@ref0/git 0.3.0 → 0.4.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/_virtual/_rolldown/runtime.mjs +12 -0
- package/dist/access/private-refs.d.mts +12 -9
- package/dist/access/private-refs.mjs +69 -46
- package/dist/auth/access-jwt.mjs +7 -7
- package/dist/auth/auth.d.mts +41 -0
- package/dist/auth/auth.mjs +39 -0
- package/dist/auth/authorize.mjs +57 -80
- package/dist/auth/bridge.mjs +30 -0
- package/dist/auth/fences.d.mts +22 -2
- package/dist/auth/fences.mjs +3 -3
- package/dist/auth/grants.d.mts +25 -0
- package/dist/auth/grants.mjs +29 -34
- package/dist/auth/helpers.mjs +4 -4
- package/dist/auth/host-function.d.mts +9 -2
- package/dist/auth/host-function.mjs +35 -8
- package/dist/auth/identify.d.mts +3 -0
- package/dist/auth/identify.mjs +9 -11
- package/dist/auth/namespaces.d.mts +3 -0
- package/dist/auth/policy.d.mts +57 -0
- package/dist/auth/policy.mjs +56 -0
- package/dist/auth/token-rows.mjs +6 -6
- package/dist/auth/token-text.mjs +16 -4
- package/dist/auth/tokens.d.mts +3 -0
- package/dist/auth/tokens.mjs +51 -13
- package/dist/auth.d.mts +2 -1
- package/dist/auth.mjs +2 -1
- package/dist/client/answer.mjs +49 -11
- package/dist/client/client.d.mts +2 -2
- package/dist/client/client.mjs +3 -3
- package/dist/client/git-http.d.mts +6 -0
- package/dist/client/git-http.mjs +23 -36
- package/dist/client/helper-node.d.mts +12 -0
- package/dist/client/helper-node.mjs +108 -5
- package/dist/client/local.mjs +94 -99
- package/dist/client/negotiate.mjs +10 -8
- package/dist/client/push-upload.d.mts +14 -0
- package/dist/client/push-upload.mjs +12 -12
- package/dist/client/remote-helper.mjs +22 -20
- package/dist/client/remote.mjs +28 -22
- package/dist/client/run-remote-helper.d.mts +40 -16
- package/dist/client/run-remote-helper.mjs +147 -154
- package/dist/client/scrub.d.mts +8 -2
- package/dist/client/scrub.mjs +76 -4
- package/dist/client/slice-push.d.mts +77 -0
- package/dist/client/slice-push.mjs +169 -0
- package/dist/client/slice-report.mjs +188 -0
- package/dist/client/slices.d.mts +44 -0
- package/dist/client/slices.mjs +131 -0
- package/dist/client/transport.d.mts +1 -0
- package/dist/client/transport.mjs +30 -26
- package/dist/contracts/access.d.mts +36 -9
- package/dist/contracts/actors.d.mts +28 -10
- package/dist/contracts/actors.mjs +17 -0
- package/dist/contracts/authorize.d.mts +77 -0
- package/dist/contracts/authorize.mjs +25 -0
- package/dist/contracts/blobs.d.mts +48 -15
- package/dist/contracts/blobs.mjs +30 -0
- package/dist/contracts/calls-spent.d.mts +1 -0
- package/dist/contracts/calls-spent.mjs +58 -18
- package/dist/contracts/client.d.mts +14 -16
- package/dist/contracts/commits.d.mts +558 -76
- package/dist/contracts/commits.mjs +147 -0
- package/dist/contracts/engine.d.mts +91 -55
- package/dist/contracts/engine.mjs +103 -0
- package/dist/contracts/events.d.mts +1382 -205
- package/dist/contracts/events.mjs +485 -0
- package/dist/contracts/files.d.mts +295 -50
- package/dist/contracts/files.mjs +100 -0
- package/dist/contracts/forks.d.mts +306 -25
- package/dist/contracts/forks.mjs +39 -0
- package/dist/contracts/git.d.mts +107 -0
- package/dist/contracts/git.mjs +23 -0
- package/dist/contracts/grants.d.mts +2 -2
- package/dist/contracts/ids.d.mts +23 -8
- package/dist/contracts/ids.mjs +40 -5
- package/dist/contracts/lfs.d.mts +9 -4
- package/dist/contracts/merges.d.mts +68 -16
- package/dist/contracts/merges.mjs +27 -0
- package/dist/contracts/namespaces.d.mts +14 -0
- package/dist/contracts/object-values.d.mts +96 -0
- package/dist/contracts/object-values.mjs +104 -0
- package/dist/contracts/objects.d.mts +323 -87
- package/dist/contracts/operations.d.mts +24 -16
- package/dist/contracts/promises.d.mts +13 -2
- package/dist/contracts/push-uploads.d.mts +39 -24
- package/dist/contracts/push-uploads.mjs +54 -0
- package/dist/contracts/queue.d.mts +444 -139
- package/dist/contracts/queue.mjs +197 -0
- package/dist/contracts/refs.d.mts +248 -45
- package/dist/contracts/refs.mjs +117 -0
- package/dist/contracts/repo-records.d.mts +34 -0
- package/dist/contracts/repo-records.mjs +18 -0
- package/dist/contracts/repos.d.mts +411 -58
- package/dist/contracts/repos.mjs +136 -0
- package/dist/contracts/result.d.mts +335 -69
- package/dist/contracts/result.mjs +350 -5
- package/dist/contracts/rules.d.mts +60 -48
- package/dist/contracts/rules.mjs +9 -0
- package/dist/contracts/server.d.mts +113 -47
- package/dist/contracts/services.d.mts +15 -24
- package/dist/contracts/services.mjs +5 -9
- package/dist/contracts/signin.d.mts +64 -31
- package/dist/contracts/signin.mjs +18 -0
- package/dist/contracts/store.d.mts +45 -5
- package/dist/contracts/store.mjs +31 -0
- package/dist/contracts/sync.d.mts +81 -46
- package/dist/contracts/sync.mjs +41 -2
- package/dist/contracts/tags.d.mts +204 -22
- package/dist/contracts/tags.mjs +51 -1
- package/dist/contracts/tokens.d.mts +32 -7
- package/dist/contracts/tokens.mjs +31 -1
- package/dist/contracts/topics.d.mts +123 -67
- package/dist/contracts/topics.mjs +109 -0
- package/dist/contracts/trees.d.mts +132 -52
- package/dist/contracts/trees.mjs +105 -0
- package/dist/contracts/work.d.mts +127 -20
- package/dist/contracts/work.mjs +69 -0
- package/dist/core/access.d.mts +25 -14
- package/dist/core/access.mjs +77 -108
- package/dist/core/ancestry.mjs +86 -18
- package/dist/core/call-names.mjs +1 -0
- package/dist/core/call-services.mjs +73 -0
- package/dist/core/changes.d.mts +31 -0
- package/dist/core/changes.mjs +5 -0
- package/dist/core/clock.mjs +3 -3
- package/dist/core/events/deliver.mjs +119 -33
- package/dist/core/events/seen.mjs +124 -0
- package/dist/core/forks.mjs +371 -159
- package/dist/core/hooks/order.d.mts +9 -0
- package/dist/core/hooks/order.mjs +25 -0
- package/dist/core/hooks/post-receive.mjs +13 -12
- package/dist/core/hooks/pre-receive.d.mts +8 -1
- package/dist/core/hooks/pre-receive.mjs +8 -6
- package/dist/core/imports.mjs +212 -0
- package/dist/core/index-job.mjs +131 -38
- package/dist/core/merge-parts.d.mts +30 -0
- package/dist/core/merge-parts.mjs +31 -0
- package/dist/core/names.mjs +4 -16
- package/dist/core/namespaces.d.mts +2 -0
- package/dist/core/objects/blobs.mjs +4 -4
- package/dist/core/objects/commit-writes.mjs +19 -17
- package/dist/core/objects/commits.mjs +12 -12
- package/dist/core/objects/files.mjs +10 -11
- package/dist/core/objects/lines.mjs +15 -32
- package/dist/core/objects/merges.mjs +4 -4
- package/dist/core/objects/objects-layer.d.mts +21 -0
- package/dist/core/objects/objects-layer.mjs +47 -0
- package/dist/core/objects/objects-namespace.d.mts +6 -0
- package/dist/core/objects/objects-namespace.mjs +13 -0
- package/dist/core/objects/objects.d.mts +49 -0
- package/dist/core/objects/objects.mjs +18 -0
- package/dist/core/objects/peel.mjs +3 -3
- package/dist/core/objects/reading.mjs +135 -40
- package/dist/core/objects/tags.mjs +7 -7
- package/dist/core/objects/tree-edits.mjs +40 -27
- package/dist/core/objects/trees.mjs +23 -18
- package/dist/core/objects/writing.mjs +43 -44
- package/dist/core/own-writes.mjs +3 -3
- package/dist/core/parts.d.mts +125 -0
- package/dist/core/parts.mjs +59 -0
- package/dist/core/promise.mjs +13 -9
- package/dist/core/publish.mjs +27 -17
- package/dist/core/purge.mjs +242 -0
- package/dist/core/push-decide.mjs +93 -28
- package/dist/core/push.mjs +300 -156
- package/dist/core/receipts.d.mts +4 -3
- package/dist/core/receipts.mjs +20 -12
- package/dist/core/ref-conflicts.mjs +70 -4
- package/dist/core/ref-index-job.mjs +181 -0
- package/dist/core/ref-index.d.mts +25 -0
- package/dist/core/ref-index.mjs +136 -0
- package/dist/core/ref-view.mjs +166 -0
- package/dist/core/refs.mjs +313 -95
- package/dist/core/repack.d.mts +10 -0
- package/dist/core/repack.mjs +261 -81
- package/dist/core/repo-info.mjs +99 -0
- package/dist/core/repos.mjs +114 -80
- package/dist/core/rules/changes.mjs +48 -20
- package/dist/core/rules/check.mjs +29 -22
- package/dist/core/rules/commit-changes.d.mts +13 -0
- package/dist/core/rules/commit-changes.mjs +100 -91
- package/dist/core/rules/context.d.mts +67 -8
- package/dist/core/rules/context.mjs +88 -51
- package/dist/core/rules/facts.mjs +1 -1
- package/dist/core/rules/fetch.mjs +24 -26
- package/dist/core/rules/files.d.mts +13 -0
- package/dist/core/rules/files.mjs +27 -28
- package/dist/core/rules/namespace.d.mts +2 -0
- package/dist/core/rules/patterns.mjs +29 -5
- package/dist/core/rules/protect.d.mts +12 -6
- package/dist/core/rules/protect.mjs +22 -20
- package/dist/core/rules/rules-layer.d.mts +17 -0
- package/dist/core/rules/rules-layer.mjs +26 -0
- package/dist/core/rules/rules.d.mts +8 -0
- package/dist/core/rules/rules.mjs +16 -0
- package/dist/core/rules/service.mjs +18 -0
- package/dist/core/seam.d.mts +8 -5
- package/dist/core/seam.mjs +19 -15
- package/dist/core/tokens.mjs +29 -23
- package/dist/core/view.d.mts +105 -6
- package/dist/core/view.mjs +211 -109
- package/dist/core/work.mjs +40 -14
- package/dist/effect.d.mts +3 -4
- package/dist/effect.mjs +2 -3
- package/dist/engine/allotted-xdiff.d.mts +1 -0
- package/dist/engine/allotted-xdiff.mjs +1 -1
- package/dist/engine/attributes.mjs +1 -1
- package/dist/engine/combined.d.mts +18 -0
- package/dist/engine/combined.mjs +39 -44
- package/dist/engine/commits.mjs +5 -4
- package/dist/engine/content.d.mts +3 -2
- package/dist/engine/content.mjs +2 -2
- package/dist/engine/failures.d.mts +2 -2
- package/dist/engine/failures.mjs +2 -9
- package/dist/engine/merge-base-walk.d.mts +3 -2
- package/dist/engine/merge-base-walk.mjs +1 -1
- package/dist/engine/merge-bases.mjs +3 -2
- package/dist/engine/merge.mjs +568 -566
- package/dist/engine/parts.d.mts +3 -2
- package/dist/engine/parts.mjs +40 -7
- package/dist/engine/reads.d.mts +1 -0
- package/dist/engine/reads.mjs +5 -5
- package/dist/engine/walk.mjs +23 -24
- package/dist/engine/xdiff.d.mts +2 -33
- package/dist/engine/xdiff.mjs +6 -3
- package/dist/event-streams/event-streams.d.mts +25 -0
- package/dist/event-streams/event-streams.mjs +22 -0
- package/dist/event-streams/namespace.d.mts +2 -0
- package/dist/event-streams/stream.d.mts +42 -0
- package/dist/{core/events → event-streams}/stream.mjs +106 -49
- package/dist/extend.d.mts +4 -2
- package/dist/http/answers.mjs +8 -4
- package/dist/http/bodies.mjs +84 -56
- package/dist/http/core-parts.mjs +206 -60
- package/dist/http/handler.d.mts +2 -0
- package/dist/http/handler.mjs +17 -11
- package/dist/http/node.mjs +10 -6
- package/dist/http/parts.d.mts +12 -0
- package/dist/http/push-uploads.d.mts +9 -0
- package/dist/http/push-uploads.mjs +76 -66
- package/dist/http/receive-pack.mjs +162 -28
- package/dist/http/upload-pack.mjs +106 -81
- package/dist/index.d.mts +48 -28
- package/dist/index.mjs +29 -7
- package/dist/lfs/calls.mjs +2 -2
- package/dist/lfs/locks.mjs +24 -20
- package/dist/lfs/objects.d.mts +7 -0
- package/dist/lfs/objects.mjs +31 -26
- package/dist/lfs/pointers.mjs +7 -7
- package/dist/lfs/purge.mjs +50 -0
- package/dist/lfs/repo.mjs +5 -5
- package/dist/lfs/rows.mjs +8 -8
- package/dist/lfs/service.d.mts +9 -0
- package/dist/lfs/service.mjs +32 -25
- package/dist/lfs/upkeep.mjs +5 -5
- package/dist/lfs/wire.mjs +80 -38
- package/dist/merges/merges.d.mts +20 -0
- package/dist/merges/merges.mjs +32 -0
- package/dist/merges/namespace.d.mts +2 -0
- package/dist/merges/public.d.mts +6 -0
- package/dist/merges/public.mjs +10 -0
- package/dist/node.d.mts +1 -2
- package/dist/node.mjs +1 -3
- package/dist/protocol/bytes/buffers.d.mts +9 -3
- package/dist/protocol/bytes/buffers.mjs +11 -5
- package/dist/protocol/bytes/deflate.d.mts +7 -5
- package/dist/protocol/bytes/deflate.mjs +59 -23
- package/dist/protocol/bytes/inflate.d.mts +4 -3
- package/dist/protocol/bytes/inflate.mjs +61 -26
- package/dist/protocol/bytes/reader.mjs +61 -0
- package/dist/protocol/bytes/sha1-hasher.d.mts +3 -1
- package/dist/protocol/bytes/sha1-hasher.mjs +13 -3
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +5 -5
- package/dist/protocol/bytes/streams.mjs +16 -6
- package/dist/protocol/diff/patch.d.mts +4 -0
- package/dist/protocol/diff/patch.mjs +1 -1
- package/dist/protocol/diff/paths.mjs +1 -1
- package/dist/protocol/diff/read.d.mts +1 -1
- package/dist/protocol/diff/read.mjs +102 -90
- package/dist/protocol/framing/pkt-line.d.mts +1 -0
- package/dist/protocol/framing/pkt-line.mjs +40 -6
- package/dist/protocol/objects/checked-blobs.d.mts +1 -0
- package/dist/protocol/objects/fsck.mjs +7 -1
- package/dist/protocol/objects/held.mjs +5 -11
- package/dist/protocol/objects/ident.mjs +1 -1
- package/dist/protocol/objects/object-rules.mjs +15 -7
- package/dist/protocol/objects/object.d.mts +6 -2
- package/dist/protocol/objects/object.mjs +5 -2
- package/dist/protocol/objects/tag.d.mts +3 -1
- package/dist/protocol/objects/tag.mjs +27 -1
- package/dist/protocol/objects/tree.mjs +1 -1
- package/dist/protocol/packs/delta.d.mts +1 -1
- package/dist/protocol/packs/delta.mjs +2 -2
- package/dist/protocol/packs/graph.mjs +55 -56
- package/dist/protocol/packs/idx.d.mts +4 -2
- package/dist/protocol/packs/idx.mjs +156 -63
- package/dist/protocol/packs/indexer.d.mts +22 -4
- package/dist/protocol/packs/indexer.mjs +14 -35
- package/dist/protocol/packs/parts.mjs +5 -5
- package/dist/protocol/packs/pos.mjs +12 -5
- package/dist/protocol/packs/reader.d.mts +19 -12
- package/dist/protocol/packs/reader.mjs +252 -25
- package/dist/protocol/packs/rev.d.mts +1 -1
- package/dist/protocol/packs/rev.mjs +42 -24
- package/dist/protocol/packs/types-file.mjs +85 -0
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +2 -2
- package/dist/protocol/packs/writer.d.mts +40 -15
- package/dist/protocol/packs/writer.mjs +142 -49
- package/dist/protocol/wire/advertisement.d.mts +39 -14
- package/dist/protocol/wire/advertisement.mjs +127 -31
- package/dist/protocol/wire/fetch.d.mts +57 -19
- package/dist/protocol/wire/fetch.mjs +57 -26
- package/dist/protocol/wire/json.mjs +25 -0
- package/dist/protocol/wire/lines.d.mts +10 -0
- package/dist/protocol/wire/lines.mjs +20 -6
- package/dist/protocol/wire/push-limits.d.mts +6 -0
- package/dist/protocol/wire/push-limits.mjs +88 -0
- package/dist/protocol/wire/push-uploads.mjs +3 -28
- package/dist/protocol/wire/receive-pack.d.mts +30 -14
- package/dist/protocol/wire/receive-pack.mjs +29 -2
- package/dist/protocol/wire/report-status.d.mts +30 -11
- package/dist/protocol/wire/report-status.mjs +21 -2
- package/dist/protocol/wire/v2.d.mts +56 -29
- package/dist/protocol/wire/v2.mjs +91 -16
- package/dist/protocol.d.mts +4 -3
- package/dist/protocol.mjs +7 -6
- package/dist/queue/advance.mjs +189 -120
- package/dist/queue/callers.mjs +12 -9
- package/dist/queue/calls.mjs +311 -155
- package/dist/queue/commit.mjs +70 -26
- package/dist/queue/host.d.mts +39 -12
- package/dist/queue/host.mjs +36 -38
- package/dist/queue/lanes.mjs +1 -1
- package/dist/queue/layer.d.mts +14 -0
- package/dist/queue/layer.mjs +55 -0
- package/dist/queue/limits.mjs +13 -2
- package/dist/queue/namespace.d.mts +2 -0
- package/dist/queue/pages.mjs +1 -1
- package/dist/queue/public.d.mts +6 -0
- package/dist/queue/public.mjs +21 -0
- package/dist/queue/push-option.mjs +49 -30
- package/dist/queue/rows.mjs +24 -16
- package/dist/queue/schedule.mjs +22 -22
- package/dist/queue/search.mjs +8 -7
- package/dist/queue/state.mjs +49 -13
- package/dist/queue/steps.mjs +6 -3
- package/dist/remote-helper.d.mts +5 -2
- package/dist/remote-helper.mjs +5 -2
- package/dist/rest/api.d.mts +1 -1
- package/dist/rest/blobs.d.mts +790 -23
- package/dist/rest/blobs.mjs +4 -4
- package/dist/rest/caller.d.mts +4163 -36
- package/dist/rest/caller.mjs +2 -2
- package/dist/rest/client.mjs +80 -70
- package/dist/rest/commits.d.mts +3315 -244
- package/dist/rest/commits.mjs +18 -64
- package/dist/rest/errors.d.mts +2082 -22
- package/dist/rest/errors.mjs +46 -89
- package/dist/rest/events.d.mts +394 -11
- package/dist/rest/events.mjs +13 -9
- package/dist/rest/files.d.mts +1265 -114
- package/dist/rest/files.mjs +11 -42
- package/dist/rest/forks.d.mts +2005 -62
- package/dist/rest/forks.mjs +10 -13
- package/dist/rest/handler.d.mts +3 -0
- package/dist/rest/handler.mjs +22 -14
- package/dist/rest/handlers.mjs +53 -60
- package/dist/rest/listen.d.mts +5 -8
- package/dist/rest/listen.mjs +23 -29
- package/dist/rest/me.d.mts +393 -10
- package/dist/rest/me.mjs +2 -2
- package/dist/rest/merges.d.mts +399 -16
- package/dist/rest/merges.mjs +3 -17
- package/dist/rest/paths.mjs +1 -0
- package/dist/rest/queue.d.mts +5615 -240
- package/dist/rest/queue.mjs +15 -130
- package/dist/rest/refs.d.mts +2859 -132
- package/dist/rest/refs.mjs +19 -39
- package/dist/rest/repos.d.mts +2421 -93
- package/dist/rest/repos.mjs +10 -33
- package/dist/rest/tags.d.mts +1205 -54
- package/dist/rest/tags.mjs +6 -34
- package/dist/rest/tokens.d.mts +2369 -66
- package/dist/rest/tokens.mjs +7 -4
- package/dist/rest/topics.d.mts +2060 -113
- package/dist/rest/topics.mjs +23 -71
- package/dist/rest/trees.d.mts +1610 -75
- package/dist/rest/trees.mjs +16 -57
- package/dist/rest/wire.d.mts +402 -0
- package/dist/rest/wire.mjs +32 -46
- package/dist/rest/work.d.mts +1204 -63
- package/dist/rest/work.mjs +7 -51
- package/dist/rest.d.mts +3 -3
- package/dist/server/extension.d.mts +6 -2
- package/dist/server/extension.mjs +54 -30
- package/dist/server/git-layer.d.mts +23 -0
- package/dist/server/git-layer.mjs +107 -0
- package/dist/server/git-namespace.d.mts +6 -0
- package/dist/server/git-namespace.mjs +15 -0
- package/dist/server/lifecycle.d.mts +1 -2
- package/dist/server/lifecycle.mjs +8 -15
- package/dist/server/namespaces.d.mts +2 -0
- package/dist/server/registry.d.mts +9 -0
- package/dist/server/registry.mjs +167 -0
- package/dist/server/route-match.mjs +88 -0
- package/dist/server/routes.d.mts +12 -8
- package/dist/server/routes.mjs +27 -18
- package/dist/server/server.d.mts +19 -0
- package/dist/server/server.mjs +281 -198
- package/dist/signin/codes.mjs +9 -6
- package/dist/signin/context.d.mts +1 -0
- package/dist/signin/context.mjs +4 -4
- package/dist/signin/device.mjs +8 -8
- package/dist/signin/forms.mjs +11 -29
- package/dist/signin/grants.d.mts +4 -2
- package/dist/signin/grants.mjs +20 -19
- package/dist/signin/route.mjs +2 -2
- package/dist/signin/web.mjs +7 -7
- package/dist/signin/wire.mjs +6 -6
- package/dist/storage/budget.mjs +51 -18
- package/dist/storage/calls.d.mts +22 -4
- package/dist/storage/calls.mjs +347 -110
- package/dist/storage/clean-up.mjs +80 -35
- package/dist/storage/counted-bucket.mjs +115 -0
- package/dist/storage/fetch.d.mts +2 -0
- package/dist/storage/fetch.mjs +243 -100
- package/dist/storage/fsck.mjs +56 -7
- package/dist/storage/held-types.d.mts +7 -0
- package/dist/storage/held-types.mjs +263 -0
- package/dist/storage/host-bucket.mjs +28 -0
- package/dist/storage/id-mix.d.mts +1 -0
- package/dist/storage/id-mix.mjs +55 -0
- package/dist/storage/index-bitmaps.d.mts +2 -1
- package/dist/storage/index-bitmaps.mjs +233 -101
- package/dist/storage/index-build.d.mts +7 -3
- package/dist/storage/index-build.mjs +650 -164
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +297 -195
- package/dist/storage/index-files.mjs +25 -27
- package/dist/storage/index-graph.d.mts +2 -1
- package/dist/storage/index-graph.mjs +127 -91
- package/dist/storage/index-layers.d.mts +11 -0
- package/dist/storage/index-layers.mjs +258 -78
- package/dist/storage/index-reach.mjs +181 -75
- package/dist/storage/index-remap.mjs +74 -32
- package/dist/storage/index-shallow.mjs +311 -0
- package/dist/storage/index-visible.mjs +168 -0
- package/dist/storage/layout.d.mts +1 -0
- package/dist/storage/layout.mjs +39 -8
- package/dist/storage/lfs-pointers.d.mts +3 -1
- package/dist/storage/lfs-pointers.mjs +25 -9
- package/dist/storage/link-join.d.mts +4 -0
- package/dist/storage/link-join.mjs +50 -12
- package/dist/storage/links.mjs +89 -4
- package/dist/storage/listed-ids.mjs +10 -0
- package/dist/storage/loose.d.mts +11 -4
- package/dist/storage/loose.mjs +102 -69
- package/dist/storage/memory-budget.d.mts +5 -0
- package/dist/storage/memory-budget.mjs +530 -102
- package/dist/storage/merge-choose.mjs +258 -0
- package/dist/storage/merge-cut.mjs +47 -0
- package/dist/storage/merge-fence.mjs +89 -0
- package/dist/storage/merge-index.mjs +347 -0
- package/dist/storage/merge-most.mjs +202 -0
- package/dist/storage/merge-plan.mjs +171 -0
- package/dist/storage/merge-row.mjs +258 -0
- package/dist/storage/merge-stream.mjs +497 -0
- package/dist/storage/merge-walk.mjs +199 -0
- package/dist/storage/merge-write.mjs +129 -0
- package/dist/storage/merge.d.mts +10 -0
- package/dist/storage/merge.mjs +82 -306
- package/dist/storage/object-rows.d.mts +4 -2
- package/dist/storage/object-rows.mjs +101 -17
- package/dist/storage/pack-order.d.mts +1 -1
- package/dist/storage/pack-order.mjs +69 -54
- package/dist/storage/pack-ranges.d.mts +1 -1
- package/dist/storage/pack-ranges.mjs +396 -60
- package/dist/storage/pack-reads.d.mts +6 -2
- package/dist/storage/pack-reads.mjs +598 -126
- package/dist/storage/pack-receive.d.mts +5 -0
- package/dist/storage/pack-receive.mjs +820 -237
- package/dist/storage/packs-memory.d.mts +25 -0
- package/dist/storage/packs-memory.mjs +49 -0
- package/dist/storage/packs.d.mts +7 -5
- package/dist/storage/packs.mjs +554 -213
- package/dist/storage/placed-reads.mjs +205 -0
- package/dist/storage/promise-calls.mjs +29 -0
- package/dist/storage/prune-keep.mjs +164 -0
- package/dist/storage/prune-walk.mjs +578 -0
- package/dist/storage/prune.mjs +739 -332
- package/dist/storage/push-allotment.mjs +3 -3
- package/dist/storage/push-uploads.mjs +22 -13
- package/dist/storage/pushed-commits.mjs +8 -9
- package/dist/storage/quarantine.d.mts +10 -0
- package/dist/storage/quarantine.mjs +28 -25
- package/dist/storage/range-cache.mjs +71 -0
- package/dist/storage/raw-ids.mjs +20 -1
- package/dist/storage/ready.d.mts +4 -2
- package/dist/storage/ready.mjs +109 -48
- package/dist/storage/receive-admission.mjs +67 -0
- package/dist/storage/receive-bounds.d.mts +1 -0
- package/dist/storage/receive-bounds.mjs +202 -0
- package/dist/storage/receive-files.mjs +248 -0
- package/dist/storage/receive-links.mjs +281 -244
- package/dist/storage/receive-state.d.mts +9 -0
- package/dist/storage/receive-state.mjs +150 -0
- package/dist/storage/receive-steps.mjs +344 -0
- package/dist/storage/receive-sweep.mjs +160 -0
- package/dist/storage/receive-table.d.mts +3 -0
- package/dist/storage/receive-table.mjs +197 -0
- package/dist/storage/repack-backlog.mjs +70 -0
- package/dist/storage/repack-contained.mjs +269 -0
- package/dist/storage/repack-job.d.mts +3 -0
- package/dist/storage/repack-job.mjs +24 -7
- package/dist/storage/repack.d.mts +4 -4
- package/dist/storage/repack.mjs +156 -77
- package/dist/storage/roots.mjs +23 -7
- package/dist/storage/rows.d.mts +4 -2
- package/dist/storage/rows.mjs +40 -7
- package/dist/storage/runs.d.mts +8 -0
- package/dist/storage/runs.mjs +731 -0
- package/dist/storage/send-list.d.mts +2 -1
- package/dist/storage/send-list.mjs +261 -76
- package/dist/storage/shallow.d.mts +3 -2
- package/dist/storage/shallow.mjs +7 -7
- package/dist/storage/single-flight.mjs +47 -0
- package/dist/storage/stream-whole.mjs +121 -54
- package/dist/storage/swap-walk.mjs +188 -0
- package/dist/storage/unpack.mjs +52 -23
- package/dist/storage/visible.mjs +58 -39
- package/dist/storage/walk.d.mts +2 -0
- package/dist/storage/walk.mjs +20 -7
- package/dist/storage/wants.mjs +185 -33
- package/dist/storage/written-bases.mjs +172 -0
- package/dist/store/call-count.d.mts +69 -4
- package/dist/store/call-count.mjs +193 -51
- package/dist/store/catalogue.d.mts +17 -3
- package/dist/store/catalogue.mjs +135 -48
- package/dist/store/crossing.mjs +2 -4
- package/dist/store/cursor-seal.d.mts +12 -1
- package/dist/store/cursor-seal.mjs +7 -6
- package/dist/store/errors.d.mts +2 -2
- package/dist/store/errors.mjs +112 -24
- package/dist/store/git-store.mjs +21 -2
- package/dist/store/list-job.mjs +5 -5
- package/dist/store/outbox.d.mts +15 -5
- package/dist/store/outbox.mjs +106 -28
- package/dist/store/promises.d.mts +3 -2
- package/dist/store/promises.mjs +94 -35
- package/dist/store/queue-jobs.mjs +12 -12
- package/dist/store/records.d.mts +64 -1
- package/dist/store/records.mjs +101 -32
- package/dist/store/ref-rows.d.mts +18 -2
- package/dist/store/ref-rows.mjs +62 -5
- package/dist/store/repo-record.mjs +11 -9
- package/dist/store/reservations.mjs +9 -8
- package/dist/store/scopes.mjs +13 -1
- package/dist/store/settle.mjs +1 -1
- package/dist/store/topic-jobs.mjs +4 -4
- package/dist/sync/bound.d.mts +5 -3
- package/dist/sync/bound.mjs +32 -3
- package/dist/sync/github.mjs +7 -7
- package/dist/sync/import.d.mts +2 -0
- package/dist/sync/import.mjs +46 -50
- package/dist/sync/jobs.mjs +15 -23
- package/dist/sync/mirror.d.mts +5 -1
- package/dist/sync/mirror.mjs +121 -44
- package/dist/sync/publish.d.mts +1 -0
- package/dist/sync/publish.mjs +10 -12
- package/dist/sync/step.mjs +439 -71
- package/dist/sync/tries.mjs +50 -32
- package/dist/sync.d.mts +3 -3
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +103 -86
- package/dist/topics/calls.mjs +97 -67
- package/dist/topics/directory.mjs +31 -11
- package/dist/topics/host.d.mts +0 -1
- package/dist/topics/host.mjs +2 -12
- package/dist/topics/members.mjs +30 -24
- package/dist/topics/rows.mjs +10 -9
- package/dist/topics/topic.mjs +20 -9
- package/package.json +8 -15
- package/dist/auth/authorize.d.mts +0 -5
- package/dist/contracts/objects.mjs +0 -54
- package/dist/core/events/stream.d.mts +0 -19
- package/dist/core/rules/define.d.mts +0 -5
- package/dist/core/rules/define.mjs +0 -13
- package/dist/core/rules/fetch.d.mts +0 -5
- package/dist/core/sight.mjs +0 -99
- package/dist/engine/engine.d.mts +0 -25
- package/dist/engine/engine.mjs +0 -49
- package/dist/engine/xdiff/NOTICE.md +0 -63
- package/dist/engine/xdiff/compiled.d.mts +0 -7
- package/dist/engine/xdiff/compiled.mjs +0 -9
- package/dist/engine/xdiff/embedded.mjs +0 -4
- package/dist/engine/xdiff/node.d.mts +0 -7
- package/dist/engine/xdiff/node.mjs +0 -10
- package/dist/engine/xdiff/upstream/LGPL-2.1 +0 -511
- package/dist/engine/xdiff/xdiff.wasm +0 -0
- package/dist/engine.d.mts +0 -3
- package/dist/engine.mjs +0 -3
- package/dist/storage/distinct-ids.mjs +0 -39
- package/dist/storage/held-memo.mjs +0 -188
- package/dist/storage/index-remap.d.mts +0 -8
- package/dist/sync/records.mjs +0 -73
package/dist/core/push.mjs
CHANGED
|
@@ -1,52 +1,65 @@
|
|
|
1
|
+
import { fail, gitError } from "../contracts/result.mjs";
|
|
1
2
|
import { openTreeBytes } from "../storage/budget.mjs";
|
|
2
|
-
import {
|
|
3
|
+
import { objectsFace, scopedReceive, walkObjects } from "../storage/calls.mjs";
|
|
4
|
+
import { isUnindexedRead } from "../storage/index-visible.mjs";
|
|
3
5
|
import { openTreesRefusal } from "../storage/push-allotment.mjs";
|
|
4
6
|
import { isLoose } from "../storage/loose.mjs";
|
|
7
|
+
import { listedIds } from "../storage/listed-ids.mjs";
|
|
5
8
|
import { indexRowKey, objectCollections } from "../storage/layout.mjs";
|
|
6
9
|
import { noLfsPointers } from "../storage/lfs-pointers.mjs";
|
|
7
10
|
import { isShallowRoot } from "../storage/links.mjs";
|
|
11
|
+
import { isAwaitingRepack } from "../storage/repack-backlog.mjs";
|
|
8
12
|
import { allottedRows } from "../storage/allotted.mjs";
|
|
9
13
|
import { gitObjectOf, objectOfRow, receivedRows } from "../storage/object-rows.mjs";
|
|
14
|
+
import { pruneClearedKey } from "../storage/prune.mjs";
|
|
10
15
|
import { QuarantineRow, decodeHeld } from "../storage/rows.mjs";
|
|
11
|
-
import {
|
|
16
|
+
import { bestEffort, decodeRow, storeCall } from "../store/errors.mjs";
|
|
12
17
|
import { callScope } from "../store/call-count.mjs";
|
|
13
|
-
import { runIn } from "../store/crossing.mjs";
|
|
14
18
|
import { decodePacks } from "../store/git-store.mjs";
|
|
15
|
-
import { WholeRepo, wholeRefs } from "../store/ref-rows.mjs";
|
|
19
|
+
import { WholeRepo, refBytesOf, storesPeel, wholeRefs } from "../store/ref-rows.mjs";
|
|
16
20
|
import { gitsOwnMove, hiddenUnder } from "../protocol/wire/lines.mjs";
|
|
17
|
-
import {
|
|
21
|
+
import { sliceOf } from "../protocol/wire/push-limits.mjs";
|
|
22
|
+
import { pushCounts } from "./events/seen.mjs";
|
|
23
|
+
import { refViewIn } from "./ref-view.mjs";
|
|
18
24
|
import { appendEvents, decodeOutbox, firstSeq, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
19
25
|
import { MirrorRow, PrunedMark, mirrorJobName } from "../store/records.mjs";
|
|
20
26
|
import { decodeTimes, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
|
|
21
27
|
import { advanceRow } from "../store/queue-jobs.mjs";
|
|
22
28
|
import { liveReservations, reservedTarget } from "../store/reservations.mjs";
|
|
23
29
|
import { settleName } from "../store/settle.mjs";
|
|
24
|
-
import { collections, newChangeId, prunedKey, pushedKey, pushedUnder, repoScope } from "../store/scopes.mjs";
|
|
25
|
-
import { headOf, indexJobs, openKeyed, openRepo } from "./access.mjs";
|
|
30
|
+
import { collections, newChangeId, prunedKey, pushedKey, pushedUnder, reachedKey, repoScope } from "../store/scopes.mjs";
|
|
31
|
+
import { headOf, indexJobs, openKeyed, openRepo, refIndexJobs, repoAccess } from "./access.mjs";
|
|
26
32
|
import { kindsOf } from "./ancestry.mjs";
|
|
27
33
|
import { savedPushRow } from "./hooks/post-receive.mjs";
|
|
28
34
|
import { runPreReceive } from "./hooks/pre-receive.mjs";
|
|
29
|
-
import {
|
|
35
|
+
import { Changes } from "./changes.mjs";
|
|
36
|
+
import { batchOf, readerOf } from "./rules/changes.mjs";
|
|
30
37
|
import { commitChangesOf, coveredTips } from "./rules/commit-changes.mjs";
|
|
31
|
-
import { gitsOwnRef, runPushRules, unseenRef } from "./rules/check.mjs";
|
|
38
|
+
import { gitsOwnRef, pushRulesFor, runPushRules, unseenRef } from "./rules/check.mjs";
|
|
32
39
|
import { checking } from "./rules/context.mjs";
|
|
33
40
|
import { changedWhileChecked, factsHeld, tipsOf } from "./rules/facts.mjs";
|
|
34
|
-
import { decidePush } from "./push-decide.mjs";
|
|
41
|
+
import { clearsMark, decidePush, otherWritesProblem } from "./push-decide.mjs";
|
|
35
42
|
import { heldReceipt, receiptReads, receiptWrites, refsAnswer, refsKept, withJobs } from "./receipts.mjs";
|
|
36
43
|
import { SealedObjects, viewOf } from "./view.mjs";
|
|
37
44
|
import { ownWriter, ownWritesOf } from "./own-writes.mjs";
|
|
45
|
+
import { ensureRepack } from "./repack.mjs";
|
|
38
46
|
import { publishable, unpublished } from "./publish.mjs";
|
|
39
|
-
import { peeledOf } from "../storage/wants.mjs";
|
|
47
|
+
import { peeledAll, peeledOf } from "../storage/wants.mjs";
|
|
48
|
+
import { CoreParts, ObjectsParts } from "./parts.mjs";
|
|
49
|
+
import { Authorize, check } from "../contracts/authorize.mjs";
|
|
50
|
+
import { read } from "./objects/objects.mjs";
|
|
40
51
|
import { checkWrites } from "@ref0/infra";
|
|
41
52
|
import * as Effect from "effect/Effect";
|
|
53
|
+
import * as Clock$1 from "effect/Clock";
|
|
42
54
|
import * as Result from "effect/Result";
|
|
55
|
+
import * as Equal from "effect/Equal";
|
|
43
56
|
// src/core/push.ts
|
|
44
57
|
/**
|
|
45
58
|
* The push decide reads every ref, private or not: a move's `from`, a folder conflict and a
|
|
46
59
|
* topic's reservation are checked against the repo as it is. What it answers the caller about a
|
|
47
60
|
* name it can't write is `unseenRef`'s, the same whatever is there.
|
|
48
61
|
*/
|
|
49
|
-
const pushWhole = WholeRepo.mint();
|
|
62
|
+
const pushWhole = /* @__PURE__ */ WholeRepo.mint();
|
|
50
63
|
const packsRead = { collection: collections.packs };
|
|
51
64
|
const refsRead = { collection: collections.refs };
|
|
52
65
|
const timesRead = { collection: collections.stats };
|
|
@@ -55,7 +68,6 @@ const cruftRead = {
|
|
|
55
68
|
collection: objectCollections.cruft,
|
|
56
69
|
limit: 65
|
|
57
70
|
};
|
|
58
|
-
const mirrorsRead = { collection: collections.mirrors };
|
|
59
71
|
/**
|
|
60
72
|
* A queue publish refused for `entries`, whose heads would publish commits their own callers may
|
|
61
73
|
* not: each fails alone, and the queue builds the rest again.
|
|
@@ -88,8 +100,8 @@ const refuseQueued = (request, refusals, by) => {
|
|
|
88
100
|
const first = refusals.find((error) => error !== void 0);
|
|
89
101
|
return first === void 0 ? Effect.void : Effect.fail(first);
|
|
90
102
|
};
|
|
91
|
-
/** The edits `
|
|
92
|
-
const unseenOf = (
|
|
103
|
+
/** The edits `refView` refuses: each name its caller can't write, as for a name with no ref there. */
|
|
104
|
+
const unseenOf = (refView, edits) => new Map(refView.whole ? [] : edits.flatMap((edit) => (edit.from === null ? refView.creates(edit.ref) : refView.sees(edit.ref)) ? [] : [[edit.ref, unseenRef(edit.ref)]]));
|
|
93
105
|
/**
|
|
94
106
|
* One fence over `fences`, each caller's, in the push's final read: their reads together, and each
|
|
95
107
|
* check on its own results. A queue's publish hears every credential that ended, by its place.
|
|
@@ -115,16 +127,18 @@ const fenceAll = (request, fences) => {
|
|
|
115
127
|
};
|
|
116
128
|
};
|
|
117
129
|
const moved = { queueMoved: true };
|
|
118
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* A queue's push whose repo moved past the version it planned at, or a build's whose fenced row
|
|
132
|
+
* changed: `UNAVAILABLE`.
|
|
133
|
+
*/
|
|
119
134
|
const queueMoved = (repo) => gitError("UNAVAILABLE", `'${repo}' moved while its merge queue wrote`, {
|
|
120
135
|
hint: "Try again",
|
|
121
136
|
cause: moved
|
|
122
137
|
});
|
|
123
|
-
const atomicHint = "Another ref in this atomic push was refused";
|
|
124
138
|
/** A queue push's refused ref, the cause's before the rest's, so its writes commit with none. */
|
|
125
139
|
const refusalOf = (updated) => {
|
|
126
140
|
const refused = updated.updates.flatMap((update) => update.kind === "rejected" ? [update.error] : []);
|
|
127
|
-
return refused.find((error) => error.
|
|
141
|
+
return refused.find((error) => error.context?.reason !== "atomic-partner") ?? refused[0];
|
|
128
142
|
};
|
|
129
143
|
/** Whether a push failed only since its repo moved past the queue's plan. */
|
|
130
144
|
const isQueueMoved = (error) => error.cause === moved;
|
|
@@ -175,12 +189,12 @@ const markOf = (rows) => {
|
|
|
175
189
|
* caller who can't read the repo gets the read's answer, as for a name with no repo, before a byte
|
|
176
190
|
* of the pack is read: only a caller who can read it is told a push is refused.
|
|
177
191
|
*/
|
|
178
|
-
const firstRead = (
|
|
192
|
+
const firstRead = (caller, operation, internalId) => openRepo(caller, {
|
|
179
193
|
kind: "read",
|
|
180
194
|
repo: operation.repo
|
|
181
195
|
}, [packsRead, prunedKey], internalId);
|
|
182
196
|
/** `firstRead` for a keyed push: `undefined` once `missed`'s repo moved, as `openKeyed` says. */
|
|
183
|
-
const keyedRead = (
|
|
197
|
+
const keyedRead = (caller, operation, missed, internalId) => openKeyed(caller, {
|
|
184
198
|
kind: "read",
|
|
185
199
|
repo: operation.repo
|
|
186
200
|
}, [packsRead, prunedKey], missed, internalId);
|
|
@@ -189,14 +203,10 @@ const keyedRead = (core, caller, operation, missed, internalId) => openKeyed(cor
|
|
|
189
203
|
* received against, its default branch, whose move rebuilds the ready shallow pack, and its
|
|
190
204
|
* `pruned` mark.
|
|
191
205
|
*/
|
|
192
|
-
const listedFor = Effect.fnUntraced(function* (
|
|
206
|
+
const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operation, resolved) {
|
|
193
207
|
const { caller, source } = request;
|
|
194
|
-
const repo =
|
|
195
|
-
|
|
196
|
-
public: resolved.record.public,
|
|
197
|
-
internalId: resolved.internalId
|
|
198
|
-
};
|
|
199
|
-
if (request.queued === void 0) yield* core.authorize({
|
|
208
|
+
const repo = repoAccess(resolved);
|
|
209
|
+
if (request.queued === void 0) yield* check({
|
|
200
210
|
caller,
|
|
201
211
|
operation,
|
|
202
212
|
repo
|
|
@@ -208,8 +218,8 @@ const listedFor = Effect.fnUntraced(function* (core, request, operation, resolve
|
|
|
208
218
|
packs
|
|
209
219
|
};
|
|
210
220
|
const mark = yield* markOf(resolved.snapshot.results[2] ?? []);
|
|
211
|
-
const views = decidingFor(request)
|
|
212
|
-
const [view = viewOf(
|
|
221
|
+
const views = yield* Effect.forEach(decidingFor(request), (one) => viewOf(one, resolved, source));
|
|
222
|
+
const [view = yield* viewOf(caller, resolved, source)] = views;
|
|
213
223
|
return {
|
|
214
224
|
listed,
|
|
215
225
|
defaultBranch: headOf(resolved.record.defaultBranch),
|
|
@@ -225,21 +235,28 @@ const listedFor = Effect.fnUntraced(function* (core, request, operation, resolve
|
|
|
225
235
|
* caller sees, read after `authorize` let the caller in, at a version of their own, which the
|
|
226
236
|
* push's objects read at too.
|
|
227
237
|
*/
|
|
228
|
-
const seenRefsOf = Effect.fnUntraced(function* (
|
|
238
|
+
const seenRefsOf = /* @__PURE__ */ Effect.fnUntraced(function* (view, listed) {
|
|
239
|
+
const core = yield* CoreParts;
|
|
229
240
|
if (!(yield* view.narrowed)) return {
|
|
230
241
|
listed,
|
|
231
242
|
refs: /* @__PURE__ */ new Map()
|
|
232
243
|
};
|
|
233
|
-
const { snapshot } = yield* readRecord(core.store, listed.repo, [
|
|
234
|
-
|
|
235
|
-
|
|
244
|
+
const { snapshot } = yield* readRecord(core.store, listed.repo, [
|
|
245
|
+
refsRead,
|
|
246
|
+
packsRead,
|
|
247
|
+
indexRowKey
|
|
248
|
+
]);
|
|
249
|
+
const [, refRows = [], packRows = [], indexRows = []] = snapshot.results;
|
|
250
|
+
const packs = yield* decodePacks(packRows);
|
|
251
|
+
const refs = yield* view.refs(refRows);
|
|
236
252
|
return {
|
|
237
253
|
listed: {
|
|
238
254
|
...listed,
|
|
239
255
|
version: snapshot.version,
|
|
240
256
|
packs
|
|
241
257
|
},
|
|
242
|
-
refs
|
|
258
|
+
refs,
|
|
259
|
+
index: indexRows[0]?.value
|
|
243
260
|
};
|
|
244
261
|
});
|
|
245
262
|
/**
|
|
@@ -267,13 +284,9 @@ const pushedOf = (objects, listed, received) => {
|
|
|
267
284
|
* Whether the push brings commit `oid`, for the file rules' walk: its own object, read as `pushed`
|
|
268
285
|
* reads one, its bytes let go unread. A read that fails throws, so the walk trusts nothing.
|
|
269
286
|
*/
|
|
270
|
-
const broughtCommit = (pushed,
|
|
271
|
-
const object = await runIn(Effect.mapError(pushed({ oid }), thrownError), scope);
|
|
272
|
-
await object?.bytes.cancel().catch(() => void 0);
|
|
273
|
-
return object?.type === "commit";
|
|
274
|
-
};
|
|
287
|
+
const broughtCommit = (pushed) => (oid) => Effect.flatMap(pushed({ oid }), (object) => Effect.as(Effect.promise(() => object?.bytes.cancel().catch(() => void 0) ?? Promise.resolve()), object?.type === "commit"));
|
|
275
288
|
/** The refs the repo mirrors, among `rows` of `mirrors`: each one an active mirror names. */
|
|
276
|
-
const activeMirrors = Effect.fnUntraced(function* (rows) {
|
|
289
|
+
const activeMirrors = /* @__PURE__ */ Effect.fnUntraced(function* (rows) {
|
|
277
290
|
const active = /* @__PURE__ */ new Set();
|
|
278
291
|
for (const row of rows) if ((yield* decodeRow(MirrorRow, row, `Mirror '${row.id}'`)).state === "active") active.add(row.id);
|
|
279
292
|
return active;
|
|
@@ -309,7 +322,25 @@ const withReceivedRows = (objects, received) => {
|
|
|
309
322
|
const row = rows.get(input.oid);
|
|
310
323
|
return row === void 0 ? objects.read(listed, input) : Effect.map(objectOfRow(row), gitObjectOf);
|
|
311
324
|
},
|
|
312
|
-
|
|
325
|
+
headers: Effect.fnUntraced(function* (listed, input) {
|
|
326
|
+
const answer = /* @__PURE__ */ new Map();
|
|
327
|
+
const stored = input.oids.filter((oid) => !rows.has(oid));
|
|
328
|
+
for (const oid of input.oids) {
|
|
329
|
+
const row = rows.get(oid);
|
|
330
|
+
if (row === void 0) continue;
|
|
331
|
+
const object = yield* objectOfRow(row);
|
|
332
|
+
answer.set(oid, {
|
|
333
|
+
type: object.type,
|
|
334
|
+
size: object.bytes.byteLength
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
if (stored.length > 0) for (const [oid, header] of yield* objects.headers(listed, {
|
|
338
|
+
...input,
|
|
339
|
+
oids: stored
|
|
340
|
+
})) answer.set(oid, header);
|
|
341
|
+
return answer;
|
|
342
|
+
}),
|
|
343
|
+
objects: Effect.fnUntraced(function* (listed, input) {
|
|
313
344
|
const asked = [...new Set(input.oids)];
|
|
314
345
|
const [first] = asked;
|
|
315
346
|
if (first === void 0 || !asked.some((oid) => rows.has(oid))) return yield* objects.objects(listed, {
|
|
@@ -331,14 +362,50 @@ const withReceivedRows = (objects, received) => {
|
|
|
331
362
|
};
|
|
332
363
|
};
|
|
333
364
|
/**
|
|
365
|
+
* The rows a build's write is fenced on, the one list of them (Q885): the repo's `pruned` mark, as
|
|
366
|
+
* its links read objects a prune may drop; its target's queue row, which names its open holds, and
|
|
367
|
+
* each of their rows, `holds`, which its lift reads; the target's ref, its tip, which a land links
|
|
368
|
+
* onto and a merge at the build compares; its candidate's row; and each entry it links, found or
|
|
369
|
+
* not. An entry's notes are fixed by its row: its `meta` and its report are each written only with
|
|
370
|
+
* a put of an entry's row that names them, which `pushPlan` holds. A key row (`latest`, `merged`)
|
|
371
|
+
* isn't one: a build reads none. The build takes each one's value from the read its plan made, and
|
|
372
|
+
* `finalRead` reads them again, so the write commits only while every one holds it, whatever else
|
|
373
|
+
* the repo's other writes moved.
|
|
374
|
+
*/
|
|
375
|
+
const buildFence = (build) => [
|
|
376
|
+
prunedKey,
|
|
377
|
+
{
|
|
378
|
+
collection: collections.queueTargets,
|
|
379
|
+
id: build.target
|
|
380
|
+
},
|
|
381
|
+
...build.holds.map((id) => ({
|
|
382
|
+
collection: collections.queueHolds,
|
|
383
|
+
id
|
|
384
|
+
})),
|
|
385
|
+
{
|
|
386
|
+
collection: collections.refs,
|
|
387
|
+
id: build.target
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
collection: collections.queueCandidates,
|
|
391
|
+
id: build.candidate
|
|
392
|
+
},
|
|
393
|
+
...build.entries.map((id) => ({
|
|
394
|
+
collection: collections.queueEntries,
|
|
395
|
+
id
|
|
396
|
+
}))
|
|
397
|
+
];
|
|
398
|
+
/**
|
|
334
399
|
* The decide's read, one of the repo's scope: its refs, its outbox, the push's own `quarantine` row
|
|
335
|
-
* if it has one, its key's receipt if it has a key, the
|
|
400
|
+
* if it has one, its key's receipt if it has a key, the mirror of each ref in `touched`, the
|
|
401
|
+
* queue's row of each branch in `branches`,
|
|
336
402
|
* with the live reservation each holds, and the caller's grant fence, checked on what it read. A revoke after it moves the version, as
|
|
337
403
|
* does a write with the same key that commits first. A prune that dropped objects since the first
|
|
338
404
|
* read moved the `pruned` mark: the push may name one it dropped, so unless its key's receipt
|
|
339
|
-
* answers, it fails, to be sent again (Q270).
|
|
405
|
+
* answers, it fails, to be sent again (Q270). `changed`: whether a row of a build's fence,
|
|
406
|
+
* `unchanged`, holds another value than its plan read.
|
|
340
407
|
*/
|
|
341
|
-
const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kept, mark, branches) {
|
|
408
|
+
const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fence, received, kept, mark, branches, touched, guard, unchanged = []) {
|
|
342
409
|
const own = received?.quarantine === void 0 ? [] : [received.quarantine];
|
|
343
410
|
const keyed = receiptReads(kept);
|
|
344
411
|
const targets = branches.map((id) => ({
|
|
@@ -352,21 +419,30 @@ const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kep
|
|
|
352
419
|
}));
|
|
353
420
|
const { record, snapshot } = yield* readRecord(store, repo.internalId, [
|
|
354
421
|
refsRead,
|
|
355
|
-
mirrorsRead,
|
|
356
422
|
...outboxReads,
|
|
357
423
|
packsRead,
|
|
358
424
|
prunedKey,
|
|
359
425
|
timesRead,
|
|
360
426
|
cruftRead,
|
|
361
427
|
indexRowKey,
|
|
428
|
+
reachedKey,
|
|
362
429
|
...own,
|
|
363
430
|
...keyed,
|
|
364
431
|
...targets,
|
|
365
|
-
...fence.reads
|
|
432
|
+
...fence.reads,
|
|
433
|
+
...guard?.reads ?? [],
|
|
434
|
+
...unchanged.map(({ collection, id }) => ({
|
|
435
|
+
collection,
|
|
436
|
+
id
|
|
437
|
+
})),
|
|
438
|
+
...touched.map((id) => ({
|
|
439
|
+
collection: collections.mirrors,
|
|
440
|
+
id
|
|
441
|
+
}))
|
|
366
442
|
], rowCounts);
|
|
367
443
|
if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${repo.name}'`);
|
|
368
|
-
const [, refRows = [],
|
|
369
|
-
const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], ...rest] = more;
|
|
444
|
+
const [, refRows = [], headRows = [], cursorRows = [], packRows = [], ...more] = snapshot.results;
|
|
445
|
+
const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], reachedRows = [], ...rest] = more;
|
|
370
446
|
const receipt = yield* heldReceipt(rest.slice(own.length, own.length + keyed.length), kept);
|
|
371
447
|
if (receipt === void 0 && (yield* markOf(markRows)) !== mark) return yield* fail("UNAVAILABLE", "The repo was pruned during the push", { hint: "Push again" });
|
|
372
448
|
const targeted = rest.slice(own.length + keyed.length, own.length + keyed.length + targets.length);
|
|
@@ -376,7 +452,14 @@ const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kep
|
|
|
376
452
|
const reservation = live[index];
|
|
377
453
|
return reservation === void 0 ? [] : [[branch, reservedTarget(branch, reservation)]];
|
|
378
454
|
}));
|
|
379
|
-
const
|
|
455
|
+
const fencedAt = own.length + keyed.length + targets.length;
|
|
456
|
+
const fenced = rest.slice(fencedAt, fencedAt + fence.reads.length);
|
|
457
|
+
const guardAt = fencedAt + fence.reads.length;
|
|
458
|
+
const guardedAt = guardAt + (guard?.reads.length ?? 0);
|
|
459
|
+
if (guard !== void 0) yield* guard.check(rest.slice(guardAt, guardedAt));
|
|
460
|
+
const now = rest.slice(guardedAt, guardedAt + unchanged.length);
|
|
461
|
+
const mirrorRows = rest.slice(guardedAt + unchanged.length).flat();
|
|
462
|
+
const changed = unchanged.some((row, at) => !Equal.equals(row.value, now[at]?.[0]?.value));
|
|
380
463
|
const packs = yield* decodePacks(packRows);
|
|
381
464
|
const times = yield* decodeTimes(timeRows);
|
|
382
465
|
const [ownRow] = own.length === 0 ? [] : rest[0] ?? [];
|
|
@@ -391,7 +474,10 @@ const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kep
|
|
|
391
474
|
const read = {
|
|
392
475
|
version: snapshot.version,
|
|
393
476
|
refs,
|
|
394
|
-
|
|
477
|
+
refBytes: refBytesOf(refRows),
|
|
478
|
+
head: headOf(record.defaultBranch),
|
|
479
|
+
record,
|
|
480
|
+
marked: reachedRows.length > 0
|
|
395
481
|
};
|
|
396
482
|
const at = {
|
|
397
483
|
repo: repo.internalId,
|
|
@@ -424,7 +510,8 @@ const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kep
|
|
|
424
510
|
times,
|
|
425
511
|
queued,
|
|
426
512
|
reserved,
|
|
427
|
-
indexRow
|
|
513
|
+
indexRow,
|
|
514
|
+
changed
|
|
428
515
|
};
|
|
429
516
|
});
|
|
430
517
|
const settingsOf = (record) => ({
|
|
@@ -432,32 +519,10 @@ const settingsOf = (record) => ({
|
|
|
432
519
|
public: record.public,
|
|
433
520
|
defaultBranch: record.defaultBranch
|
|
434
521
|
});
|
|
435
|
-
/** `objects`' batches as the engine's `ReadObjects`, over `listed`, each run in `scope`. */
|
|
436
|
-
const batchOf = (objects, listed, scope) => (input) => runIn(Effect.match(objects.objects(listed, input), {
|
|
437
|
-
onSuccess: (value) => ({
|
|
438
|
-
kind: "success",
|
|
439
|
-
value
|
|
440
|
-
}),
|
|
441
|
-
onFailure: (error) => ({
|
|
442
|
-
kind: "error",
|
|
443
|
-
error
|
|
444
|
-
})
|
|
445
|
-
}), scope);
|
|
446
|
-
/** `objects`' reads as the engine's `ReadObject`, over `listed`, each run in `scope`. */
|
|
447
|
-
const readerOf = (objects, listed, scope) => (input) => runIn(Effect.match(objects.read(listed, input), {
|
|
448
|
-
onSuccess: (value) => ({
|
|
449
|
-
kind: "success",
|
|
450
|
-
value
|
|
451
|
-
}),
|
|
452
|
-
onFailure: (error) => ({
|
|
453
|
-
kind: "error",
|
|
454
|
-
error
|
|
455
|
-
})
|
|
456
|
-
}), scope);
|
|
457
522
|
/** The rules, then `hooks.preReceive`, once, at the first read the push decides on. */
|
|
458
|
-
const runChecks = Effect.fnUntraced(function* (checks, input, facts) {
|
|
523
|
+
const runChecks = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, facts) {
|
|
459
524
|
const context = checking(input);
|
|
460
|
-
const ruled = yield*
|
|
525
|
+
const ruled = yield* claimedAfter(checks, input, yield* runPushRules(checks, input, context));
|
|
461
526
|
const whole = yield* runPreReceive(checks.reports, checks.preReceive, context, {
|
|
462
527
|
atomic: input.atomic,
|
|
463
528
|
updates: ruled.updates,
|
|
@@ -479,17 +544,21 @@ const runChecks = Effect.fnUntraced(function* (checks, input, facts) {
|
|
|
479
544
|
* hook refuses, on a ref none refused before, is told by its place, and the push fails. Passed, the
|
|
480
545
|
* answer is the first caller's, with the files allowed and the rules lifted for any of them.
|
|
481
546
|
*/
|
|
482
|
-
const checkAll = Effect.fnUntraced(function* (checks, request, input, facts, authorizeAs) {
|
|
547
|
+
const checkAll = /* @__PURE__ */ Effect.fnUntraced(function* (checks, request, input, facts, authorizeAs) {
|
|
483
548
|
if (request.queued === void 0) return yield* runChecks(checks, input, facts);
|
|
484
549
|
const each = [];
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
550
|
+
const refusals = [];
|
|
551
|
+
for (const caller of request.queued.callers) {
|
|
552
|
+
const one = yield* runChecks(checks, {
|
|
553
|
+
...input,
|
|
554
|
+
caller,
|
|
555
|
+
authorize: authorizeAs(caller)
|
|
556
|
+
}, facts);
|
|
557
|
+
const refusal = one.whole ?? [...one.refused].find(([ref]) => !input.refused.has(ref))?.[1];
|
|
558
|
+
if (refusal !== void 0 && retriedCodes.has(refusal.code)) return yield* Effect.fail(refusal);
|
|
559
|
+
each.push(one);
|
|
560
|
+
refusals.push(refusal);
|
|
561
|
+
}
|
|
493
562
|
yield* refuseQueued(request, refusals, "rules");
|
|
494
563
|
const union = (pick) => {
|
|
495
564
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -508,25 +577,28 @@ const checkAll = Effect.fnUntraced(function* (checks, request, input, facts, aut
|
|
|
508
577
|
bypassed: union((one) => one.bypassed)
|
|
509
578
|
};
|
|
510
579
|
});
|
|
511
|
-
/**
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
580
|
+
/**
|
|
581
|
+
* The rules' answer, with the refs the claimed checks refuse among the rest: each in turn, by band
|
|
582
|
+
* then claim name, on the refs none before it refused, so a ref's first refusal is its answer.
|
|
583
|
+
*/
|
|
584
|
+
const claimedAfter = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, ruled) {
|
|
585
|
+
const refused = new Map(ruled.refused);
|
|
586
|
+
for (const { handler } of checks.claimed?.() ?? []) {
|
|
587
|
+
const updates = ruled.updates.filter((update) => !refused.has(update.ref));
|
|
588
|
+
if (updates.length === 0) break;
|
|
589
|
+
for (const [ref, error] of yield* handler(input, updates)) if (!refused.has(ref)) refused.set(ref, error);
|
|
590
|
+
}
|
|
519
591
|
return {
|
|
520
592
|
...ruled,
|
|
521
|
-
refused
|
|
593
|
+
refused
|
|
522
594
|
};
|
|
523
595
|
});
|
|
524
|
-
/** Whether a push has anything to check: a rule,
|
|
525
|
-
const checksOf = (core)
|
|
596
|
+
/** Whether a push has anything to check: a rule, a claimed check, or `hooks.preReceive`. */
|
|
597
|
+
const checksOf = /* @__PURE__ */ Effect.fnUntraced(function* (core) {
|
|
526
598
|
const { checks } = core;
|
|
527
599
|
if (checks === void 0) return void 0;
|
|
528
|
-
return checks
|
|
529
|
-
};
|
|
600
|
+
return (yield* pushRulesFor(checks)).length > 0 || checks.preReceive !== void 0 || (checks.claimed?.().length ?? 0) > 0 ? checks : void 0;
|
|
601
|
+
});
|
|
530
602
|
/**
|
|
531
603
|
* The repo's objects with the push's own, for the built-in check: `objects` and `listed` read
|
|
532
604
|
* both, and `received` is the push's alone.
|
|
@@ -540,6 +612,17 @@ const pushedObjectsOf = (objects, listed, received, own) => {
|
|
|
540
612
|
lfsPointers: received?.lfsPointers ?? noLfsPointers
|
|
541
613
|
};
|
|
542
614
|
};
|
|
615
|
+
/** `decision`, a commit that clears the mark, with the clear's row at `at` among its puts. */
|
|
616
|
+
const clearedAt = (decision, at) => decision.kind === "commit" ? {
|
|
617
|
+
...decision,
|
|
618
|
+
change: {
|
|
619
|
+
...decision.change,
|
|
620
|
+
put: [...decision.change.put, {
|
|
621
|
+
...pruneClearedKey,
|
|
622
|
+
value: { at }
|
|
623
|
+
}]
|
|
624
|
+
}
|
|
625
|
+
} : decision;
|
|
543
626
|
/**
|
|
544
627
|
* What a decision commits: its writes and jobs at `expect`, or, for an answer that moves no ref,
|
|
545
628
|
* nothing, which a keyed write's receipt still commits at the read's version. A refusal fails.
|
|
@@ -568,7 +651,7 @@ const planOf = (decision, version, jobs) => {
|
|
|
568
651
|
* Each force among `kinds.updates` that its exact walk agrees is one, as a `diverged` refusal in
|
|
569
652
|
* `diverged`, or the walk's own error past its bound in `refused`.
|
|
570
653
|
*/
|
|
571
|
-
const divergedOf = Effect.fnUntraced(function* (kinds) {
|
|
654
|
+
const divergedOf = /* @__PURE__ */ Effect.fnUntraced(function* (kinds) {
|
|
572
655
|
const refused = /* @__PURE__ */ new Map();
|
|
573
656
|
const diverged = /* @__PURE__ */ new Map();
|
|
574
657
|
for (const update of kinds.updates) {
|
|
@@ -597,7 +680,7 @@ const divergedOf = Effect.fnUntraced(function* (kinds) {
|
|
|
597
680
|
* What the checks refused, and for a fetch, each diverged ref: refused, or with `force`, among
|
|
598
681
|
* `forced`.
|
|
599
682
|
*/
|
|
600
|
-
const fetchedRefused = Effect.fnUntraced(function* (kinds, request) {
|
|
683
|
+
const fetchedRefused = /* @__PURE__ */ Effect.fnUntraced(function* (kinds, request) {
|
|
601
684
|
const { fetched } = request;
|
|
602
685
|
if (fetched === void 0) return {
|
|
603
686
|
refused: kinds.refused,
|
|
@@ -636,7 +719,7 @@ const commitTooLarge = (received, body) => (error) => {
|
|
|
636
719
|
return gitError("RESOURCE_EXHAUSTED", `push's objects don't fit one commit: ${error.message}`, {
|
|
637
720
|
cause: error,
|
|
638
721
|
hint: "Push fewer objects at a time",
|
|
639
|
-
hostHint: "Use
|
|
722
|
+
hostHint: "Use Objects.layer() storage, which keeps a push's objects in the bucket",
|
|
640
723
|
context: { reason: "too-large" }
|
|
641
724
|
});
|
|
642
725
|
};
|
|
@@ -649,6 +732,13 @@ const fits = (change) => {
|
|
|
649
732
|
return false;
|
|
650
733
|
}
|
|
651
734
|
};
|
|
735
|
+
/** A push whose links or old tips the caller's set can't close yet, as between a large push and its update. */
|
|
736
|
+
const unindexedPush = () => gitError("RESOURCE_EXHAUSTED", "This push can't be checked until the repo's index is updated", {
|
|
737
|
+
hint: "Push again once the index is updated",
|
|
738
|
+
context: { reason: "walk-limit" }
|
|
739
|
+
});
|
|
740
|
+
/** `error`, a read by ID the index can't close yet told as the push's own. */
|
|
741
|
+
const asPushCheck = (error) => isUnindexedRead(error) ? unindexedPush() : error;
|
|
652
742
|
/** The request's pack into its quarantine, or `undefined` for a push with none. */
|
|
653
743
|
const receive = (objects, listed, request) => {
|
|
654
744
|
const { pack, shallow, signal } = request;
|
|
@@ -656,6 +746,10 @@ const receive = (objects, listed, request) => {
|
|
|
656
746
|
received: void 0,
|
|
657
747
|
rooted: void 0
|
|
658
748
|
});
|
|
749
|
+
if ("received" in pack) return Effect.succeed({
|
|
750
|
+
received: pack.received,
|
|
751
|
+
rooted: void 0
|
|
752
|
+
});
|
|
659
753
|
const input = {
|
|
660
754
|
pack: pack.bytes,
|
|
661
755
|
objects: pack.objects
|
|
@@ -665,6 +759,9 @@ const receive = (objects, listed, request) => {
|
|
|
665
759
|
if (shallow !== void 0 && shallow.length > 0) input.shallow = shallow;
|
|
666
760
|
if (signal !== void 0) input.signal = signal;
|
|
667
761
|
if (pack.partial === true) input.partial = true;
|
|
762
|
+
if (pack.boundary !== void 0 && pack.boundary.length > 0) input.boundary = pack.boundary;
|
|
763
|
+
if (pack.needs !== void 0 && pack.needs.length > 0) input.needs = pack.needs;
|
|
764
|
+
if (pack.cutMost !== void 0) input.cutMost = pack.cutMost;
|
|
668
765
|
return scopedReceive(objects, listed, input).pipe(Effect.map((received) => ({
|
|
669
766
|
received,
|
|
670
767
|
rooted: void 0
|
|
@@ -673,15 +770,20 @@ const receive = (objects, listed, request) => {
|
|
|
673
770
|
rooted
|
|
674
771
|
})));
|
|
675
772
|
};
|
|
676
|
-
/**
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
773
|
+
/**
|
|
774
|
+
* `ref.updated`'s `push`: the write, how many branches and tags it moved and each private
|
|
775
|
+
* pattern's part of them (`pushCounts`), its source, and the slice its push options name, if they
|
|
776
|
+
* do (Q901).
|
|
777
|
+
*/
|
|
778
|
+
const pushOf = (access, id, moved, request) => {
|
|
779
|
+
const push = {
|
|
680
780
|
id,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
source
|
|
781
|
+
...pushCounts(access, moved),
|
|
782
|
+
source: request.source
|
|
684
783
|
};
|
|
784
|
+
const slice = sliceOf(request.pushOptions ?? []);
|
|
785
|
+
if (slice !== void 0) push.slice = slice;
|
|
786
|
+
return push;
|
|
685
787
|
};
|
|
686
788
|
/**
|
|
687
789
|
* What a push's commit saves for `hooks.postReceive`, when the host passed one: the push, with
|
|
@@ -721,17 +823,26 @@ const savedPush = (checks, push) => {
|
|
|
721
823
|
* version, with the ref moves, the receipt, the events and the push `hooks.postReceive` owes.
|
|
722
824
|
* `answers` says what the call answers and keeps.
|
|
723
825
|
*/
|
|
724
|
-
const pushOnto = (
|
|
826
|
+
const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, view, views }, key, answers) => Effect.scoped(Effect.gen(function* () {
|
|
827
|
+
const core = yield* CoreParts;
|
|
828
|
+
const { objects: sealed } = yield* ObjectsParts;
|
|
829
|
+
const authorize = yield* Authorize;
|
|
725
830
|
const { store } = core;
|
|
726
831
|
const { caller, repo, signal } = request;
|
|
727
832
|
const call = signal === void 0 ? {} : { signal };
|
|
728
|
-
const seen = yield* seenRefsOf(
|
|
729
|
-
const { received, rooted } = yield* receive(yield*
|
|
833
|
+
const seen = yield* seenRefsOf(view, listed);
|
|
834
|
+
const { received, rooted } = yield* receive(yield* read({
|
|
835
|
+
view,
|
|
836
|
+
at: seen
|
|
837
|
+
}), listed, request).pipe(Effect.tapError((error) => isAwaitingRepack(error) ? bestEffort(ensureRepack(core, core.jobs, repoScope(listed.repo))) : Effect.void), Effect.mapError(asPushCheck));
|
|
730
838
|
const viewed = received === void 0 ? seen : {
|
|
731
839
|
...seen,
|
|
732
840
|
pushed: received
|
|
733
841
|
};
|
|
734
|
-
const objects = yield* walkObjects(
|
|
842
|
+
const objects = yield* walkObjects(objectsFace(yield* read({
|
|
843
|
+
view,
|
|
844
|
+
at: viewed
|
|
845
|
+
})), received?.allotment);
|
|
735
846
|
const pushedObjects = withReceivedRows(objects, received);
|
|
736
847
|
const pushedListed = withReceived(listed, received);
|
|
737
848
|
const pushed = pushedOf(objects, listed, received);
|
|
@@ -743,7 +854,7 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
743
854
|
...call
|
|
744
855
|
};
|
|
745
856
|
if (rooted !== void 0) kindsInput.missing = rooted;
|
|
746
|
-
const kinds = yield* kindsOf(kindsInput);
|
|
857
|
+
const kinds = yield* kindsOf(kindsInput).pipe(Effect.mapError(asPushCheck));
|
|
747
858
|
const fetchedOff = yield* fetchedRefused(kinds, request);
|
|
748
859
|
const { forced } = fetchedOff;
|
|
749
860
|
const refused = new Map(fetchedOff.refused);
|
|
@@ -751,17 +862,17 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
751
862
|
const own = gitsOwnRef(update.ref, request.source);
|
|
752
863
|
if (own !== void 0 && !refused.has(update.ref)) refused.set(update.ref, own);
|
|
753
864
|
}
|
|
754
|
-
const
|
|
755
|
-
const unseens =
|
|
865
|
+
const refViews = yield* Effect.forEach(views, (one) => one.refView);
|
|
866
|
+
const unseens = refViews.map((refView) => unseenOf(refView, request.edits));
|
|
756
867
|
yield* refuseQueued(request, unseens.map((one) => one.values().next().value), "access");
|
|
757
868
|
const unseen = unseens[0] ?? /* @__PURE__ */ new Map();
|
|
758
869
|
const { updates } = kinds;
|
|
759
870
|
for (const [ref, error] of unseen) refused.set(ref, error);
|
|
760
871
|
const { access } = core;
|
|
761
|
-
const barred = access?.patterns.some((pattern) =>
|
|
762
|
-
const whole =
|
|
872
|
+
const barred = access?.patterns.some((pattern) => refViews.some((refView) => !publishable(refView, pattern))) === true;
|
|
873
|
+
const whole = objectsFace(SealedObjects.whole(sealed, pushWhole));
|
|
763
874
|
const wholePushed = access === void 0 || !barred && request.publishes === void 0 ? void 0 : withReceivedRows(yield* walkObjects(whole, received?.allotment), received);
|
|
764
|
-
const
|
|
875
|
+
const refView = refViews[0] ?? (yield* view.refView);
|
|
765
876
|
const publishedRefs = (refs) => new Map([...refs].filter(([ref]) => hiddenUnder(ref) === void 0));
|
|
766
877
|
const writer = access === void 0 ? void 0 : yield* ownWriter(caller);
|
|
767
878
|
const made = new Set(request.own);
|
|
@@ -769,14 +880,18 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
769
880
|
const here = oids.filter((oid) => made.has(oid));
|
|
770
881
|
const stored = oids.filter((oid) => !made.has(oid));
|
|
771
882
|
if (stored.length === 0) return Effect.succeed(new Set(here));
|
|
772
|
-
return Effect.map(Effect.flatMap(
|
|
883
|
+
return Effect.map(Effect.flatMap(Clock$1.currentTimeMillis, (now) => ownWritesOf(core.store, listed.repo, writer, stored, now)), (kept) => /* @__PURE__ */ new Set([...here, ...kept]));
|
|
773
884
|
};
|
|
774
|
-
const unpublishedAt = (refs, at, judging, edits, own) => access === void 0 || wholePushed === void 0 ? Effect.succeed(/* @__PURE__ */ new Map()) : unpublished({
|
|
885
|
+
const unpublishedAt = (refs, at, index, judging, edits, own) => access === void 0 || wholePushed === void 0 ? Effect.succeed(/* @__PURE__ */ new Map()) : unpublished({
|
|
775
886
|
access,
|
|
776
|
-
|
|
887
|
+
refView: judging,
|
|
777
888
|
refs: publishedRefs(refs),
|
|
778
889
|
objects: whole,
|
|
779
890
|
listed: at,
|
|
891
|
+
visible: (tips, fallback) => SealedObjects.visibleWhole(sealed, pushWhole, at, {
|
|
892
|
+
tips,
|
|
893
|
+
row: index?.value
|
|
894
|
+
}, fallback),
|
|
780
895
|
pushed: wholePushed,
|
|
781
896
|
pushedListed: withReceived(at, received),
|
|
782
897
|
edits,
|
|
@@ -784,9 +899,9 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
784
899
|
...call
|
|
785
900
|
});
|
|
786
901
|
const headsOf = (edit) => edit.to === null ? void 0 : request.publishes?.get(edit.ref);
|
|
787
|
-
const publishedAt =
|
|
902
|
+
const publishedAt = Effect.fnUntraced(function* (refs, at, index) {
|
|
788
903
|
const plain = request.edits.filter((edit) => headsOf(edit) === void 0);
|
|
789
|
-
const refused = new Map(yield* unpublishedAt(refs, at,
|
|
904
|
+
const refused = new Map(yield* unpublishedAt(refs, at, index, refView, plain, ownOf));
|
|
790
905
|
for (const edit of request.edits) {
|
|
791
906
|
const heads = headsOf(edit);
|
|
792
907
|
if (heads === void 0) continue;
|
|
@@ -796,8 +911,8 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
796
911
|
}
|
|
797
912
|
const failed = [];
|
|
798
913
|
for (const { entry, head, caller: its } of heads) {
|
|
799
|
-
const judging = yield*
|
|
800
|
-
if ((yield* unpublishedAt(refs, at, judging, [{
|
|
914
|
+
const judging = yield* refViewIn(its, checkedRepo);
|
|
915
|
+
if ((yield* unpublishedAt(refs, at, index, judging, [{
|
|
801
916
|
...edit,
|
|
802
917
|
to: head
|
|
803
918
|
}])).has(edit.ref)) failed.push(entry);
|
|
@@ -806,11 +921,19 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
806
921
|
}
|
|
807
922
|
return refused;
|
|
808
923
|
});
|
|
924
|
+
const tagTips = updates.flatMap((update) => update.to !== null && storesPeel(update.ref) ? [update.to] : []);
|
|
925
|
+
const peeling = yield* peeledAll(pushedObjects, pushedListed, tagTips);
|
|
926
|
+
const peels = new Map(tagTips.map((tip) => [tip, peeling.peeled.get(tip) ?? null]));
|
|
927
|
+
for (const update of updates) {
|
|
928
|
+
const error = update.to === null ? void 0 : peeling.refused.get(update.to);
|
|
929
|
+
if (error !== void 0 && storesPeel(update.ref) && !refused.has(update.ref)) refused.set(update.ref, error);
|
|
930
|
+
}
|
|
809
931
|
const command = {
|
|
810
932
|
source: request.source,
|
|
811
933
|
updates,
|
|
812
934
|
atomic: request.atomic,
|
|
813
|
-
refused
|
|
935
|
+
refused,
|
|
936
|
+
peels
|
|
814
937
|
};
|
|
815
938
|
if (received !== void 0) command.received = received;
|
|
816
939
|
const target = {
|
|
@@ -822,11 +945,12 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
822
945
|
const jobs = (received?.change.add?.length ?? 0) > 0 || ready ? [core.repackJobRow()] : [];
|
|
823
946
|
const own = updates.filter((update) => gitsOwnMove(request.source, update.ref));
|
|
824
947
|
const outside = updates.filter((update) => !gitsOwnMove(request.source, update.ref));
|
|
825
|
-
const checks = outside.length === 0 ? void 0 : checksOf(core);
|
|
948
|
+
const checks = outside.length === 0 ? void 0 : yield* checksOf(core);
|
|
826
949
|
const branches = request.source === "queue" ? [] : outside.map((update) => update.ref).filter((ref) => ref.startsWith("refs/heads/"));
|
|
827
950
|
const scope = yield* callScope;
|
|
828
951
|
const reader = readerOf(pushedObjects, pushedListed, scope);
|
|
829
952
|
const batch = batchOf(pushedObjects, pushedListed, scope);
|
|
953
|
+
const { between } = yield* Changes;
|
|
830
954
|
const unaborted = signal ?? new AbortController().signal;
|
|
831
955
|
const base = {
|
|
832
956
|
caller,
|
|
@@ -840,9 +964,14 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
840
964
|
},
|
|
841
965
|
exact: kinds.exact,
|
|
842
966
|
scope,
|
|
843
|
-
changes: (updates) =>
|
|
967
|
+
changes: (updates) => Effect.map(Effect.forEach(updates, ({ from, to }) => between({
|
|
968
|
+
objects: pushedObjects,
|
|
969
|
+
listed: pushedListed,
|
|
970
|
+
from: from ?? void 0,
|
|
971
|
+
to: to ?? void 0
|
|
972
|
+
})), (each) => each.flat()),
|
|
844
973
|
objects: pushedObjectsOf(pushedObjects, pushedListed, received, pushed),
|
|
845
|
-
authorize: (operation) =>
|
|
974
|
+
authorize: (operation) => authorize.check({
|
|
846
975
|
caller,
|
|
847
976
|
operation,
|
|
848
977
|
repo: checkedRepo
|
|
@@ -857,21 +986,20 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
857
986
|
source: request.source,
|
|
858
987
|
allotment: received?.allotment,
|
|
859
988
|
readerAllotment: pushedObjects.allotment(pushedListed, openTreeBytes, openTreesRefusal),
|
|
860
|
-
brought: broughtCommit(pushed
|
|
861
|
-
scope
|
|
989
|
+
brought: broughtCommit(pushed)
|
|
862
990
|
};
|
|
863
991
|
if (request.pushOptions !== void 0) base.pushOptions = request.pushOptions;
|
|
864
992
|
if (request.request !== void 0) base.request = request.request;
|
|
865
993
|
let checked;
|
|
866
994
|
for (let tries = 0; tries < 10; tries += 1) {
|
|
867
|
-
const at = yield*
|
|
868
|
-
const decide = yield* finalRead(store, target, fence, received, key, mark, branches);
|
|
995
|
+
const at = yield* Clock$1.currentTimeMillis;
|
|
996
|
+
const decide = yield* finalRead(store, target, fence, received, key, mark, branches, updates.map(({ ref }) => ref), request.guard, request.writes?.unchanged);
|
|
869
997
|
const { read, receipt, outbox, record, mirrored, facts, stats, times, queued, reserved, indexRow } = decide;
|
|
870
|
-
const indexed = SealedObjects.whole(
|
|
998
|
+
const indexed = SealedObjects.whole(sealed, pushWhole).index?.status(indexRow, at, listedIds(decide.at, received?.change));
|
|
871
999
|
if (receipt !== void 0) return yield* answers.held(receipt);
|
|
872
|
-
const published = yield* publishedAt(read.refs, decide.at);
|
|
1000
|
+
const published = yield* publishedAt(read.refs, decide.at, indexRow);
|
|
873
1001
|
const { writes } = request;
|
|
874
|
-
if (writes !== void 0 && read.version !== writes.version) return yield* Effect.fail(queueMoved(repo));
|
|
1002
|
+
if (writes !== void 0 && (writes.unchanged === void 0 ? read.version !== writes.version : decide.changed)) return yield* Effect.fail(queueMoved(repo));
|
|
875
1003
|
const seen = {
|
|
876
1004
|
...facts,
|
|
877
1005
|
tips: tipsOf(read.refs, outside)
|
|
@@ -898,7 +1026,7 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
898
1026
|
return commitChangesOf(judging, updates);
|
|
899
1027
|
}
|
|
900
1028
|
};
|
|
901
|
-
checked = yield* checkAll(checks, request, input, seen, (one) => (operation) =>
|
|
1029
|
+
checked = yield* checkAll(checks, request, input, seen, (one) => (operation) => authorize.check({
|
|
902
1030
|
caller: one,
|
|
903
1031
|
operation,
|
|
904
1032
|
repo: checkedRepo
|
|
@@ -923,18 +1051,24 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
923
1051
|
...unseen
|
|
924
1052
|
])
|
|
925
1053
|
};
|
|
926
|
-
const
|
|
1054
|
+
const chosen = decidePush({
|
|
927
1055
|
read,
|
|
928
|
-
command: decided
|
|
929
|
-
|
|
1056
|
+
command: decided,
|
|
1057
|
+
index: core.refIndex
|
|
1058
|
+
});
|
|
1059
|
+
const clears = read.marked === true && clearsMark(chosen);
|
|
1060
|
+
const decision = clears ? clearedAt(chosen, at) : chosen;
|
|
1061
|
+
const upkept = clears && jobs.length === 0 ? [core.repackJobRow()] : jobs;
|
|
1062
|
+
const planned = yield* planOf(decision, read.version, upkept);
|
|
930
1063
|
const { change } = planned;
|
|
931
1064
|
const refusal = writes === void 0 ? void 0 : refusalOf(planned.answer);
|
|
932
1065
|
if (refusal !== void 0) return yield* Effect.fail(refusal);
|
|
933
1066
|
const movedRefs = new Set(planned.moved.map((move) => move.ref));
|
|
934
1067
|
const liftedOnMoves = [...checked?.bypassed ?? none].filter(([ref]) => movedRefs.has(ref));
|
|
935
1068
|
const answer = yield* answers.answer(planned.answer, forced, new Map(liftedOnMoves));
|
|
936
|
-
const also = planned.answer.updates.some((update) => update.kind === "rejected") || request.also === void 0 ? void 0 : request.also(yield*
|
|
937
|
-
const
|
|
1069
|
+
const also = planned.answer.updates.some((update) => update.kind === "rejected") || request.also === void 0 ? void 0 : request.also(yield* Clock$1.currentTimeMillis, received);
|
|
1070
|
+
const alsoWrites = (also?.put.length ?? 0) + (also?.delete?.length ?? 0);
|
|
1071
|
+
const quiet = key === void 0 && alsoWrites === 0 && writes === void 0;
|
|
938
1072
|
if (!planned.moves && quiet) return answer;
|
|
939
1073
|
const scope = repoScope(listed.repo);
|
|
940
1074
|
const { name } = record;
|
|
@@ -947,7 +1081,7 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
947
1081
|
const envelope = repoEnvelope(caller, name);
|
|
948
1082
|
const id = newChangeId();
|
|
949
1083
|
const shown = planned.moved.filter((move) => !gitsOwnMove(request.source, move.ref));
|
|
950
|
-
const push = pushOf(id, shown, request
|
|
1084
|
+
const push = pushOf(core.access, id, shown, request);
|
|
951
1085
|
const events = shown.map((move) => {
|
|
952
1086
|
const updated = {
|
|
953
1087
|
type: "ref.updated",
|
|
@@ -995,6 +1129,7 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
995
1129
|
delete: [
|
|
996
1130
|
...change.delete,
|
|
997
1131
|
...appended.delete,
|
|
1132
|
+
...also?.delete ?? [],
|
|
998
1133
|
...writes?.delete ?? []
|
|
999
1134
|
],
|
|
1000
1135
|
jobs: withJobs([
|
|
@@ -1004,9 +1139,18 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
1004
1139
|
...mirrorJobs(core, planned.moved, mirrored),
|
|
1005
1140
|
...writes?.jobs ?? [],
|
|
1006
1141
|
...woken,
|
|
1007
|
-
...shown.length > 0 ? indexJobs(core, indexed) : []
|
|
1142
|
+
...shown.length > 0 ? indexJobs(core, indexed) : [],
|
|
1143
|
+
...planned.moves ? refIndexJobs(core, record) : []
|
|
1008
1144
|
], [...kept.jobs, ...also?.jobs ?? []])
|
|
1009
1145
|
};
|
|
1146
|
+
const objects = (received?.change.put?.length ?? 0) + (received?.change.delete?.length ?? 0);
|
|
1147
|
+
const written = body.put.length + body.delete.length + body.jobs.length;
|
|
1148
|
+
const past = otherWritesProblem({
|
|
1149
|
+
writes: written,
|
|
1150
|
+
objects,
|
|
1151
|
+
moved: planned.moved.length
|
|
1152
|
+
}, core.refIndex);
|
|
1153
|
+
if (past !== void 0) return yield* Effect.fail(past);
|
|
1010
1154
|
if ((yield* storeCall(() => store.commit(scope, body)).pipe(Effect.mapError(commitTooLarge(received, body)))).ok) return final;
|
|
1011
1155
|
}
|
|
1012
1156
|
return yield* fail("UNAVAILABLE", `Other writes kept moving '${repo}' through 10 tries`, { hint: "Push again" });
|
|
@@ -1025,16 +1169,16 @@ const operationOf = ({ repo, edits }) => edits.length === 0 ? {
|
|
|
1025
1169
|
* reads and decides again. A push cut before its commit leaves an unlisted pack for clean-up, and
|
|
1026
1170
|
* no ref moved.
|
|
1027
1171
|
*/
|
|
1028
|
-
const pushWith =
|
|
1172
|
+
const pushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, key) {
|
|
1029
1173
|
const operation = operationOf(request);
|
|
1030
|
-
const resolved = yield* firstRead(
|
|
1031
|
-
const opened = yield* listedFor(
|
|
1032
|
-
return yield* pushOnto(
|
|
1174
|
+
const resolved = yield* firstRead(request.caller, operation, request.internalId).pipe(Effect.tapError((error) => retriedCodes.has(error.code) ? Effect.void : refuseQueued(request, [error], "access")));
|
|
1175
|
+
const opened = yield* listedFor(request, operation, resolved);
|
|
1176
|
+
return yield* pushOnto(request, opened, key, answers);
|
|
1033
1177
|
});
|
|
1034
1178
|
/** A push or an unkeyed `refs.update`, answering the decide's ref answer. */
|
|
1035
|
-
const push = (
|
|
1179
|
+
const push = (request) => pushWith(request, refsAnswers);
|
|
1036
1180
|
/** A `git push`, as `push`, with the lines Git prints for the rules `authorize` lifted. */
|
|
1037
|
-
const gitPush = (
|
|
1181
|
+
const gitPush = (request) => pushWith(request, gitAnswers);
|
|
1038
1182
|
/** A ref a forced fetch moved past its diverged tip, answered `force`; the rest as they are. */
|
|
1039
1183
|
const forcedOf = (forced) => (update) => update.kind === "applied" && forced.has(update.ref) ? {
|
|
1040
1184
|
kind: "force",
|
|
@@ -1049,7 +1193,7 @@ const appliedOf = (update) => update.kind === "force" ? {
|
|
|
1049
1193
|
* A client's fetch into its own refs, as `push`, each diverged ref a forced fetch moved answered
|
|
1050
1194
|
* `force`. Its refs move in one commit, so a fetch stopped before it moves none.
|
|
1051
1195
|
*/
|
|
1052
|
-
const pushFetched = (
|
|
1196
|
+
const pushFetched = (request) => pushWith(request, {
|
|
1053
1197
|
answer: (updated, forced) => Effect.succeed(updated.updates.map(forcedOf(forced))),
|
|
1054
1198
|
kept: (updates) => refsKept({ updates: updates.map(appliedOf) }),
|
|
1055
1199
|
held: (receipt) => Effect.map(refsAnswer(receipt), (held) => held.updates)
|
|
@@ -1058,13 +1202,13 @@ const pushFetched = (core, request) => pushWith(core, request, {
|
|
|
1058
1202
|
* `pushWith` for a write's key, which keeps its answer. `undefined`, with nothing written or
|
|
1059
1203
|
* asked of `authorize`, when the name holds a repo other than the one its key's lookup saw.
|
|
1060
1204
|
*/
|
|
1061
|
-
const keyedPushWith =
|
|
1205
|
+
const keyedPushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, keyed) {
|
|
1062
1206
|
const operation = operationOf(request);
|
|
1063
|
-
const resolved = yield* keyedRead(
|
|
1207
|
+
const resolved = yield* keyedRead(request.caller, operation, keyed.missed, request.internalId);
|
|
1064
1208
|
if (resolved === void 0) return void 0;
|
|
1065
|
-
const opened = yield* listedFor(
|
|
1066
|
-
return yield* pushOnto(
|
|
1209
|
+
const opened = yield* listedFor(request, operation, resolved);
|
|
1210
|
+
return yield* pushOnto(request, opened, keyed.key, answers);
|
|
1067
1211
|
});
|
|
1068
1212
|
/** `keyedPushWith` for `refs.update`, answering the decide's ref answer. */
|
|
1069
|
-
const keyedPush = (
|
|
1070
|
-
export { gitPush, isQueueMoved, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|
|
1213
|
+
const keyedPush = (request, keyed) => keyedPushWith(request, refsAnswers, keyed);
|
|
1214
|
+
export { buildFence, gitPush, isQueueMoved, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|