@ref0/git 0.12.0 → 0.14.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/auth.d.mts +2 -2
- package/dist/auth/auth.mjs +3 -6
- package/dist/auth/authorize.mjs +1 -17
- package/dist/auth/helpers.mjs +3 -11
- package/dist/auth/host-services.mjs +11 -0
- package/dist/auth/policy.d.mts +27 -7
- package/dist/auth/policy.mjs +8 -4
- package/dist/auth/tokens-layer.d.mts +1 -2
- package/dist/auth/tokens-layer.mjs +2 -3
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +1 -8
- package/dist/auth/tokens.mjs +1 -8
- package/dist/auth.d.mts +1 -4
- package/dist/auth.mjs +1 -3
- package/dist/client/git-http.mjs +18 -4
- package/dist/client/push-upload.mjs +33 -7
- package/dist/client/remote.mjs +94 -28
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/contracts/access.d.mts +8 -8
- package/dist/contracts/actors.d.mts +2 -34
- package/dist/contracts/blobs.d.mts +2 -2
- package/dist/contracts/client.d.mts +8 -3
- package/dist/contracts/commits.d.mts +10 -2
- package/dist/contracts/commits.mjs +9 -1
- package/dist/contracts/files.d.mts +2 -2
- package/dist/contracts/forks.d.mts +11 -1
- package/dist/contracts/git.d.mts +18 -7
- package/dist/contracts/git.mjs +3 -2
- package/dist/contracts/lfs.d.mts +0 -7
- package/dist/contracts/objects.d.mts +80 -10
- 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/refs.d.mts +28 -6
- package/dist/contracts/remote.mjs +1 -3
- package/dist/contracts/repo-records.d.mts +1 -0
- package/dist/contracts/repos.d.mts +90 -2
- package/dist/contracts/repos.mjs +29 -2
- package/dist/contracts/result.d.mts +23 -18
- package/dist/contracts/result.mjs +17 -4
- package/dist/contracts/rules.d.mts +22 -22
- package/dist/contracts/server.d.mts +28 -77
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/sync.d.mts +79 -19
- package/dist/contracts/sync.mjs +34 -10
- package/dist/contracts/tokens.d.mts +1 -6
- package/dist/contracts/tokens.mjs +1 -2
- package/dist/contracts/topics.d.mts +0 -5
- package/dist/contracts/work.d.mts +66 -2
- package/dist/contracts/work.mjs +8 -1
- package/dist/core/access.mjs +27 -5
- package/dist/core/ancestry.d.mts +9 -0
- package/dist/core/ancestry.mjs +6 -6
- package/dist/core/asked.mjs +42 -4
- package/dist/core/call-names.mjs +1 -0
- package/dist/core/call-services.mjs +2 -1
- package/dist/core/events/deliver.mjs +10 -2
- package/dist/core/forks.mjs +3 -3
- package/dist/core/imports.mjs +147 -9
- package/dist/core/index-job.mjs +9 -6
- package/dist/core/job-view.mjs +8 -9
- package/dist/core/mirror-rows.mjs +19 -4
- package/dist/core/objects/commits.mjs +16 -6
- package/dist/core/parts.d.mts +6 -1
- package/dist/core/parts.mjs +1 -4
- package/dist/core/purge.mjs +76 -6
- package/dist/core/push-decide.mjs +1 -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 +98 -26
- package/dist/core/receipts.mjs +26 -10
- package/dist/core/ref-view.mjs +59 -5
- package/dist/core/refs.mjs +13 -8
- package/dist/core/repack.mjs +11 -8
- package/dist/core/repo-info.mjs +16 -9
- package/dist/core/repos.mjs +30 -14
- package/dist/core/seam.mjs +2 -2
- package/dist/core/view.d.mts +6 -0
- package/dist/core/view.mjs +45 -12
- package/dist/core/work.mjs +47 -22
- package/dist/effect.d.mts +3 -1
- package/dist/effect.mjs +3 -1
- package/dist/engine/reads.mjs +13 -6
- 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 +1 -1
- package/dist/event-streams/stream.mjs +1 -1
- package/dist/extend.d.mts +3 -3
- package/dist/extend.mjs +2 -2
- package/dist/http/answers.mjs +4 -2
- package/dist/http/core-parts.mjs +64 -15
- package/dist/http/handler.mjs +2 -2
- package/dist/http/node.mjs +5 -4
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +503 -0
- package/dist/http/push-uploads.d.mts +1 -0
- package/dist/http/push-uploads.mjs +114 -56
- package/dist/http/upload-pack.mjs +7 -6
- package/dist/index.d.mts +23 -24
- package/dist/index.mjs +4 -7
- package/dist/lfs/base.d.mts +7 -3
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/copy.d.mts +46 -0
- package/dist/lfs/copy.mjs +26 -0
- package/dist/lfs/layer.mjs +4 -2
- package/dist/lfs/objects.d.mts +6 -0
- package/dist/lfs/objects.mjs +68 -41
- package/dist/lfs/rows.d.mts +13 -0
- package/dist/lfs/service.d.mts +1 -7
- package/dist/lfs/service.mjs +1 -9
- package/dist/lfs/upload-most.mjs +5 -5
- package/dist/node.d.mts +2 -2
- 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/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 +1 -1
- package/dist/queue/host.d.mts +1 -7
- package/dist/queue/host.mjs +1 -7
- package/dist/queue/layer.mjs +1 -1
- package/dist/queue/trim.mjs +1 -1
- package/dist/rest/blobs.d.mts +31 -23
- package/dist/rest/blobs.mjs +1 -1
- package/dist/rest/caller.d.mts +49 -9
- package/dist/rest/caller.mjs +1 -1
- package/dist/rest/client.d.mts +10 -3
- package/dist/rest/client.mjs +4 -0
- package/dist/rest/commits.d.mts +273 -240
- package/dist/rest/errors.d.mts +24 -4
- package/dist/rest/events.d.mts +9 -6
- package/dist/rest/events.mjs +1 -2
- package/dist/rest/files.d.mts +127 -115
- package/dist/rest/forks.d.mts +121 -97
- package/dist/rest/handler.mjs +4 -57
- package/dist/rest/handlers.d.mts +1 -1
- package/dist/rest/handlers.mjs +18 -4
- package/dist/rest/layer.mjs +2 -1
- package/dist/rest/me.d.mts +8 -4
- package/dist/rest/merges.d.mts +8 -4
- package/dist/rest/paths.mjs +1 -0
- package/dist/rest/queue.d.mts +282 -226
- package/dist/rest/refs.d.mts +205 -176
- package/dist/rest/repos.d.mts +108 -80
- package/dist/rest/tags.d.mts +24 -12
- package/dist/rest/tokens.d.mts +235 -211
- package/dist/rest/topics.d.mts +53 -33
- package/dist/rest/trees.d.mts +105 -89
- package/dist/rest/work.d.mts +467 -20
- package/dist/rest/work.mjs +8 -0
- package/dist/server/edge-node.d.mts +9 -13
- package/dist/server/edge-node.mjs +9 -12
- package/dist/server/git-layer.d.mts +1 -6
- package/dist/server/git-layer.mjs +2 -2
- package/dist/server/git-namespace.d.mts +3 -3
- package/dist/server/joined.d.mts +15 -22
- package/dist/server/joined.mjs +5 -29
- package/dist/server/lifecycle.mjs +107 -23
- package/dist/server/registry.mjs +9 -1
- package/dist/server/server.mjs +133 -212
- package/dist/storage/budget.mjs +2 -2
- package/dist/storage/clean-up.mjs +13 -10
- package/dist/storage/fetch.mjs +13 -8
- package/dist/storage/file-limits.mjs +24 -0
- package/dist/storage/index-build.d.mts +1 -0
- package/dist/storage/index-build.mjs +106 -62
- package/dist/storage/index-fetch.mjs +16 -3
- package/dist/storage/index-reach.mjs +33 -5
- package/dist/storage/index-remap.mjs +8 -1
- package/dist/storage/index-shallow.mjs +5 -3
- package/dist/storage/largest-files.mjs +48 -0
- package/dist/storage/lfs-pointers.mjs +10 -1
- package/dist/storage/loose.mjs +3 -1
- package/dist/storage/memory-budget.mjs +28 -4
- package/dist/storage/pack-reads.mjs +8 -8
- package/dist/storage/pack-receive.mjs +83 -25
- package/dist/storage/packs.mjs +37 -21
- package/dist/storage/prune-keep.mjs +203 -34
- package/dist/storage/prune-walk.mjs +54 -16
- package/dist/storage/prune.mjs +629 -196
- package/dist/storage/push-uploads.mjs +36 -12
- package/dist/storage/quarantine.mjs +9 -9
- package/dist/storage/ready.mjs +47 -19
- package/dist/storage/receive-bounds.mjs +29 -8
- package/dist/storage/receive-state.mjs +8 -0
- package/dist/storage/receive-steps.mjs +71 -18
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/repack.mjs +1 -8
- package/dist/storage/rows.mjs +12 -1
- package/dist/storage/shallow.d.mts +1 -0
- package/dist/storage/shallow.mjs +26 -4
- package/dist/storage/stream-whole.mjs +5 -2
- package/dist/storage/visible.mjs +29 -1
- package/dist/storage/walk.mjs +2 -1
- package/dist/store/catalogue.mjs +1 -0
- 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 -2
- package/dist/store/cursor-seal.mjs +26 -14
- package/dist/store/errors.mjs +9 -1
- package/dist/store/records.d.mts +2 -0
- package/dist/store/records.mjs +9 -6
- package/dist/store/repo-record.d.mts +9 -7
- package/dist/store/repo-record.mjs +102 -19
- package/dist/store/scopes.mjs +10 -2
- 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 +55 -43
- package/dist/sync/http.mjs +36 -1
- package/dist/sync/import.mjs +1 -0
- package/dist/sync/layer.mjs +6 -2
- package/dist/sync/lfs-batch.mjs +119 -0
- package/dist/sync/lfs-copy.mjs +251 -0
- package/dist/sync/mirror.mjs +210 -137
- package/dist/sync/smart-http.mjs +4 -2
- package/dist/sync/step.mjs +25 -5
- package/dist/sync/tries.mjs +45 -14
- package/dist/sync.d.mts +2 -2
- package/dist/topics/host.mjs +1 -19
- package/dist/topics/layer.mjs +1 -1
- package/package.json +3 -8
- package/dist/auth/bridge.mjs +0 -30
- package/dist/auth/helpers.d.mts +0 -17
- package/dist/core/purge.d.mts +0 -8
- 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/rest/handler.d.mts +0 -21
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -1
- 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/topics/host.d.mts +0 -7
package/dist/sync/mirror.mjs
CHANGED
|
@@ -13,16 +13,17 @@ import { hiddenUnder } from "../protocol/wire/lines.mjs";
|
|
|
13
13
|
import { receiveRefs, sendPush } from "../client/remote.mjs";
|
|
14
14
|
import { objectsFace, oneShotReads } from "../storage/calls.mjs";
|
|
15
15
|
import { decodeRow, storeCall } from "../store/errors.mjs";
|
|
16
|
-
import { MirrorRow } from "../core/mirror-rows.mjs";
|
|
16
|
+
import { MirrorRow, destinationText, mirrorJobKey } from "../core/mirror-rows.mjs";
|
|
17
|
+
import { notFailed } from "../core/events/deliver.mjs";
|
|
17
18
|
import { collections, newChangeId, repoScope } from "../store/scopes.mjs";
|
|
18
19
|
import { asSync, mirrorLimits } from "./bound.mjs";
|
|
19
20
|
import { readImport } from "../core/imports.mjs";
|
|
20
|
-
import { fromRemote, httpOf, keptFieldsOf, openedFor, remoteOf, syncObjects, tried, unknownProvider } from "./tries.mjs";
|
|
21
|
-
import { CoreParts, ObjectsParts, overStore } from "../core/parts.mjs";
|
|
21
|
+
import { fromRemote, httpOf, keptFieldsOf, openedFor, remoteOf, syncObjects, thrownOf, tried, unknownProvider } from "./tries.mjs";
|
|
22
|
+
import { CoreParts, ObjectsParts, QueueParts, overStore } from "../core/parts.mjs";
|
|
22
23
|
import * as Clock$1 from "effect/Clock";
|
|
23
24
|
import * as Effect from "effect/Effect";
|
|
24
25
|
import * as Result from "effect/Result";
|
|
25
|
-
import { CurrentJob, jsonBytes } from "@ref0/infra";
|
|
26
|
+
import { CurrentJob, isInfraError, jsonBytes } from "@ref0/infra";
|
|
26
27
|
// src/sync/mirror.ts
|
|
27
28
|
/** How long a mirror waits before it reads its repo's import again, while the import runs. */
|
|
28
29
|
const importWait = 1e4;
|
|
@@ -51,7 +52,12 @@ const longestReceipt = {
|
|
|
51
52
|
oid: "0".repeat(64),
|
|
52
53
|
at: Number.MAX_SAFE_INTEGER
|
|
53
54
|
};
|
|
54
|
-
const sameSource = (a, b) => a
|
|
55
|
+
const sameSource = (a, b) => destinationText(a) === destinationText(b);
|
|
56
|
+
/**
|
|
57
|
+
* A mirror's saver as one text, one a caller as `callerKey` has it: a decoded row holds only
|
|
58
|
+
* `SavedCaller`'s fields, in its order.
|
|
59
|
+
*/
|
|
60
|
+
const saverOf = (row) => JSON.stringify(row.by);
|
|
55
61
|
const stateOf = (repo, ref, row) => {
|
|
56
62
|
const state = {
|
|
57
63
|
repo,
|
|
@@ -59,16 +65,18 @@ const stateOf = (repo, ref, row) => {
|
|
|
59
65
|
state: row.state
|
|
60
66
|
};
|
|
61
67
|
if (row.paused !== void 0) state.paused = row.paused;
|
|
68
|
+
if (row.deletes === true) state.deletes = true;
|
|
62
69
|
if (row.lastPushed !== void 0) state.lastPushed = row.lastPushed;
|
|
63
70
|
return state;
|
|
64
71
|
};
|
|
65
72
|
/**
|
|
66
|
-
* `mirror`: the mirror's row, active, and its job due now, in one commit,
|
|
67
|
-
* update the repo, sees the ref, and the
|
|
73
|
+
* `mirror`: the mirror's row, active, and its destination's job due now, in one commit, then that
|
|
74
|
+
* job retried if it had failed, once the caller may update the repo, sees the ref, and the
|
|
75
|
+
* destination names a provider `Sync.layer` was given. Sent
|
|
68
76
|
* again, it writes the same row, so a paused mirror resumes and an active one pushes again. A row
|
|
69
77
|
* past `mirrorLimits.rowBytes` is refused, and so is a new mirror on a repo that holds
|
|
70
78
|
* `mirrorLimits.mirrors`; a mirror the repo holds is saved again whatever the count, keeping its
|
|
71
|
-
* `lastPushed` while its destination is the same.
|
|
79
|
+
* `lastPushed` while its destination is the same, and `deletes` only when it's sent again.
|
|
72
80
|
*/
|
|
73
81
|
const mirrorWith = /* @__PURE__ */ Effect.fnUntraced(function* (bound, input) {
|
|
74
82
|
const { destination } = input;
|
|
@@ -99,6 +107,7 @@ const mirrorWith = /* @__PURE__ */ Effect.fnUntraced(function* (bound, input) {
|
|
|
99
107
|
state: "active",
|
|
100
108
|
by: yield* savedCallerOf(actor.id, caller)
|
|
101
109
|
};
|
|
110
|
+
if (input.deletes === true) saved.deletes = true;
|
|
102
111
|
const largest = {
|
|
103
112
|
...saved,
|
|
104
113
|
state: "paused",
|
|
@@ -107,9 +116,10 @@ const mirrorWith = /* @__PURE__ */ Effect.fnUntraced(function* (bound, input) {
|
|
|
107
116
|
};
|
|
108
117
|
const bytes = jsonBytes(mirrorRow(ref, largest));
|
|
109
118
|
if (bytes > mirrorLimits.rowBytes) return yield* fail("INVALID_ARGUMENT", `The mirror of '${ref}' takes ${bytes} bytes: a mirror takes at most ${mirrorLimits.rowBytes}`, { hint: "Name a shorter destination or ref" });
|
|
119
|
+
const key = mirrorJobKey(saved.destination);
|
|
110
120
|
const job = bound.mirrorJob.encodedJob({
|
|
111
|
-
key
|
|
112
|
-
data: {
|
|
121
|
+
key,
|
|
122
|
+
data: { destination: saved.destination }
|
|
113
123
|
});
|
|
114
124
|
const { store } = yield* CoreParts;
|
|
115
125
|
const scope = repoScope(internalId);
|
|
@@ -124,96 +134,98 @@ const mirrorWith = /* @__PURE__ */ Effect.fnUntraced(function* (bound, input) {
|
|
|
124
134
|
});
|
|
125
135
|
const row = { ...saved };
|
|
126
136
|
if (held?.lastPushed !== void 0 && sameSource(held.destination, saved.destination)) row.lastPushed = held.lastPushed;
|
|
127
|
-
if ((yield* storeCall(() => store.commit(scope, {
|
|
137
|
+
if (!(yield* storeCall(() => store.commit(scope, {
|
|
128
138
|
id: newChangeId(),
|
|
129
139
|
expect: read.version,
|
|
130
140
|
put: [mirrorRow(ref, row)],
|
|
131
141
|
jobs: [job]
|
|
132
|
-
}))).ok)
|
|
142
|
+
}))).ok) continue;
|
|
143
|
+
const { jobs } = yield* QueueParts;
|
|
144
|
+
if ((yield* storeCall(() => jobs.retry(scope, job)).pipe(Effect.catchIf(notFailed, () => Effect.void), Effect.catchIf((error) => isInfraError(error.cause) && error.cause.reason === "compacted", () => Effect.succeed(false)))) === false) {
|
|
145
|
+
yield* storeCall(() => jobs.discard(scope, job)).pipe(Effect.catchIf(notFailed, () => Effect.void));
|
|
146
|
+
yield* storeCall(() => store.add(scope, { jobs: [job] }));
|
|
147
|
+
}
|
|
148
|
+
return stateOf(input.repo, ref, row);
|
|
133
149
|
}
|
|
134
150
|
return yield* contended();
|
|
135
151
|
});
|
|
136
|
-
/** The mirror's row and the read's version. */
|
|
137
|
-
const mirrorOf = /* @__PURE__ */ Effect.fnUntraced(function* (attempt) {
|
|
138
|
-
const { internalId, ref } = attempt;
|
|
139
|
-
const { store } = yield* CoreParts;
|
|
140
|
-
const snapshot = yield* storeCall(() => store.read(repoScope(internalId), [mirrorKey(ref)]));
|
|
141
|
-
const [[own] = []] = snapshot.results;
|
|
142
|
-
return {
|
|
143
|
-
mirror: own === void 0 ? void 0 : yield* decodeRow(MirrorRow, own, `Mirror '${ref}'`),
|
|
144
|
-
version: snapshot.version
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
/** The mirror's row, whether the repo's import still runs, and the row read's version. */
|
|
148
|
-
const readMirror = /* @__PURE__ */ Effect.fnUntraced(function* (attempt) {
|
|
149
|
-
const { mirror, version } = yield* mirrorOf(attempt);
|
|
150
|
-
const imported = yield* readImport((yield* CoreParts).store, attempt.internalId);
|
|
151
|
-
return {
|
|
152
|
-
mirror,
|
|
153
|
-
importing: imported.row?.state === "running" && !imported.cancelled,
|
|
154
|
-
version
|
|
155
|
-
};
|
|
156
|
-
});
|
|
157
|
-
const again = { kind: "more" };
|
|
158
152
|
/**
|
|
159
|
-
* The
|
|
160
|
-
*
|
|
153
|
+
* The mirrors whose rows name `destination`, among every mirror row in `store`, which
|
|
154
|
+
* `mirrorLimits.mirrors` keeps within one read, and the read's version.
|
|
161
155
|
*/
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
156
|
+
const destinationRows = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId, destination) {
|
|
157
|
+
const snapshot = yield* storeCall(() => store.read(repoScope(internalId), [mirrorsRead]));
|
|
158
|
+
const [rows = []] = snapshot.results;
|
|
159
|
+
const mirrored = [];
|
|
160
|
+
for (const row of rows) {
|
|
161
|
+
const decoded = yield* decodeRow(MirrorRow, row, `Mirror '${row.id}'`);
|
|
162
|
+
if (sameSource(decoded.destination, destination)) mirrored.push({
|
|
163
|
+
ref: row.id,
|
|
164
|
+
row: decoded
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
mirrored,
|
|
169
|
+
version: snapshot.version
|
|
168
170
|
};
|
|
169
|
-
return (yield* storeCall(() => store.commit(repoScope(attempt.internalId), {
|
|
170
|
-
id: newChangeId(),
|
|
171
|
-
expect: version,
|
|
172
|
-
put: [mirrorRow(attempt.ref, row)]
|
|
173
|
-
}))).ok ? void 0 : again;
|
|
174
171
|
});
|
|
175
172
|
/**
|
|
176
|
-
* The
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
173
|
+
* The try's pauses and receipts, in one commit. The pauses commit only at `version`, the read the
|
|
174
|
+
* try began with: a push that moved a ref since, or a resume, moved the rows, so a stale try
|
|
175
|
+
* records no pause and its next read decides. A receipt, `oid` at the try's time, goes on the
|
|
176
|
+
* mirror's row as it is, read again after a commit another write beat: a pause, a resume or a save
|
|
177
|
+
* since keeps it while the row names the same destination, and a row removed or sent elsewhere
|
|
178
|
+
* takes none, nor does one that `writeTries` other writes beat: the push stands either way.
|
|
180
179
|
*/
|
|
181
|
-
const
|
|
182
|
-
const { store } =
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
};
|
|
187
|
-
let row = mirror;
|
|
188
|
-
let expect = version;
|
|
180
|
+
const settle = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, read, settled) {
|
|
181
|
+
const { store } = attempt.context;
|
|
182
|
+
const at = yield* Clock$1.currentTimeMillis;
|
|
183
|
+
let { mirrored, version } = read;
|
|
184
|
+
let { pauses } = settled;
|
|
189
185
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
186
|
+
const put = [];
|
|
187
|
+
for (const { ref, row } of mirrored) {
|
|
188
|
+
const why = pauses.get(ref);
|
|
189
|
+
const oid = settled.receipts.get(ref);
|
|
190
|
+
if (why === void 0 && oid === void 0) continue;
|
|
191
|
+
const next = why === void 0 ? { ...row } : {
|
|
192
|
+
...row,
|
|
193
|
+
state: "paused",
|
|
194
|
+
paused: why
|
|
195
|
+
};
|
|
196
|
+
if (oid !== void 0) next.lastPushed = {
|
|
197
|
+
oid,
|
|
198
|
+
at
|
|
199
|
+
};
|
|
200
|
+
put.push(mirrorRow(ref, next));
|
|
201
|
+
}
|
|
202
|
+
if (put.length === 0) break;
|
|
195
203
|
if ((yield* storeCall(() => store.commit(repoScope(attempt.internalId), {
|
|
196
204
|
id: newChangeId(),
|
|
197
|
-
expect,
|
|
198
|
-
put
|
|
199
|
-
}))).ok)
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
expect: version,
|
|
206
|
+
put
|
|
207
|
+
}))).ok) break;
|
|
208
|
+
settled.more ||= pauses.size > 0;
|
|
209
|
+
pauses = /* @__PURE__ */ new Map();
|
|
210
|
+
({mirrored, version} = yield* destinationRows(store, attempt.internalId, attempt.destination));
|
|
203
211
|
}
|
|
212
|
+
return settled.more ? { kind: "more" } : void 0;
|
|
204
213
|
});
|
|
205
|
-
/**
|
|
206
|
-
const
|
|
214
|
+
/** The edits whose upstream tip their ref goes on from: the walks the push decide's kinds take. */
|
|
215
|
+
const goingOn = /* @__PURE__ */ Effect.fnUntraced(function* (listed, edits) {
|
|
216
|
+
const going = /* @__PURE__ */ new Set();
|
|
217
|
+
if (edits.length === 0) return going;
|
|
207
218
|
const kinds = yield* kindsOf({
|
|
208
219
|
objects: oneShotReads(objectsFace(syncObjects(yield* ObjectsParts))),
|
|
209
220
|
listed,
|
|
210
221
|
pushed: () => Effect.succeed(void 0),
|
|
211
|
-
edits
|
|
222
|
+
edits
|
|
212
223
|
});
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
224
|
+
for (const update of kinds.updates) {
|
|
225
|
+
if (kinds.refused.has(update.ref)) continue;
|
|
226
|
+
if (update.kind !== "force" || (yield* kinds.exact(update)) === "fast-forward") going.add(update.ref);
|
|
227
|
+
}
|
|
228
|
+
return going;
|
|
217
229
|
});
|
|
218
230
|
const upstreamOf = /* @__PURE__ */ Effect.fnUntraced(function* (http, heard) {
|
|
219
231
|
const read = yield* Effect.result(receiveRefs(http));
|
|
@@ -226,93 +238,128 @@ const upstreamOf = /* @__PURE__ */ Effect.fnUntraced(function* (http, heard) {
|
|
|
226
238
|
return { kind: "refused" };
|
|
227
239
|
});
|
|
228
240
|
/**
|
|
229
|
-
*
|
|
230
|
-
* `viewAgainOf` asks it, in the try's own context
|
|
231
|
-
* failed fails the try.
|
|
241
|
+
* The mirrors whose savers still see their refs, each saver asked again once, now, for a fetch,
|
|
242
|
+
* as `viewAgainOf` asks it, in the try's own context; the rest pause `unseen`. `undefined` for a
|
|
243
|
+
* repo deleted since. A host that failed fails the try.
|
|
232
244
|
*/
|
|
233
|
-
const
|
|
234
|
-
const { internalId,
|
|
245
|
+
const seenOf = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, active, settled) {
|
|
246
|
+
const { internalId, context } = attempt;
|
|
235
247
|
const record = yield* hostRecordOf((yield* CoreParts).store, internalId);
|
|
236
|
-
if (record === void 0) return
|
|
248
|
+
if (record === void 0) return void 0;
|
|
237
249
|
const repo = repoAccess({
|
|
238
250
|
name: record.name,
|
|
239
251
|
record,
|
|
240
252
|
internalId
|
|
241
253
|
});
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
254
|
+
const views = /* @__PURE__ */ new Map();
|
|
255
|
+
const seen = [];
|
|
256
|
+
for (const mirror of active) {
|
|
257
|
+
const saver = saverOf(mirror.row);
|
|
258
|
+
const viewed = views.get(saver) ?? (yield* viewAgainOf(mirror.row.by, repo, "fetch", context.signal));
|
|
259
|
+
views.set(saver, viewed);
|
|
260
|
+
if (viewed.kind !== "refused" && viewed.view.sees(mirror.ref)) seen.push(mirror);
|
|
261
|
+
else settled.pauses.set(mirror.ref, "unseen");
|
|
262
|
+
}
|
|
263
|
+
return seen;
|
|
245
264
|
});
|
|
246
265
|
/**
|
|
247
|
-
* One mirror try
|
|
248
|
-
*
|
|
249
|
-
* advertised.
|
|
250
|
-
* - a
|
|
251
|
-
* - a saver
|
|
252
|
-
* -
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* -
|
|
256
|
-
*
|
|
266
|
+
* One mirror try, for every mirror of the job's destination: their rows, each saver asked again,
|
|
267
|
+
* then each ref's tip, the upstream's advertisement read once, and one push of every ref that
|
|
268
|
+
* differs, each from the upstream's tip, so the upstream only ever moves from the ID it advertised.
|
|
269
|
+
* - a destination with no active mirror ends; one whose repo's import runs waits for it;
|
|
270
|
+
* - a mirror whose saver no longer sees its ref pauses `unseen`, before the tip is read;
|
|
271
|
+
* - a ref with no tip is left out, and the upstream keeps its copy (Q393), unless its mirror
|
|
272
|
+
* `deletes`: then the upstream's ref goes in the same push, from the ID the mirror's receipt
|
|
273
|
+
* says it left there, and one pushed there since pauses it `diverged`, alone;
|
|
274
|
+
* - an upstream already at a ref's tip leaves it out, keeping its receipt when the row has none;
|
|
275
|
+
* - an upstream tip a ref doesn't go on from pauses that ref's mirror `diverged`, alone;
|
|
276
|
+
* - a credential, or a POST, the upstream refuses pauses every mirror the push held `refused`;
|
|
277
|
+
* - each update the upstream takes keeps its receipt, `lastPushed`, on its mirror's row, `null`
|
|
278
|
+
* for a delete;
|
|
279
|
+
* - a refused update whose upstream ref has moved since is stale, and the job reads again; one
|
|
280
|
+
* whose upstream ref hasn't pauses its mirror `refused`.
|
|
281
|
+
* Each try sends only what still differs, so one that dies mid-push and runs again pushes no ref
|
|
282
|
+
* twice.
|
|
257
283
|
*/
|
|
258
284
|
const mirrorStep = /* @__PURE__ */ Effect.fnUntraced(function* (attempt) {
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
if (
|
|
285
|
+
const { store } = attempt.context;
|
|
286
|
+
const read = yield* destinationRows(store, attempt.internalId, attempt.destination);
|
|
287
|
+
const active = read.mirrored.filter(({ row }) => row.state === "active");
|
|
288
|
+
if (active.length === 0) return void 0;
|
|
289
|
+
const imported = yield* readImport(store, attempt.internalId);
|
|
290
|
+
if (imported.row?.state === "running" && !imported.cancelled) return {
|
|
263
291
|
kind: "more",
|
|
264
292
|
at: (yield* Clock$1.currentTimeMillis) + importWait
|
|
265
293
|
};
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
294
|
+
const settled = {
|
|
295
|
+
pauses: /* @__PURE__ */ new Map(),
|
|
296
|
+
receipts: /* @__PURE__ */ new Map(),
|
|
297
|
+
more: false
|
|
298
|
+
};
|
|
299
|
+
const seen = yield* seenOf(attempt, active, settled);
|
|
300
|
+
if (seen === void 0) return void 0;
|
|
301
|
+
if (seen.length > 0) yield* asSync(pushStep(attempt, seen, settled));
|
|
302
|
+
return yield* settle(attempt, read, settled);
|
|
270
303
|
});
|
|
271
|
-
/** The try past its
|
|
272
|
-
const pushStep = /* @__PURE__ */ Effect.fnUntraced(function* (attempt,
|
|
273
|
-
const { bound,
|
|
304
|
+
/** The try past its savers' checks: the tips, the upstream's, and the one push between them. */
|
|
305
|
+
const pushStep = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, seen, settled) {
|
|
306
|
+
const { bound, context } = attempt;
|
|
274
307
|
const stored = yield* ObjectsParts;
|
|
275
308
|
const opened = yield* openedFor(bound.caller, attempt.internalId);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
309
|
+
if (opened === void 0) return;
|
|
310
|
+
const tipped = [];
|
|
311
|
+
for (const mirror of seen) {
|
|
312
|
+
const tip = opened.refs.get(mirror.ref) ?? null;
|
|
313
|
+
if (tip !== null || mirror.row.deletes === true) tipped.push({
|
|
314
|
+
...mirror,
|
|
315
|
+
tip
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
if (tipped.length === 0) return;
|
|
319
|
+
const remote = yield* remoteOf(bound, attempt.destination, context.signal, "write");
|
|
320
|
+
const { http, heard } = yield* httpOf(remote, keptFieldsOf(bound, attempt.destination));
|
|
280
321
|
const upstream = yield* upstreamOf(http, heard);
|
|
281
|
-
if (upstream.kind === "refused")
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (mirror.lastPushed?.oid === tip) return void 0;
|
|
285
|
-
return yield* pushedTo(attempt, version, mirror, tip);
|
|
322
|
+
if (upstream.kind === "refused") {
|
|
323
|
+
for (const { ref } of tipped) settled.pauses.set(ref, "refused");
|
|
324
|
+
return;
|
|
286
325
|
}
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
from
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
326
|
+
const differ = [];
|
|
327
|
+
for (const { ref, row, tip } of tipped) {
|
|
328
|
+
const from = upstream.refs.refs.get(ref) ?? null;
|
|
329
|
+
if (from === tip) {
|
|
330
|
+
if (row.lastPushed?.oid !== tip) settled.receipts.set(ref, tip);
|
|
331
|
+
} else if (tip === null && row.lastPushed?.oid !== from) settled.pauses.set(ref, "diverged");
|
|
332
|
+
else differ.push({
|
|
333
|
+
ref,
|
|
334
|
+
from,
|
|
335
|
+
to: tip
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
const going = yield* goingOn(opened.listed, differ.filter(({ from, to }) => from !== null && to !== null));
|
|
339
|
+
const edits = [];
|
|
340
|
+
for (const edit of differ) if (edit.to === null || edit.from === null || going.has(edit.ref)) edits.push(edit);
|
|
341
|
+
else settled.pauses.set(edit.ref, "diverged");
|
|
342
|
+
if (edits.length === 0) return;
|
|
293
343
|
const source = {
|
|
294
344
|
objects: objectsFace(syncObjects(stored)),
|
|
295
345
|
listed: opened.listed,
|
|
296
346
|
limits: stored.fetchLimits
|
|
297
347
|
};
|
|
298
|
-
const pushed = yield* Effect.result(sendPush(http, source, upstream.refs,
|
|
348
|
+
const pushed = yield* Effect.result(sendPush(http, source, upstream.refs, edits, {}));
|
|
299
349
|
if (Result.isFailure(pushed)) {
|
|
300
350
|
const { failure } = pushed;
|
|
301
351
|
if (!refusedCodes.has(failure.code)) return yield* Effect.fail(fromRemote("take a push", heard)(failure));
|
|
302
|
-
|
|
352
|
+
for (const { ref } of edits) settled.pauses.set(ref, "refused");
|
|
353
|
+
return;
|
|
303
354
|
}
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}, upstream.refs, ref);
|
|
310
|
-
});
|
|
311
|
-
/** A refused push: stale when the upstream's tip has moved since it was read, so read again. */
|
|
312
|
-
const refusedPush = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, version, mirror, { http, heard }, first, ref) {
|
|
355
|
+
const applied = new Set(pushed.success.updates.flatMap((update) => update.kind === "applied" ? [update.ref] : []));
|
|
356
|
+
const rejected = [];
|
|
357
|
+
for (const edit of edits) if (!applied.has(edit.ref)) rejected.push(edit);
|
|
358
|
+
else settled.receipts.set(edit.ref, edit.to);
|
|
359
|
+
if (rejected.length === 0) return;
|
|
313
360
|
const reread = yield* upstreamOf(http, heard);
|
|
314
|
-
if (reread.kind === "read" && reread.refs.refs.get(ref) !==
|
|
315
|
-
|
|
361
|
+
for (const { ref } of rejected) if (reread.kind === "read" && reread.refs.refs.get(ref) !== upstream.refs.refs.get(ref)) settled.more = true;
|
|
362
|
+
else settled.pauses.set(ref, "refused");
|
|
316
363
|
});
|
|
317
364
|
/** `sync.mirror`'s handler over `bound`: one try, its failure thrown as `SyncTryError`. */
|
|
318
365
|
const mirrorTry = /* @__PURE__ */ Effect.fnUntraced(function* (bound, data) {
|
|
@@ -320,12 +367,38 @@ const mirrorTry = /* @__PURE__ */ Effect.fnUntraced(function* (bound, data) {
|
|
|
320
367
|
const attempt = {
|
|
321
368
|
bound,
|
|
322
369
|
internalId: yield* currentRepo,
|
|
323
|
-
|
|
370
|
+
destination: data.destination,
|
|
324
371
|
context
|
|
325
372
|
};
|
|
326
373
|
return yield* tried(Effect.provideContext(overStore(context.store)(mirrorStep(attempt)), bound.needs));
|
|
327
374
|
});
|
|
328
375
|
/**
|
|
376
|
+
* Once a destination's job has failed for good, every active mirror its rows name paused
|
|
377
|
+
* `refused`, so `mirrors` says why it stopped and saving one again resumes it: read again after a
|
|
378
|
+
* commit another write beat, until the queue's bound on `onFailure` aborts the signal.
|
|
379
|
+
*/
|
|
380
|
+
const mirrorFailed = /* @__PURE__ */ Effect.fnUntraced(function* (bound, data) {
|
|
381
|
+
const context = yield* CurrentJob.CurrentJob;
|
|
382
|
+
const internalId = yield* currentRepo;
|
|
383
|
+
const marked = Effect.gen(function* () {
|
|
384
|
+
for (;;) {
|
|
385
|
+
const read = yield* destinationRows(context.store, internalId, data.destination);
|
|
386
|
+
const put = read.mirrored.flatMap(({ ref, row }) => row.state === "active" ? [mirrorRow(ref, {
|
|
387
|
+
...row,
|
|
388
|
+
state: "paused",
|
|
389
|
+
paused: "refused"
|
|
390
|
+
})] : []);
|
|
391
|
+
if (put.length === 0) return;
|
|
392
|
+
if ((yield* storeCall(() => context.store.commit(repoScope(internalId), {
|
|
393
|
+
id: newChangeId(),
|
|
394
|
+
expect: read.version,
|
|
395
|
+
put
|
|
396
|
+
}))).ok) return;
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
yield* Effect.provideContext(marked, bound.needs).pipe(Effect.mapError(thrownOf));
|
|
400
|
+
});
|
|
401
|
+
/**
|
|
329
402
|
* `mirrors`: each of the repo's mirror rows, by ref, once the caller may read the repo: only those
|
|
330
403
|
* whose ref the caller sees, so a private ref's mirror answers as no mirror.
|
|
331
404
|
*/
|
|
@@ -387,4 +460,4 @@ const removeMirrorWith = /* @__PURE__ */ Effect.fnUntraced(function* (_bound, in
|
|
|
387
460
|
}
|
|
388
461
|
return yield* contended();
|
|
389
462
|
});
|
|
390
|
-
export { mirrorTry, mirrorWith, mirrorsWith, removeMirrorWith };
|
|
463
|
+
export { mirrorFailed, mirrorTry, mirrorWith, mirrorsWith, removeMirrorWith };
|
package/dist/sync/smart-http.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { fail } from "../contracts/result.mjs";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
1
3
|
// src/sync/smart-http.ts
|
|
2
4
|
const smartHttpName = "smart-http";
|
|
3
5
|
/**
|
|
@@ -12,8 +14,8 @@ const smartHttp = (options) => {
|
|
|
12
14
|
name: smartHttpName,
|
|
13
15
|
remote: (repo) => {
|
|
14
16
|
const url = new URL(repo, base).href;
|
|
15
|
-
if (!url.startsWith(base) || repo.split("/").includes("..")) return
|
|
16
|
-
return
|
|
17
|
+
if (!url.startsWith(base) || repo.split("/").includes("..")) return fail("INVALID_ARGUMENT", `'${repo}' isn't a path under the provider's URL`);
|
|
18
|
+
return Effect.succeed({
|
|
17
19
|
...options,
|
|
18
20
|
url
|
|
19
21
|
});
|
package/dist/sync/step.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import { listJobRow } from "../store/list-job.mjs";
|
|
|
21
21
|
import { StoredRepo } from "../store/records.mjs";
|
|
22
22
|
import { newChangeId, repoScope, selfKey } from "../store/scopes.mjs";
|
|
23
23
|
import { asSync } from "./bound.mjs";
|
|
24
|
+
import { copyLfs, withLfsPages } from "./lfs-copy.mjs";
|
|
24
25
|
import { ImportRow, cancelKey, cutKey, cutRow, failedHint, failedRow, importEndDeletes, importKey, importRow, readImport, readTipPages, stoppedTry, tipPageKey, tipPageRow, tipPagesOf, tipRowBytes } from "../core/imports.mjs";
|
|
25
26
|
import { ForGood, SyncTryError, forGood, fromRemote, httpOf, keptFieldsOf, openedFor, remoteOf, syncObjects, thrownOf, tried } from "./tries.mjs";
|
|
26
27
|
import { currentRepo } from "../store/job-try.mjs";
|
|
@@ -44,7 +45,9 @@ import { CurrentJob } from "@ref0/infra";
|
|
|
44
45
|
* runs past the limit, or that the storage refuses for a reason in `halvedReasons`, is fetched
|
|
45
46
|
* again at half the depth, and one holding an object the storage refuses as `object-too-large`
|
|
46
47
|
* fails the job on that try, with that refusal;
|
|
47
|
-
* 3.
|
|
48
|
+
* 3. on a server with `Lfs.layer`, copy the LFS objects the history points at, as `copyLfs`
|
|
49
|
+
* says, from the pointers each segment's landing kept;
|
|
50
|
+
* 4. publish: move each page's refs to their tips, a page a try, each in one atomic commit,
|
|
48
51
|
* `source: 'import'`, that moves the record's cursor past it, and mark the import done with
|
|
49
52
|
* the last.
|
|
50
53
|
* A step reads the import's record first, and ends the job for a cancelled import or one that
|
|
@@ -432,6 +435,7 @@ const fetchSegment = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, row,
|
|
|
432
435
|
const { needs, kept } = carriedCut(row.roots, roots, cut);
|
|
433
436
|
if (needs.length > 0) pushedPack.needs = needs;
|
|
434
437
|
pushedPack.cutMost = kept.reduce((left, [, parents]) => left - parents.length, receiveCutParentsMost);
|
|
438
|
+
const copying = (yield* bound.lfs) !== void 0;
|
|
435
439
|
const { restaged: _restaged, ...fetched } = row;
|
|
436
440
|
const next = () => ({
|
|
437
441
|
...fetched,
|
|
@@ -465,8 +469,13 @@ const fetchSegment = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, row,
|
|
|
465
469
|
pack: pushedPack,
|
|
466
470
|
also: (_at, received) => {
|
|
467
471
|
const written = cutAfter(roots, kept, received);
|
|
472
|
+
const paged = withLfsPages(next(), received?.lfsPointers, copying);
|
|
468
473
|
return {
|
|
469
|
-
put: [
|
|
474
|
+
put: [
|
|
475
|
+
importRow(paged.row),
|
|
476
|
+
...written.put,
|
|
477
|
+
...paged.put
|
|
478
|
+
],
|
|
470
479
|
delete: written.delete,
|
|
471
480
|
jobs: []
|
|
472
481
|
};
|
|
@@ -578,6 +587,7 @@ const resumedIn = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, row, rec
|
|
|
578
587
|
}
|
|
579
588
|
const answer = stepped.success;
|
|
580
589
|
if ("paused" in answer) return more;
|
|
590
|
+
const copying = (yield* attempt.bound.lfs) !== void 0;
|
|
581
591
|
yield* push({
|
|
582
592
|
caller: attempt.bound.caller,
|
|
583
593
|
repo: opened.name,
|
|
@@ -589,11 +599,13 @@ const resumedIn = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, row, rec
|
|
|
589
599
|
pack: { received: answer.received },
|
|
590
600
|
also: (at, received) => {
|
|
591
601
|
const written = cutAfter(lands.roots, kept, received);
|
|
602
|
+
const paged = withLfsPages(landed(row, lands), received?.lfsPointers, copying);
|
|
592
603
|
return {
|
|
593
604
|
put: [
|
|
594
|
-
importRow(
|
|
605
|
+
importRow(paged.row),
|
|
595
606
|
stagedRow(pack, at, true),
|
|
596
|
-
...written.put
|
|
607
|
+
...written.put,
|
|
608
|
+
...paged.put
|
|
597
609
|
],
|
|
598
610
|
delete: [...written.delete, receiveKey(pack)],
|
|
599
611
|
jobs: []
|
|
@@ -769,7 +781,15 @@ const stepIn = /* @__PURE__ */ Effect.fnUntraced(function* (attempt) {
|
|
|
769
781
|
/** The step the record says is next, once who started the import is asked again. */
|
|
770
782
|
const stepAs = /* @__PURE__ */ Effect.fnUntraced(function* (attempt, read, row) {
|
|
771
783
|
if (row.receiving !== void 0) return yield* resumed(attempt, row, row.receiving, read.cut);
|
|
772
|
-
if (row.copied)
|
|
784
|
+
if (row.copied) {
|
|
785
|
+
const { lfs } = row;
|
|
786
|
+
const copy = lfs !== void 0 && lfs.page < lfs.pages ? yield* attempt.bound.lfs : void 0;
|
|
787
|
+
if (lfs !== void 0 && copy !== void 0) {
|
|
788
|
+
yield* copyLfs(attempt, read.version, row, lfs, copy);
|
|
789
|
+
return more;
|
|
790
|
+
}
|
|
791
|
+
return yield* publish(attempt, row);
|
|
792
|
+
}
|
|
773
793
|
const remote = yield* remoteOf(attempt.bound, row.source, attempt.context.signal, "read");
|
|
774
794
|
if (row.tipPages === void 0) return yield* listTips(attempt, read.version, row, remote);
|
|
775
795
|
return yield* fetchSegment(attempt, row, read.cut, remote);
|