@ref0/git 0.10.0 → 0.12.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 +5 -4
- package/dist/contracts/forks.d.mts +3 -2
- package/dist/contracts/git.d.mts +23 -5
- package/dist/contracts/queue.d.mts +5 -1
- package/dist/contracts/queue.mjs +1 -0
- package/dist/contracts/result.d.mts +7 -5
- package/dist/contracts/result.mjs +7 -5
- package/dist/contracts/sync.d.mts +11 -0
- package/dist/core/access.d.mts +1 -0
- package/dist/core/access.mjs +10 -11
- package/dist/core/asked.mjs +30 -0
- package/dist/core/events/deliver.d.mts +1 -0
- package/dist/core/events/deliver.mjs +5 -1
- package/dist/core/forks.mjs +39 -13
- package/dist/core/imports.mjs +9 -4
- package/dist/core/index-job.mjs +8 -6
- package/dist/core/objects/reading.mjs +17 -9
- package/dist/core/parts.d.mts +2 -1
- package/dist/core/push.mjs +11 -8
- package/dist/core/refs.mjs +6 -3
- package/dist/core/registered-rows.d.mts +1 -0
- package/dist/core/registered-rows.mjs +7 -5
- package/dist/core/repack.mjs +5 -3
- package/dist/core/saved-caller-views.d.mts +18 -0
- package/dist/core/saved-caller-views.mjs +17 -4
- package/dist/core/saved-callers-public.d.mts +3 -3
- package/dist/core/saved-callers-public.mjs +3 -2
- package/dist/core/saved-callers.d.mts +7 -0
- package/dist/extend.d.mts +2 -1
- package/dist/extend.mjs +2 -1
- package/dist/http/push-uploads.mjs +6 -3
- package/dist/lfs/locks.mjs +14 -9
- package/dist/lfs/objects.mjs +27 -20
- package/dist/queue/advance.mjs +8 -4
- package/dist/queue/calls.mjs +21 -1
- package/dist/rest/blobs.d.mts +15 -15
- package/dist/rest/commits.d.mts +80 -80
- package/dist/rest/files.d.mts +103 -103
- package/dist/rest/forks.d.mts +39 -39
- package/dist/rest/layer.mjs +8 -1
- package/dist/rest/queue.d.mts +170 -170
- package/dist/rest/refs.d.mts +128 -128
- package/dist/rest/tokens.d.mts +187 -187
- package/dist/rest/trees.d.mts +41 -41
- package/dist/server/git-namespace.d.mts +3 -3
- package/dist/server/server.mjs +6 -4
- package/dist/storage/memory-budget.mjs +128 -6
- package/dist/storage/merge-cut.mjs +5 -4
- package/dist/storage/pack-reads.mjs +239 -27
- package/dist/storage/prune-seen.mjs +11 -6
- package/dist/storage/prune-walk.mjs +168 -68
- package/dist/storage/quarantine.mjs +2 -0
- package/dist/store/repo-record.d.mts +25 -0
- package/dist/store/repo-record.mjs +55 -1
- package/dist/sync/github.mjs +10 -1
- package/dist/sync/import.d.mts +12 -0
- package/dist/sync/import.mjs +3 -2
- package/dist/sync/mirror.mjs +24 -17
- package/dist/sync/said.mjs +204 -0
- package/dist/sync/step.mjs +8 -8
- package/dist/sync/tries.mjs +34 -18
- package/dist/sync.d.mts +2 -1
- package/dist/sync.mjs +2 -1
- package/dist/topics/advance.mjs +10 -3
- package/package.json +3 -3
package/dist/core/push.mjs
CHANGED
|
@@ -27,7 +27,7 @@ import { appendEvents, decodeOutbox, firstSeq, outboxReads, repoEnvelope } from
|
|
|
27
27
|
import { rowsAtCommit } from "./loose-tally.mjs";
|
|
28
28
|
import { MirrorRow } from "./mirror-rows.mjs";
|
|
29
29
|
import { PrunedMark, mirrorJobName } from "../store/records.mjs";
|
|
30
|
-
import { decodeStats, looseRows, readRecord, repoStats, rootsOf, timeRow } from "../store/repo-record.mjs";
|
|
30
|
+
import { HeldBy, decodeStats, heldUntil, looseRows, readRecord, repoStats, rootsOf, timeRow } from "../store/repo-record.mjs";
|
|
31
31
|
import { advanceRow } from "../store/queue-jobs.mjs";
|
|
32
32
|
import { liveReservations, reservedTarget } from "../store/reservations.mjs";
|
|
33
33
|
import { settleName } from "../store/settle.mjs";
|
|
@@ -216,7 +216,7 @@ const keyedRead = (caller, operation, missed, internalId) => openKeyed(caller, {
|
|
|
216
216
|
* received against, its default branch, whose move rebuilds the ready shallow pack, and its
|
|
217
217
|
* `pruned` mark.
|
|
218
218
|
*/
|
|
219
|
-
const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operation, resolved) {
|
|
219
|
+
const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operation, resolved, heldAt) {
|
|
220
220
|
const { caller } = request;
|
|
221
221
|
const repo = repoAccess(resolved);
|
|
222
222
|
if (request.queued === void 0) yield* check({
|
|
@@ -241,7 +241,8 @@ const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operatio
|
|
|
241
241
|
roots,
|
|
242
242
|
repo,
|
|
243
243
|
view,
|
|
244
|
-
views
|
|
244
|
+
views,
|
|
245
|
+
heldAt
|
|
245
246
|
};
|
|
246
247
|
});
|
|
247
248
|
/**
|
|
@@ -839,9 +840,9 @@ const lists = (body, pack) => body.delete.some((key) => key.collection === objec
|
|
|
839
840
|
* only, refused as the commit would be, its `writes` or none, and answered before it, for
|
|
840
841
|
* `checkPush`: nothing before that point writes, reserves or enqueues, with no pack.
|
|
841
842
|
*/
|
|
842
|
-
const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRepo, view, views }, key, answers, checking = false) => Effect.scoped(Effect.gen(function* () {
|
|
843
|
+
const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRepo, view, views, heldAt }, key, answers, checking = false) => Effect.scoped(Effect.gen(function* () {
|
|
843
844
|
const core = yield* CoreParts;
|
|
844
|
-
const { objects: sealed } = yield* ObjectsParts;
|
|
845
|
+
const { objects: sealed, fetchLimits } = yield* ObjectsParts;
|
|
845
846
|
const authorize = yield* Authorize;
|
|
846
847
|
const { store } = core;
|
|
847
848
|
const { caller, repo, signal } = request;
|
|
@@ -850,7 +851,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRe
|
|
|
850
851
|
const { received, rooted } = yield* receive(yield* read({
|
|
851
852
|
view,
|
|
852
853
|
at: seen
|
|
853
|
-
}), listed, request).pipe(Effect.tapError((error) => isAwaitingRepack(error) ? bestEffort(ensureRepack(core, core.jobs,
|
|
854
|
+
}), listed, request).pipe(Effect.provideService(HeldBy, heldUntil(heldAt, fetchLimits)), Effect.tapError((error) => isAwaitingRepack(error) ? bestEffort(ensureRepack(core, core.jobs, listed.repo, fetchLimits)) : Effect.void), Effect.mapError(asPushCheck));
|
|
854
855
|
const ownedPack = ownPack(request, received);
|
|
855
856
|
let listing = false;
|
|
856
857
|
if (ownedPack !== void 0) yield* Effect.addFinalizer((exit) => listing || Exit.hasInterrupts(exit) ? Effect.void : Effect.flatMap(Clock$1.currentTimeMillis, (at) => abandonOwn({
|
|
@@ -1205,8 +1206,9 @@ const pushWith = (request, answers, key) => pushThrough(request, answers, key, f
|
|
|
1205
1206
|
/** `pushWith`, or with `checking`, its checks alone, as `pushOnto` says. */
|
|
1206
1207
|
const pushThrough = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, key, checking) {
|
|
1207
1208
|
const operation = operationOf(request);
|
|
1209
|
+
const heldAt = yield* Clock$1.currentTimeMillis;
|
|
1208
1210
|
const resolved = yield* firstRead(request.caller, operation, request.internalId).pipe(Effect.tapError((error) => retriedCodes.has(error.code) ? Effect.void : refuseQueued(request, [error], "access")));
|
|
1209
|
-
const opened = yield* listedFor(request, operation, resolved);
|
|
1211
|
+
const opened = yield* listedFor(request, operation, resolved, heldAt);
|
|
1210
1212
|
return yield* pushOnto(request, opened, key, answers, checking);
|
|
1211
1213
|
});
|
|
1212
1214
|
/** A push or an unkeyed `refs.update`, answering the decide's ref answer. */
|
|
@@ -1245,9 +1247,10 @@ const pushFetched = (request) => pushWith(request, {
|
|
|
1245
1247
|
*/
|
|
1246
1248
|
const keyedPushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, keyed) {
|
|
1247
1249
|
const operation = operationOf(request);
|
|
1250
|
+
const heldAt = yield* Clock$1.currentTimeMillis;
|
|
1248
1251
|
const resolved = yield* keyedRead(request.caller, operation, keyed.missed, request.internalId);
|
|
1249
1252
|
if (resolved === void 0) return void 0;
|
|
1250
|
-
const opened = yield* listedFor(request, operation, resolved);
|
|
1253
|
+
const opened = yield* listedFor(request, operation, resolved, heldAt);
|
|
1251
1254
|
return yield* pushOnto(request, opened, keyed.key, answers);
|
|
1252
1255
|
});
|
|
1253
1256
|
/** `keyedPushWith` for `refs.update`, answering the decide's ref answer. */
|
package/dist/core/refs.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import "../contracts/ids.mjs";
|
|
|
4
4
|
import { badCursor } from "../engine/reads.mjs";
|
|
5
5
|
import { listBound } from "../store/cursor-seal.mjs";
|
|
6
6
|
import { storeCall } from "../store/errors.mjs";
|
|
7
|
+
import { heldAdd, heldStore } from "../store/repo-record.mjs";
|
|
7
8
|
import { keptKey } from "../store/records.mjs";
|
|
8
9
|
import { refRowBytes } from "../store/ref-rows.mjs";
|
|
9
10
|
import { collections, repoScope } from "../store/scopes.mjs";
|
|
@@ -19,7 +20,7 @@ import { plainClass, refIndexId } from "./ref-index.mjs";
|
|
|
19
20
|
import { pushRulesFor } from "./rules/check.mjs";
|
|
20
21
|
import { refProtection } from "./rules/protect.mjs";
|
|
21
22
|
import { fail } from "../contracts/result.mjs";
|
|
22
|
-
import { CoreParts, acting } from "./parts.mjs";
|
|
23
|
+
import { CoreParts, ObjectsParts, acting } from "./parts.mjs";
|
|
23
24
|
import { bypassKinds, hostAuthorize } from "../auth/authorize.mjs";
|
|
24
25
|
import { Authorize, check } from "../contracts/authorize.mjs";
|
|
25
26
|
import * as Clock$1 from "effect/Clock";
|
|
@@ -282,8 +283,10 @@ const refCalls = (bound) => {
|
|
|
282
283
|
const core = yield* CoreParts;
|
|
283
284
|
const jobs = refIndexJobs(core, view.resolved.record);
|
|
284
285
|
if (jobs.length === 0) return;
|
|
285
|
-
|
|
286
|
-
const
|
|
286
|
+
const { internalId } = view.resolved;
|
|
287
|
+
const { fetchLimits } = yield* ObjectsParts;
|
|
288
|
+
if (!(yield* heldAdd(heldStore(core.store), internalId, fetchLimits, { jobs }).pipe(Effect.as(true), Effect.catchTag("RepoGone", () => Effect.succeed(false))))) return;
|
|
289
|
+
const scope = repoScope(internalId);
|
|
287
290
|
for (const { name, key } of jobs) yield* storeCall(() => core.jobs.retry(scope, {
|
|
288
291
|
name,
|
|
289
292
|
key
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fail } from "../contracts/result.mjs";
|
|
2
|
+
import { asAsked, readAsked } from "./asked.mjs";
|
|
2
3
|
import { storeCall } from "../store/errors.mjs";
|
|
3
|
-
import { readRecord } from "../store/repo-record.mjs";
|
|
4
|
+
import { heldAdd, heldStore, readRecord } from "../store/repo-record.mjs";
|
|
4
5
|
import { newChangeId, repoScope } from "../store/scopes.mjs";
|
|
5
6
|
import * as Effect from "effect/Effect";
|
|
6
7
|
// src/core/registered-rows.ts
|
|
@@ -21,13 +22,14 @@ const registeredRows = (name, base) => {
|
|
|
21
22
|
});
|
|
22
23
|
const jobsOf = (bound, writes) => writes.wake === void 0 ? [] : [bound.repackJobRow(writes.wake)];
|
|
23
24
|
return {
|
|
24
|
-
read: (repo, reads) => within(reads, (bound) => Effect.map(
|
|
25
|
+
read: (repo, reads, asked) => within(reads, (bound) => Effect.map(readAsked(bound.store, repo, reads, [], asked), ({ version, results }) => ({
|
|
25
26
|
version,
|
|
26
27
|
results
|
|
27
28
|
}))),
|
|
28
|
-
readFenced: (caller, repo, reads) => within(reads, (bound) => Effect.gen(function* () {
|
|
29
|
+
readFenced: (caller, repo, reads, asked) => within(reads, (bound) => Effect.gen(function* () {
|
|
29
30
|
const fence = bound.fences(caller, repo);
|
|
30
31
|
const { record, snapshot } = yield* readRecord(bound.store, repo.internalId, [...reads, ...fence.reads]);
|
|
32
|
+
if (asked !== void 0) yield* asAsked(asked, record);
|
|
31
33
|
if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${repo.name}'`);
|
|
32
34
|
const results = snapshot.results.slice(1);
|
|
33
35
|
yield* fence.check(results.slice(reads.length));
|
|
@@ -44,10 +46,10 @@ const registeredRows = (name, base) => {
|
|
|
44
46
|
delete: [...writes.delete ?? []],
|
|
45
47
|
jobs: jobsOf(bound, writes)
|
|
46
48
|
}))),
|
|
47
|
-
add: (repo, writes) => within(writes.put ?? [], (bound) =>
|
|
49
|
+
add: (repo, writes) => within(writes.put ?? [], (bound) => heldAdd(heldStore(bound.store), repo, bound.fetchLimits, {
|
|
48
50
|
put: [...writes.put ?? []],
|
|
49
51
|
jobs: jobsOf(bound, writes)
|
|
50
|
-
})))
|
|
52
|
+
}).pipe(Effect.catchTag("RepoGone", () => fail("NOT_FOUND", `No repo '${repo}'`))))
|
|
51
53
|
};
|
|
52
54
|
};
|
|
53
55
|
export { registeredRows };
|
package/dist/core/repack.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { untilAborted } from "../store/crossing.mjs";
|
|
|
5
5
|
import { gitJob } from "../store/job-try.mjs";
|
|
6
6
|
import { decodePacks, featureChange, gitStore, packRow } from "../store/git-store.mjs";
|
|
7
7
|
import { appendEvents, decodeOutbox, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
8
|
-
import { decodeStats, looseRows, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
|
|
8
|
+
import { decodeStats, heldAdd, heldStore, looseRows, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
|
|
9
9
|
import { settleName } from "../store/settle.mjs";
|
|
10
10
|
import { replacedAtCommit } from "../storage/index-remap.mjs";
|
|
11
11
|
import { indexRowKey, isPackId, objectCollections } from "../storage/layout.mjs";
|
|
@@ -661,9 +661,11 @@ const repackJobRow = (job, at) => job.job(at === void 0 ? {
|
|
|
661
661
|
* The repo's `git.repack` row made due, for a push refused `packs-awaiting-repack`, so its hint
|
|
662
662
|
* holds: added if it's gone, and retried if it spent its tries, since an add leaves a failed row
|
|
663
663
|
* failed, its data rebuilt once it has compacted. A row already waiting or running is left as it is.
|
|
664
|
+
* A repo deleted since the push read it takes none, as its purge may have dropped its scope (#1911).
|
|
664
665
|
*/
|
|
665
|
-
const ensureRepack = /* @__PURE__ */ Effect.fnUntraced(function* (core, jobs,
|
|
666
|
-
yield*
|
|
666
|
+
const ensureRepack = /* @__PURE__ */ Effect.fnUntraced(function* (core, jobs, repo, fetchLimits) {
|
|
667
|
+
if (!(yield* heldAdd(heldStore(core.store), repo, fetchLimits, { jobs: [core.repackJobRow()] }).pipe(Effect.as(true), Effect.catchTag("RepoGone", () => Effect.succeed(false))))) return;
|
|
668
|
+
const scope = repoScope(repo);
|
|
667
669
|
const job = {
|
|
668
670
|
name: repackJobName,
|
|
669
671
|
key: repackJobKey
|
|
@@ -4,6 +4,7 @@ import "../contracts/authorize.mjs";
|
|
|
4
4
|
import { InternalRepoId } from "../contracts/ids.mjs";
|
|
5
5
|
import { GitError } from "../contracts/result.mjs";
|
|
6
6
|
import "./parts.mjs";
|
|
7
|
+
import "./saved-callers.mjs";
|
|
7
8
|
import * as Effect from "effect/Effect";
|
|
8
9
|
import * as Schema from "effect/Schema";
|
|
9
10
|
import * as Context from "effect/Context";
|
|
@@ -52,6 +53,14 @@ declare const SavedCallers_base: Context.ServiceClass<SavedCallers, "@ref0/git/S
|
|
|
52
53
|
* longer `kind` it. A host or store that failed fails, for the try to retry.
|
|
53
54
|
*/
|
|
54
55
|
readonly view: (saved: Saved, repo: InternalRepoId, kind: 'read' | 'fetch') => Effect.Effect<Viewed, GitError>;
|
|
56
|
+
/**
|
|
57
|
+
* The caller who added queue entry `entry`, as its row saved them when it was added: their
|
|
58
|
+
* actor, and the grant that gave them, by its resolver and `id`, never a token. `view` asks
|
|
59
|
+
* it again. `undefined` unless the entry is still in the queue: an ID no queue made, an
|
|
60
|
+
* entry or repo that's gone, and one that merged, failed or was removed name no one, so the
|
|
61
|
+
* work acts for no one, never for its actor alone. A store that failed fails, for a retry.
|
|
62
|
+
*/
|
|
63
|
+
readonly queueEntry: (entry: string) => Effect.Effect<Saved | undefined, GitError>;
|
|
55
64
|
}>;
|
|
56
65
|
/**
|
|
57
66
|
* Work a host's job does later for someone, such as the drop-in's hook deliveries (#1945): who it
|
|
@@ -69,4 +78,13 @@ export declare const save: (actor: string, caller: Caller) => Effect.Effect<{
|
|
|
69
78
|
readonly id: string;
|
|
70
79
|
}, never, SavedCallers>;
|
|
71
80
|
export declare const view: (saved: Saved, repo: InternalRepoId, kind: 'read' | 'fetch') => Effect.Effect<Viewed, GitError, SavedCallers>;
|
|
81
|
+
export declare const queueEntry: (entry: string) => Effect.Effect<{
|
|
82
|
+
readonly kind: "actor";
|
|
83
|
+
readonly actor: string;
|
|
84
|
+
} | {
|
|
85
|
+
readonly kind: "grant";
|
|
86
|
+
readonly actor: string;
|
|
87
|
+
readonly resolver: string;
|
|
88
|
+
readonly id: string;
|
|
89
|
+
} | undefined, GitError, SavedCallers>;
|
|
72
90
|
export {};
|
|
@@ -85,6 +85,16 @@ const askedOf = (saved) => saved.kind === "actor" ? { actor: saved.actor } : {
|
|
|
85
85
|
id: saved.id
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
+
/** `saved` as `Saved` keeps it: its actor and its grant, never its token or subject. */
|
|
89
|
+
const keptOf = (saved) => saved.grant === void 0 ? {
|
|
90
|
+
kind: "actor",
|
|
91
|
+
actor: saved.actor
|
|
92
|
+
} : {
|
|
93
|
+
kind: "grant",
|
|
94
|
+
actor: saved.actor,
|
|
95
|
+
resolver: saved.grant.resolver,
|
|
96
|
+
id: saved.grant.id
|
|
97
|
+
};
|
|
88
98
|
/** `use`, with a signal that aborts once its fiber is interrupted, as a grant's `again` reads one. */
|
|
89
99
|
const signalled = (use) => Effect.suspend(() => {
|
|
90
100
|
const interrupted = new AbortController();
|
|
@@ -98,6 +108,7 @@ const signalled = (use) => Effect.suspend(() => {
|
|
|
98
108
|
var SavedCallers = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/SavedCallers")) {};
|
|
99
109
|
const save = (actor, caller) => Effect.flatMap(Effect.service(SavedCallers), (callers) => callers.save(actor, caller));
|
|
100
110
|
const view = (saved, repo, kind) => Effect.flatMap(Effect.service(SavedCallers), (callers) => callers.view(saved, repo, kind));
|
|
111
|
+
const queueEntry = (entry) => Effect.flatMap(Effect.service(SavedCallers), (callers) => callers.queueEntry(entry));
|
|
101
112
|
/** `caller` as `Saved`: its grant by the record Git keeps of it, never the caller's own field. */
|
|
102
113
|
const savedOf = /* @__PURE__ */ Effect.fnUntraced(function* (actor, caller) {
|
|
103
114
|
const grant = yield* grantOf(caller);
|
|
@@ -114,10 +125,12 @@ const savedOf = /* @__PURE__ */ Effect.fnUntraced(function* (actor, caller) {
|
|
|
114
125
|
});
|
|
115
126
|
/**
|
|
116
127
|
* `SavedCallers` over the server's own parts, `needs`, which every call of it runs over: the
|
|
117
|
-
* server's store, never a job try's fenced one
|
|
128
|
+
* server's store, never a job try's fenced one, and a queue entry's adder read by `adderOf`. Core's
|
|
129
|
+
* own jobs call `viewAgainOf` in their try.
|
|
118
130
|
*/
|
|
119
|
-
const savedCallersOf = (needs) => SavedCallers.of({
|
|
131
|
+
const savedCallersOf = (needs, adderOf) => SavedCallers.of({
|
|
120
132
|
save: (actor, caller) => Effect.provideContext(savedOf(actor, caller), needs),
|
|
121
|
-
view: (saved, repo, kind) => Effect.provideContext(signalled((signal) => viewNowOf(askedOf(saved), repo, kind, signal)), needs)
|
|
133
|
+
view: (saved, repo, kind) => Effect.provideContext(signalled((signal) => viewNowOf(askedOf(saved), repo, kind, signal)), needs),
|
|
134
|
+
queueEntry: (entry) => Effect.provideContext(Effect.map(adderOf(entry), (row) => row === void 0 ? void 0 : keptOf(row)), needs)
|
|
122
135
|
});
|
|
123
|
-
export { Saved, SavedCallers, save, savedCallersOf, view, viewAgainOf };
|
|
136
|
+
export { Saved, SavedCallers, queueEntry, save, savedCallersOf, view, viewAgainOf };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Saved, SavedCallers, Viewed, save, view } from "./saved-caller-views.mjs";
|
|
1
|
+
import { Saved, SavedCallers, Viewed, queueEntry, save, view } from "./saved-caller-views.mjs";
|
|
2
2
|
declare namespace saved_callers_public_d_exports {
|
|
3
|
-
export { Saved, SavedCallers, Viewed, save, view };
|
|
3
|
+
export { Saved, SavedCallers, Viewed, queueEntry, save, view };
|
|
4
4
|
}
|
|
5
|
-
export { Saved, SavedCallers, type Viewed, save, saved_callers_public_d_exports, view };
|
|
5
|
+
export { Saved, SavedCallers, type Viewed, queueEntry, save, saved_callers_public_d_exports, view };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import { Saved, SavedCallers, save, view } from "./saved-caller-views.mjs";
|
|
2
|
+
import { Saved, SavedCallers, queueEntry, save, view } from "./saved-caller-views.mjs";
|
|
3
3
|
// src/core/saved-callers-public.ts
|
|
4
4
|
var saved_callers_public_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
Saved: () => Saved,
|
|
6
6
|
SavedCallers: () => SavedCallers,
|
|
7
|
+
queueEntry: () => queueEntry,
|
|
7
8
|
save: () => save,
|
|
8
9
|
view: () => view
|
|
9
10
|
});
|
|
10
|
-
export { Saved, SavedCallers, save, saved_callers_public_exports, view };
|
|
11
|
+
export { Saved, SavedCallers, queueEntry, save, saved_callers_public_exports, view };
|
package/dist/extend.d.mts
CHANGED
|
@@ -3,4 +3,5 @@ import { Joined, JoinedAdapter, JoinedCalls, Joining, joinLayer } from "./server
|
|
|
3
3
|
import { Bucket } from "./contracts/objects.mjs";
|
|
4
4
|
import { Clock, RecordStore, Store } from "./contracts/promises.mjs";
|
|
5
5
|
import { ImportState } from "./contracts/sync.mjs";
|
|
6
|
-
|
|
6
|
+
import { heldUntil, inTime } from "./store/repo-record.mjs";
|
|
7
|
+
export { type Bucket, type Clock, type ImportState, type Joined, type JoinedAdapter, JoinedCalls, type Joining, type RecordStore, type Store, heldUntil, inTime, isServerClosed, joinLayer };
|
package/dist/extend.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { isServerClosed } from "./store/closed.mjs";
|
|
2
2
|
import { JoinedCalls, joinLayer } from "./server/joined.mjs";
|
|
3
|
-
|
|
3
|
+
import { heldUntil, inTime } from "./store/repo-record.mjs";
|
|
4
|
+
export { JoinedCalls, heldUntil, inTime, isServerClosed, joinLayer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BeginPushUpload, FinishPushUpload, PushUploadPart, PushUploadStarted } from "../contracts/push-uploads.mjs";
|
|
2
2
|
import { fail, gitError } from "../contracts/result.mjs";
|
|
3
3
|
import { openFor } from "../core/access.mjs";
|
|
4
|
-
import { CoreParts } from "../core/parts.mjs";
|
|
4
|
+
import { CoreParts, ObjectsParts } from "../core/parts.mjs";
|
|
5
5
|
import { pushOptionsRefusal } from "../protocol/wire/receive-pack.mjs";
|
|
6
6
|
import { pushReasonsCapability } from "../protocol/wire/push-limits.mjs";
|
|
7
7
|
import { decodeJson } from "../protocol/wire/json.mjs";
|
|
@@ -9,6 +9,7 @@ import { bucketCall, bucketStream, readWhole } from "../storage/calls.mjs";
|
|
|
9
9
|
import { PushUploadRow, completeMost, endUpload, partBytes, partLinkLife, partSizeOf, partsOf, pushPackTooLarge, pushUploadGrace, pushUploadKey, pushUploadLife, pushUploadMost, pushUploadRead, pushUploadRowKey } from "../storage/push-uploads.mjs";
|
|
10
10
|
import { afterWrites, bestEffort, decodeRow, storeCall } from "../store/errors.mjs";
|
|
11
11
|
import { randomText } from "../store/random.mjs";
|
|
12
|
+
import { heldAdd, heldStore } from "../store/repo-record.mjs";
|
|
12
13
|
import { newChangeId, repoScope } from "../store/scopes.mjs";
|
|
13
14
|
import { gitAnswer, resultType } from "./answers.mjs";
|
|
14
15
|
import { brokenBody, plainBody, readWhole as readWhole$1 } from "./bodies.mjs";
|
|
@@ -97,13 +98,15 @@ const begin = /* @__PURE__ */ Effect.fnUntraced(function* (uploads, call) {
|
|
|
97
98
|
state: "open"
|
|
98
99
|
};
|
|
99
100
|
const core = yield* CoreParts;
|
|
100
|
-
|
|
101
|
+
const { fetchLimits } = yield* ObjectsParts;
|
|
102
|
+
const addition = {
|
|
101
103
|
put: [{
|
|
102
104
|
...pushUploadRowKey(upload),
|
|
103
105
|
value: row
|
|
104
106
|
}],
|
|
105
107
|
jobs: [core.repackJobRow(removeAt)]
|
|
106
|
-
}
|
|
108
|
+
};
|
|
109
|
+
yield* heldAdd(heldStore(core.store), repo.internalId, fetchLimits, addition).pipe(Effect.catchTag("RepoGone", () => fail("NOT_FOUND", `No repo '${call.repo}'`)));
|
|
107
110
|
return jsonAnswer(PushUploadStarted, {
|
|
108
111
|
upload,
|
|
109
112
|
partSize: partSizeOf(body.bytes, uploads.maxParts),
|
package/dist/lfs/locks.mjs
CHANGED
|
@@ -45,10 +45,11 @@ const ownerOf = (caller) => caller.actor.anonymous === true ? fail("UNAUTHENTICA
|
|
|
45
45
|
const createLock = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
46
46
|
const { path } = yield* bodyOf(call.request, LockCreate);
|
|
47
47
|
const owner = yield* ownerOf(call.caller);
|
|
48
|
-
const repo = yield* openFor(call.caller, call.repo, true);
|
|
48
|
+
const repo = yield* openFor(call.caller, call.repo, true, void 0, "first-read");
|
|
49
49
|
const id = pathRowId(path);
|
|
50
50
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
51
|
-
const
|
|
51
|
+
const asked = tries === 0 ? repo : void 0;
|
|
52
|
+
const read = yield* parts.rows.readFenced(call.caller, repo, [lockRead(id)], asked);
|
|
52
53
|
const held = read.results[0]?.[0];
|
|
53
54
|
if (held !== void 0) return lfsAnswer(409, {
|
|
54
55
|
lock: yield* lockOf(held),
|
|
@@ -70,14 +71,17 @@ const createLock = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
70
71
|
}
|
|
71
72
|
return yield* contended();
|
|
72
73
|
});
|
|
73
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* One page of the repo's locks, after `cursor`, with the next page's cursor when there's one: the
|
|
76
|
+
* first read since the repo opened, so held to what was asked, as `asAsked` says.
|
|
77
|
+
*/
|
|
74
78
|
const pageOfLocks = /* @__PURE__ */ Effect.fnUntraced(function* (parts, repo, cursor, limit) {
|
|
75
79
|
const read = {
|
|
76
80
|
collection: lfsCollections.locks,
|
|
77
81
|
limit: limit + 1
|
|
78
82
|
};
|
|
79
83
|
if (cursor !== void 0) read.after = cursor;
|
|
80
|
-
const rows = (yield* parts.rows.read(repo.internalId, [read])).results[0] ?? [];
|
|
84
|
+
const rows = (yield* parts.rows.read(repo.internalId, [read], repo)).results[0] ?? [];
|
|
81
85
|
const locks = yield* Effect.forEach(rows.slice(0, limit), lockOf);
|
|
82
86
|
const last = rows[limit - 1];
|
|
83
87
|
return {
|
|
@@ -89,12 +93,12 @@ const pageOfLocks = /* @__PURE__ */ Effect.fnUntraced(function* (parts, repo, cu
|
|
|
89
93
|
const listLocks = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
90
94
|
const query = new URL(call.request.url).searchParams;
|
|
91
95
|
const { limit = 100 } = yield* queryOf(query);
|
|
92
|
-
const repo = yield* openFor(call.caller, call.repo, false);
|
|
96
|
+
const repo = yield* openFor(call.caller, call.repo, false, void 0, "first-read");
|
|
93
97
|
const path = query.get("path");
|
|
94
98
|
const id = query.get("id");
|
|
95
99
|
const wanted = id !== null ? lockIdParts(id) : path === null ? void 0 : { row: pathRowId(path) };
|
|
96
100
|
if (wanted !== void 0) {
|
|
97
|
-
const row = (yield* parts.rows.read(repo.internalId, [lockRead(wanted.row)])).results[0]?.[0];
|
|
101
|
+
const row = (yield* parts.rows.read(repo.internalId, [lockRead(wanted.row)], repo)).results[0]?.[0];
|
|
98
102
|
const lock = row === void 0 ? void 0 : yield* lockOf(row);
|
|
99
103
|
const named = lock !== void 0 && (id === null || lock.id === id);
|
|
100
104
|
return lfsAnswer(200, { locks: named ? [lock] : [] });
|
|
@@ -117,7 +121,7 @@ const verifyLocks = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
117
121
|
const body = yield* bodyOf(call.request, LockVerify);
|
|
118
122
|
const owner = yield* ownerOf(call.caller);
|
|
119
123
|
const limit = body.limit ?? 100;
|
|
120
|
-
const repo = yield* openFor(call.caller, call.repo, true);
|
|
124
|
+
const repo = yield* openFor(call.caller, call.repo, true, void 0, "first-read");
|
|
121
125
|
const page = yield* pageOfLocks(parts, repo, body.cursor, limit);
|
|
122
126
|
const ours = page.locks.filter((lock) => lock.owner.name === owner);
|
|
123
127
|
const theirs = page.locks.filter((lock) => lock.owner.name !== owner);
|
|
@@ -130,10 +134,11 @@ const verifyLocks = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
130
134
|
const unlock = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, id) {
|
|
131
135
|
const { force = false } = yield* bodyOf(call.request, Unlock);
|
|
132
136
|
const owner = yield* ownerOf(call.caller);
|
|
133
|
-
const repo = yield* openFor(call.caller, call.repo, true);
|
|
137
|
+
const repo = yield* openFor(call.caller, call.repo, true, void 0, "first-read");
|
|
134
138
|
const { row: rowId } = lockIdParts(id);
|
|
135
139
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
136
|
-
const
|
|
140
|
+
const asked = tries === 0 ? repo : void 0;
|
|
141
|
+
const read = yield* parts.rows.readFenced(call.caller, repo, [lockRead(rowId)], asked);
|
|
137
142
|
const row = read.results[0]?.[0];
|
|
138
143
|
const lock = row === void 0 ? void 0 : yield* lockOf(row);
|
|
139
144
|
if (lock?.id !== id) return yield* fail("NOT_FOUND", "No such lock");
|
package/dist/lfs/objects.mjs
CHANGED
|
@@ -26,12 +26,13 @@ import * as DateTime from "effect/DateTime";
|
|
|
26
26
|
/**
|
|
27
27
|
* Each object's rows, read with the repo's record and the fence's rows at one version, the fence
|
|
28
28
|
* checked; `also`'s rows after them. An object's upload row is the caller's own, as `uploader`
|
|
29
|
-
* names it. A repo deleted since it opened is `NOT_FOUND
|
|
29
|
+
* names it. A repo deleted since it opened is `NOT_FOUND`, and with `asked`, one renamed or made
|
|
30
|
+
* public or private since too, as `RegisteredRows.read` says.
|
|
30
31
|
*/
|
|
31
|
-
const objectRows = /* @__PURE__ */ Effect.fnUntraced(function* (rows, caller, repo, oids, also = []) {
|
|
32
|
+
const objectRows = /* @__PURE__ */ Effect.fnUntraced(function* (rows, caller, repo, oids, { also = [], asked } = {}) {
|
|
32
33
|
const uploader = (yield* ownWriter(caller)) ?? "anonymous";
|
|
33
34
|
const own = oids.flatMap((oid) => [listedRead(oid), uploadRead(oid, uploader)]);
|
|
34
|
-
const { version, results } = yield* rows.readFenced(caller, repo, [...own, ...also]);
|
|
35
|
+
const { version, results } = yield* rows.readFenced(caller, repo, [...own, ...also], asked);
|
|
35
36
|
const found = /* @__PURE__ */ new Map();
|
|
36
37
|
for (const [at, oid] of oids.entries()) {
|
|
37
38
|
const [listedRows = [], uploadRows = []] = results.slice(at * 2, at * 2 + 2);
|
|
@@ -49,12 +50,12 @@ const objectRows = /* @__PURE__ */ Effect.fnUntraced(function* (rows, caller, re
|
|
|
49
50
|
});
|
|
50
51
|
const decodeListed = (row, oid) => decodeRow(ListedRow, row, `LFS object ${oid}`);
|
|
51
52
|
const decodeUpload = (row, oid) => decodeRow(UploadRow, row, `LFS object ${oid}'s upload`);
|
|
52
|
-
/** The repo's listed rows of `oids`, read in chunks. */
|
|
53
|
-
const listedOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, oids) {
|
|
53
|
+
/** The repo's listed rows of `oids`, read in chunks, the first held to `asked` when it's given. */
|
|
54
|
+
const listedOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, oids, asked) {
|
|
54
55
|
const listed = /* @__PURE__ */ new Map();
|
|
55
56
|
for (let at = 0; at < oids.length; at += 100) {
|
|
56
57
|
const chunk = oids.slice(at, at + 100);
|
|
57
|
-
const snapshot = yield* rows.read(repo, chunk.map(listedRead));
|
|
58
|
+
const snapshot = yield* rows.read(repo, chunk.map(listedRead), at === 0 ? asked : void 0);
|
|
58
59
|
for (const [index, oid] of chunk.entries()) {
|
|
59
60
|
const row = snapshot.results[index]?.[0];
|
|
60
61
|
if (row !== void 0) listed.set(oid, yield* decodeListed(row, oid));
|
|
@@ -68,12 +69,16 @@ const listedOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, oids)
|
|
|
68
69
|
* upload shadows its source's. Each source's rows of every one of `oids` are read, found sooner or
|
|
69
70
|
* not, so the reads made are the same whichever of them are listed, as `unseenOf` needs. A deleted
|
|
70
71
|
* source's rows are read too: its LFS rows and bytes stay while a fork's row names it, since
|
|
71
|
-
* `git.purge` waits on one.
|
|
72
|
+
* `git.purge` waits on one. The first read, of none of `oids` when there are none, is the first
|
|
73
|
+
* since `repo` opened, so it's held to what was asked, as `asAsked` says.
|
|
72
74
|
*/
|
|
73
75
|
const chainListed = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, oids) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
if (oids.length === 0) {
|
|
77
|
+
yield* rows.read(repo.internalId, [], repo);
|
|
78
|
+
return /* @__PURE__ */ new Map();
|
|
79
|
+
}
|
|
80
|
+
const listed = yield* listedOf(rows, repo.internalId, oids, repo);
|
|
81
|
+
let from = repo.internalId;
|
|
77
82
|
for (let read = 0; read < 16; read += 1) {
|
|
78
83
|
const source = yield* rows.source(from);
|
|
79
84
|
if (source === void 0) break;
|
|
@@ -148,7 +153,7 @@ const batch = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
148
153
|
if (body.transfers !== void 0 && !body.transfers.includes("basic")) return yield* fail("FAILED_PRECONDITION", "This server takes only the basic transfer");
|
|
149
154
|
if (body.objects.length > 1e3) return yield* fail("RESOURCE_EXHAUSTED", `A batch names at most ${batchMost} objects`);
|
|
150
155
|
const upload = body.operation === "upload";
|
|
151
|
-
const repo = yield* openFor(call.caller, call.repo, upload);
|
|
156
|
+
const repo = yield* openFor(call.caller, call.repo, upload, void 0, "first-read");
|
|
152
157
|
const most = upload && parts.signed === void 0 ? parts.uploadMost : void 0;
|
|
153
158
|
const refusalOf = (oid, size) => {
|
|
154
159
|
if (!isLfsOid(oid)) return "An oid is a SHA-256, as 64 lowercase hex digits";
|
|
@@ -188,7 +193,7 @@ const refusedOf = /* @__PURE__ */ Effect.fnUntraced(function* (call, listed) {
|
|
|
188
193
|
});
|
|
189
194
|
const downloads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo, objects) {
|
|
190
195
|
const oids = objects.map(({ oid }) => oid);
|
|
191
|
-
const chained = yield* chainListed(parts.rows, repo
|
|
196
|
+
const chained = yield* chainListed(parts.rows, repo, oids);
|
|
192
197
|
const listed = yield* seenListed(call.caller, repo, oids, chained);
|
|
193
198
|
const refused = yield* refusedOf(call, listed);
|
|
194
199
|
const expiresAt = (yield* Clock$1.currentTimeMillis) + linkLife;
|
|
@@ -230,7 +235,8 @@ const uploads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo,
|
|
|
230
235
|
const oids = objects.map(({ oid }) => oid);
|
|
231
236
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
232
237
|
const at = yield* Clock$1.currentTimeMillis;
|
|
233
|
-
const
|
|
238
|
+
const asked = tries === 0 ? repo : void 0;
|
|
239
|
+
const read = yield* objectRows(parts.rows, call.caller, repo, oids, { asked });
|
|
234
240
|
const unseen = yield* unseenRows(call.caller, repo, oids, read.rows);
|
|
235
241
|
const expiresAt = at + linkLife;
|
|
236
242
|
const removeAt = expiresAt + uploadGrace;
|
|
@@ -298,11 +304,12 @@ const verify = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
298
304
|
const { oid, size } = yield* bodyOf(call.request, VerifyRequest);
|
|
299
305
|
if (!isLfsOid(oid)) return yield* fail("INVALID_ARGUMENT", "An oid is a SHA-256, as 64 lowercase hex digits");
|
|
300
306
|
const { rows: registered, signed } = parts;
|
|
301
|
-
const repo = yield* openFor(call.caller, call.repo, true);
|
|
307
|
+
const repo = yield* openFor(call.caller, call.repo, true, void 0, "first-read");
|
|
302
308
|
const writer = yield* ownWriter(call.caller);
|
|
303
309
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
304
310
|
const at = yield* Clock$1.currentTimeMillis;
|
|
305
|
-
const
|
|
311
|
+
const asked = tries === 0 ? repo : void 0;
|
|
312
|
+
const read = yield* objectRows(registered, call.caller, repo, [oid], { asked });
|
|
306
313
|
const rows = read.rows.get(oid);
|
|
307
314
|
const unseen = (yield* unseenRows(call.caller, repo, [oid], read.rows)).has(oid);
|
|
308
315
|
if (rows?.listed !== void 0 && !unseen) return lfsAnswer(200, { message: "Verified" });
|
|
@@ -340,9 +347,9 @@ const receive = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
|
340
347
|
if (length === void 0) return lfsAnswer(411, { message: noLength });
|
|
341
348
|
if (length > parts.uploadMost.bytes) return lfsAnswer(413, { message: pastMost(parts.uploadMost) });
|
|
342
349
|
const { rows: registered, bucket } = parts;
|
|
343
|
-
const repo = yield* openFor(call.caller, call.repo, true);
|
|
350
|
+
const repo = yield* openFor(call.caller, call.repo, true, void 0, "first-read");
|
|
344
351
|
const started = yield* Clock$1.currentTimeMillis;
|
|
345
|
-
const read = yield* objectRows(registered, call.caller, repo, [oid]);
|
|
352
|
+
const read = yield* objectRows(registered, call.caller, repo, [oid], { asked: repo });
|
|
346
353
|
const rows = read.rows.get(oid);
|
|
347
354
|
const unseen = (yield* unseenRows(call.caller, repo, [oid], read.rows)).has(oid);
|
|
348
355
|
if (rows?.listed !== void 0 && !unseen) return yield* answered(call.request);
|
|
@@ -443,7 +450,7 @@ const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (registered, call
|
|
|
443
450
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
444
451
|
const at = yield* Clock$1.currentTimeMillis;
|
|
445
452
|
const own = writer === void 0 ? [] : [uploadedRow(writer, staged.oid, at)];
|
|
446
|
-
const read = yield* objectRows(registered, caller, repo, [staged.oid], [stagingRead(staged.staged)]);
|
|
453
|
+
const read = yield* objectRows(registered, caller, repo, [staged.oid], { also: [stagingRead(staged.staged)] });
|
|
447
454
|
if (read.rows.get(staged.oid)?.listed !== void 0) {
|
|
448
455
|
const answer = lfsAnswer(200, { message: staged.unseen ? "Uploaded" : "Already uploaded" });
|
|
449
456
|
if (own.length === 0) return answer;
|
|
@@ -480,8 +487,8 @@ const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (registered, call
|
|
|
480
487
|
const objectOf = /* @__PURE__ */ Effect.fnUntraced(function* (parts, read) {
|
|
481
488
|
const { oid, size, signal } = read;
|
|
482
489
|
if (!isLfsOid(oid)) return yield* fail("NOT_FOUND", "Object does not exist");
|
|
483
|
-
const repo = yield* openFor(read.caller, read.repo, false, read.internalId);
|
|
484
|
-
const chained = yield* chainListed(parts.rows, repo
|
|
490
|
+
const repo = yield* openFor(read.caller, read.repo, false, read.internalId, "first-read");
|
|
491
|
+
const chained = yield* chainListed(parts.rows, repo, [oid]);
|
|
485
492
|
const listed = (yield* seenListed(read.caller, repo, [oid], chained)).get(oid);
|
|
486
493
|
if (listed === void 0 || size !== void 0 && size !== listed.size) return yield* fail("NOT_FOUND", "Object does not exist");
|
|
487
494
|
yield* checkRead(read.repo, {
|
package/dist/queue/advance.mjs
CHANGED
|
@@ -781,11 +781,15 @@ const treeOf = (linking, entry, sides) => mergedTree(linking.opened, linking.mad
|
|
|
781
781
|
}) : error));
|
|
782
782
|
/** A host's `merge` answer read as a `MergePlan`: a host in plain JavaScript may answer any value. */
|
|
783
783
|
const decodePlan = /* @__PURE__ */ Schema.decodeUnknownSync(MergePlan);
|
|
784
|
-
/**
|
|
785
|
-
|
|
784
|
+
/**
|
|
785
|
+
* The host's plan for an entry's link, at the queue's `Clock`'s time, which the host stamps its
|
|
786
|
+
* author with: a throw or bad plan fails it `host-error`, with the failure's ID.
|
|
787
|
+
*/
|
|
788
|
+
const planOf = (linking, entry, row, commits) => Clock$1.currentTimeMillis.pipe(Effect.flatMap((at) => hostCall("queue.merge", { repo: linking.repo }, () => decodePlan(linking.options.merge({
|
|
786
789
|
entry: entryOf(linking.repo, entry, row, linking.notes.get(entry) ?? {}),
|
|
787
|
-
commits
|
|
788
|
-
|
|
790
|
+
commits,
|
|
791
|
+
at
|
|
792
|
+
}))))).pipe(Effect.catch((error) => {
|
|
789
793
|
const id = error.code === "UNAVAILABLE" || error.code === "DEADLINE_EXCEEDED" ? error.context?.id ?? "" : "";
|
|
790
794
|
return Effect.fail(linkFailed(entry, {
|
|
791
795
|
kind: "host-error",
|
package/dist/queue/calls.mjs
CHANGED
|
@@ -149,6 +149,26 @@ const openKeyedQueue = /* @__PURE__ */ Effect.fnUntraced(function* (answer, host
|
|
|
149
149
|
return yield* contended();
|
|
150
150
|
});
|
|
151
151
|
/**
|
|
152
|
+
* Who added queue entry `entry`, as its row saved them at the add, read from the server's store
|
|
153
|
+
* for `SavedCallers.queueEntry`: a host's call for its own jobs, so no caller is asked. `undefined`
|
|
154
|
+
* unless the entry is still in the queue, waiting, checking or held: an ID no queue made, an entry
|
|
155
|
+
* or repo that's gone, and one that merged, failed or was removed name no one to act for.
|
|
156
|
+
*/
|
|
157
|
+
const entryAdderOf = /* @__PURE__ */ Effect.fnUntraced(function* (entry) {
|
|
158
|
+
const { collection, schema, what } = idKinds.e;
|
|
159
|
+
const parts = queueIdParts("e", entry);
|
|
160
|
+
if (parts === void 0) return void 0;
|
|
161
|
+
const { store } = yield* CoreParts;
|
|
162
|
+
const { record, snapshot } = yield* readRecord(store, parts.internalId, [{
|
|
163
|
+
collection,
|
|
164
|
+
id: entry
|
|
165
|
+
}]);
|
|
166
|
+
const [found] = snapshot.results[1] ?? [];
|
|
167
|
+
if (record === void 0 || record.deleted === true || found === void 0) return void 0;
|
|
168
|
+
const row = yield* decodeRow(schema, found, `The ${what} '${entry}'`);
|
|
169
|
+
return row.state === "waiting" || row.state === "checking" || row.state === "held" ? row : void 0;
|
|
170
|
+
});
|
|
171
|
+
/**
|
|
152
172
|
* The repo, row and queue an entry's, candidate's or hold's ID names, once `caller` may do the
|
|
153
173
|
* operation on its repo. An ID whose repo the caller can't read is as one that names nothing.
|
|
154
174
|
*/
|
|
@@ -1308,4 +1328,4 @@ const holdsIn = (repo, fresh, ids, open) => ids.flatMap((id) => {
|
|
|
1308
1328
|
});
|
|
1309
1329
|
/** `queue-full` once a target holds `queueLimits.holds` open holds, its own and its keys'. */
|
|
1310
1330
|
const holdsLeft = (row) => openHolds(row).length >= queueLimits.holds ? queueFull("holds", queueLimits.holds) : Effect.void;
|
|
1311
|
-
export { addAdmitted, admitEntry, checkOwned, openCandidate, openEntry, openQueue, pinnedEvent, queueCalls, restartTarget };
|
|
1331
|
+
export { addAdmitted, admitEntry, checkOwned, entryAdderOf, openCandidate, openEntry, openQueue, pinnedEvent, queueCalls, restartTarget };
|