@tenetkit/pg 0.28.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/README.md +3 -0
- package/dist/postgres/claims.d.ts +26 -0
- package/dist/postgres/claims.js +95 -0
- package/dist/postgres/event-stream.d.ts +20 -0
- package/dist/postgres/event-stream.js +16 -0
- package/dist/postgres/index.d.ts +3 -0
- package/dist/postgres/index.js +3 -0
- package/dist/postgres/locks.d.ts +18 -0
- package/dist/postgres/locks.js +51 -0
- package/dist/postgres/pg-helpers.d.ts +91 -0
- package/dist/postgres/pg-helpers.js +359 -0
- package/dist/postgres/run-schema.d.ts +23 -0
- package/dist/postgres/run-schema.js +92 -0
- package/dist/postgres/runtime-layer.d.ts +15 -0
- package/dist/postgres/runtime-layer.js +28 -0
- package/dist/postgres/schema.d.ts +6 -0
- package/dist/postgres/schema.js +274 -0
- package/dist/postgres/session-cancellation.d.ts +11 -0
- package/dist/postgres/session-cancellation.js +15 -0
- package/dist/postgres/session-storage.d.ts +32 -0
- package/dist/postgres/session-storage.js +63 -0
- package/dist/postgres/session-store.d.ts +24 -0
- package/dist/postgres/session-store.js +388 -0
- package/dist/postgres/store-admit.d.ts +21 -0
- package/dist/postgres/store-admit.js +87 -0
- package/dist/postgres/store-cancel.d.ts +14 -0
- package/dist/postgres/store-cancel.js +73 -0
- package/dist/postgres/store-claims.d.ts +17 -0
- package/dist/postgres/store-claims.js +72 -0
- package/dist/postgres/store-fan-out.d.ts +21 -0
- package/dist/postgres/store-fan-out.js +17 -0
- package/dist/postgres/store-inspection.d.ts +12 -0
- package/dist/postgres/store-inspection.js +44 -0
- package/dist/postgres/store-messaging.d.ts +14 -0
- package/dist/postgres/store-messaging.js +12 -0
- package/dist/postgres/store-model-response.d.ts +18 -0
- package/dist/postgres/store-model-response.js +156 -0
- package/dist/postgres/store-ops.d.ts +21 -0
- package/dist/postgres/store-ops.js +328 -0
- package/dist/postgres/store-program.d.ts +18 -0
- package/dist/postgres/store-program.js +36 -0
- package/dist/postgres/store-suspend.d.ts +13 -0
- package/dist/postgres/store-suspend.js +87 -0
- package/dist/postgres/store.d.ts +7 -0
- package/dist/postgres/store.js +373 -0
- package/dist/postgres/transaction-events.d.ts +15 -0
- package/dist/postgres/transaction-events.js +23 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Duration, Effect } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/unstable/sql";
|
|
3
|
+
import { StaleClaim } from "tenetkit/runtime/driver/sql/errors";
|
|
4
|
+
import type { ClaimedRun } from "tenetkit/runtime/driver/sql/run-claims";
|
|
5
|
+
export interface ClaimOptions {
|
|
6
|
+
readonly workerId: string;
|
|
7
|
+
readonly limit: number;
|
|
8
|
+
readonly lease: Duration.Input;
|
|
9
|
+
}
|
|
10
|
+
export declare const claimReadyRuns: (options: ClaimOptions) => Effect.Effect<ClaimedRun[], import("tenetkit/runtime/driver/errors").RuntimeUnavailable | import("effect/unstable/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
11
|
+
export declare const refreshLease: (input: {
|
|
12
|
+
readonly runId: string;
|
|
13
|
+
readonly workerId: string;
|
|
14
|
+
readonly attemptFence: number;
|
|
15
|
+
readonly lease: Duration.Input;
|
|
16
|
+
}) => Effect.Effect<boolean, import("effect/unstable/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
17
|
+
export declare const requireClaim: (input: {
|
|
18
|
+
readonly runId: string;
|
|
19
|
+
readonly workerId: string;
|
|
20
|
+
readonly attemptFence: number;
|
|
21
|
+
}) => Effect.Effect<import("tenetkit/runtime/driver/sql/rows").DecodedRun, import("tenetkit/runtime/driver/errors").RuntimeUnavailable | import("effect/unstable/sql/SqlError").SqlError | StaleClaim, SqlClient.SqlClient>;
|
|
22
|
+
export declare const releaseClaim: (input: {
|
|
23
|
+
readonly runId: string;
|
|
24
|
+
readonly workerId: string;
|
|
25
|
+
readonly attemptFence: number;
|
|
26
|
+
}) => Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Clock, DateTime, Duration, Effect } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/unstable/sql";
|
|
3
|
+
import { StaleClaim } from "tenetkit/runtime/driver/sql/errors";
|
|
4
|
+
import { decodeRunEffect, loadRun } from "tenetkit/runtime/driver/sql/store-helpers";
|
|
5
|
+
export const claimReadyRuns = (options) => Effect.gen(function* () {
|
|
6
|
+
const sql = yield* SqlClient.SqlClient;
|
|
7
|
+
const leaseMs = Duration.toMillis(options.lease);
|
|
8
|
+
const claimed = yield* sql `
|
|
9
|
+
WITH candidates AS (
|
|
10
|
+
SELECT r.run_id
|
|
11
|
+
FROM baton_runs r
|
|
12
|
+
WHERE r.status IN ('queued', 'running', 'cancelling')
|
|
13
|
+
AND r.cancellation_requested = FALSE
|
|
14
|
+
AND (
|
|
15
|
+
(r.parent_run_id IS NULL AND EXISTS (SELECT 1 FROM baton_lanes l WHERE l.head_run_id = r.run_id))
|
|
16
|
+
OR EXISTS (
|
|
17
|
+
SELECT 1 FROM baton_run_links link
|
|
18
|
+
WHERE link.child_run_id = r.run_id AND link.readiness = 'ready'
|
|
19
|
+
)
|
|
20
|
+
)
|
|
21
|
+
AND (
|
|
22
|
+
r.owner_worker_id IS NULL
|
|
23
|
+
OR r.lease_expires_at IS NULL
|
|
24
|
+
OR r.lease_expires_at < NOW()
|
|
25
|
+
)
|
|
26
|
+
ORDER BY r.accepted_sequence ASC
|
|
27
|
+
FOR UPDATE OF r SKIP LOCKED
|
|
28
|
+
LIMIT ${options.limit}
|
|
29
|
+
)
|
|
30
|
+
UPDATE baton_runs AS r
|
|
31
|
+
SET
|
|
32
|
+
owner_worker_id = ${options.workerId},
|
|
33
|
+
lease_expires_at = NOW() + (${leaseMs}::double precision * INTERVAL '1 millisecond'),
|
|
34
|
+
attempt_fence = r.attempt_fence + 1,
|
|
35
|
+
attempt = CASE
|
|
36
|
+
WHEN r.status = 'queued' THEN r.attempt + 1
|
|
37
|
+
ELSE r.attempt
|
|
38
|
+
END,
|
|
39
|
+
status = CASE
|
|
40
|
+
WHEN r.status = 'queued' THEN 'running'
|
|
41
|
+
ELSE r.status
|
|
42
|
+
END,
|
|
43
|
+
updated_at = NOW()
|
|
44
|
+
FROM candidates c
|
|
45
|
+
WHERE r.run_id = c.run_id
|
|
46
|
+
RETURNING r.*
|
|
47
|
+
`;
|
|
48
|
+
const out = [];
|
|
49
|
+
for (const row of claimed) {
|
|
50
|
+
const run = yield* decodeRunEffect(row);
|
|
51
|
+
out.push({
|
|
52
|
+
run,
|
|
53
|
+
workerId: options.workerId,
|
|
54
|
+
attemptFence: run.attemptFence,
|
|
55
|
+
leaseExpiresAt: DateTime.toDate(DateTime.makeUnsafe(run.leaseExpiresAt ?? (yield* Clock.currentTimeMillis))),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
});
|
|
60
|
+
export const refreshLease = (input) => Effect.gen(function* () {
|
|
61
|
+
const sql = yield* SqlClient.SqlClient;
|
|
62
|
+
const leaseMs = Duration.toMillis(input.lease);
|
|
63
|
+
const rows = yield* sql `
|
|
64
|
+
UPDATE baton_runs
|
|
65
|
+
SET
|
|
66
|
+
lease_expires_at = NOW() + (${leaseMs}::double precision * INTERVAL '1 millisecond'),
|
|
67
|
+
updated_at = NOW()
|
|
68
|
+
WHERE run_id = ${input.runId}
|
|
69
|
+
AND owner_worker_id = ${input.workerId}
|
|
70
|
+
AND attempt_fence = ${input.attemptFence}
|
|
71
|
+
AND cancellation_requested = FALSE
|
|
72
|
+
AND status NOT IN ('succeeded', 'failed', 'cancelled')
|
|
73
|
+
RETURNING run_id
|
|
74
|
+
`;
|
|
75
|
+
return rows.length > 0;
|
|
76
|
+
});
|
|
77
|
+
export const requireClaim = (input) => Effect.gen(function* () {
|
|
78
|
+
const run = yield* loadRun(input.runId);
|
|
79
|
+
if (run === undefined)
|
|
80
|
+
return yield* StaleClaim.make(input);
|
|
81
|
+
if (run.ownerWorkerId !== input.workerId || run.attemptFence !== input.attemptFence) {
|
|
82
|
+
return yield* StaleClaim.make(input);
|
|
83
|
+
}
|
|
84
|
+
return run;
|
|
85
|
+
});
|
|
86
|
+
export const releaseClaim = (input) => Effect.gen(function* () {
|
|
87
|
+
const sql = yield* SqlClient.SqlClient;
|
|
88
|
+
yield* sql `
|
|
89
|
+
UPDATE baton_runs
|
|
90
|
+
SET owner_worker_id = NULL, lease_expires_at = NULL, updated_at = NOW()
|
|
91
|
+
WHERE run_id = ${input.runId}
|
|
92
|
+
AND owner_worker_id = ${input.workerId}
|
|
93
|
+
AND attempt_fence = ${input.attemptFence}
|
|
94
|
+
`;
|
|
95
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Effect, Stream } from "effect";
|
|
2
|
+
import type { PgClient } from "@effect/sql-pg";
|
|
3
|
+
import type { Cursor } from "tenetkit/runtime/driver/cursor";
|
|
4
|
+
import type { CursorExpired, RunNotFound, RuntimeUnavailable, SubscriberLagged } from "tenetkit/runtime/driver/errors";
|
|
5
|
+
import type { RunEvent } from "tenetkit/runtime/driver/run-event";
|
|
6
|
+
import type { EventHub } from "tenetkit/runtime/driver/sql/subscribers";
|
|
7
|
+
type EventsError = CursorExpired | RunNotFound | RuntimeUnavailable | SubscriberLagged;
|
|
8
|
+
export declare const makeEventStream: (input: {
|
|
9
|
+
readonly hub: EventHub;
|
|
10
|
+
readonly pg: PgClient.PgClient;
|
|
11
|
+
readonly runId: string;
|
|
12
|
+
readonly cursor: Cursor;
|
|
13
|
+
readonly capacity: number;
|
|
14
|
+
readonly loadReplay: Effect.Effect<{
|
|
15
|
+
readonly replay: ReadonlyArray<RunEvent>;
|
|
16
|
+
readonly lastSequence: number;
|
|
17
|
+
}, RunNotFound | RuntimeUnavailable>;
|
|
18
|
+
readonly loadAfter: (cursor: Cursor) => Effect.Effect<ReadonlyArray<RunEvent>, RunNotFound | RuntimeUnavailable>;
|
|
19
|
+
}) => Stream.Stream<RunEvent, EventsError>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Effect, Schedule, Stream, SynchronizedRef } from "effect";
|
|
2
|
+
import { NOTIFY_CHANNEL } from "./schema.js";
|
|
3
|
+
export const makeEventStream = (input) => Stream.unwrap(Effect.gen(function* () {
|
|
4
|
+
const cursor = yield* SynchronizedRef.make(input.cursor);
|
|
5
|
+
const catchUp = SynchronizedRef.modifyEffect(cursor, (current) => input.loadAfter(current).pipe(Effect.flatMap((events) => Effect.forEach(events, (event) => input.hub.publish(input.runId, event)).pipe(Effect.as(events.at(-1)?.sequence ?? current))), Effect.map((last) => [last, last]))).pipe(Effect.ignore);
|
|
6
|
+
return input.hub.subscribe({
|
|
7
|
+
runId: input.runId,
|
|
8
|
+
cursor: input.cursor,
|
|
9
|
+
loadReplay: input.loadReplay.pipe(Effect.tap(({ lastSequence }) => SynchronizedRef.set(cursor, lastSequence))),
|
|
10
|
+
capacity: input.capacity,
|
|
11
|
+
onSubscribed: Effect.gen(function* () {
|
|
12
|
+
yield* Effect.forkScoped(catchUp.pipe(Effect.repeat(Schedule.spaced("1 second")), Effect.ignore));
|
|
13
|
+
yield* input.pg.listen(NOTIFY_CHANNEL).pipe(Stream.runForEach((payload) => (payload !== input.runId ? Effect.void : catchUp)), Effect.ignore);
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/unstable/sql";
|
|
3
|
+
import { RunNotFound, RunTerminal } from "tenetkit/runtime/driver/errors";
|
|
4
|
+
/**
|
|
5
|
+
* One Run-level lock serializing admission, steering, response, resume, timeout,
|
|
6
|
+
* cancellation, and terminal settlement. Always taken advisory-first, then row,
|
|
7
|
+
* so every writer acquires them in the same order.
|
|
8
|
+
*/
|
|
9
|
+
export declare const lockRun: (runId: string) => Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
10
|
+
export declare const lockRunHierarchy: (runId: string) => Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
11
|
+
/**
|
|
12
|
+
* One mailbox-level lock serializing admission into one target session's inbox.
|
|
13
|
+
*
|
|
14
|
+
* A mailbox entry takes the next sequence for its target, so concurrent senders must be serialized
|
|
15
|
+
* on the target rather than on any one sender's Run.
|
|
16
|
+
*/
|
|
17
|
+
export declare const lockMailbox: (targetSessionId: string) => Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
18
|
+
export declare const lockSpawnParent: (runId: string) => Effect.Effect<import("tenetkit/runtime/driver/sql/rows").DecodedRun, RunNotFound | RunTerminal | import("tenetkit/runtime/driver/errors").RuntimeUnavailable | import("effect/unstable/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/unstable/sql";
|
|
3
|
+
import { RunNotFound, RunTerminal } from "tenetkit/runtime/driver/errors";
|
|
4
|
+
import { isTerminal } from "tenetkit/runtime/driver/run";
|
|
5
|
+
import { loadRun } from "./pg-helpers.js";
|
|
6
|
+
/**
|
|
7
|
+
* One Run-level lock serializing admission, steering, response, resume, timeout,
|
|
8
|
+
* cancellation, and terminal settlement. Always taken advisory-first, then row,
|
|
9
|
+
* so every writer acquires them in the same order.
|
|
10
|
+
*/
|
|
11
|
+
export const lockRun = (runId) => Effect.gen(function* () {
|
|
12
|
+
const sql = yield* SqlClient.SqlClient;
|
|
13
|
+
yield* sql `SELECT pg_advisory_xact_lock(hashtext(${`run:${runId}`}))`;
|
|
14
|
+
yield* sql `SELECT run_id FROM baton_runs WHERE run_id = ${runId} FOR UPDATE`;
|
|
15
|
+
});
|
|
16
|
+
export const lockRunHierarchy = (runId) => Effect.gen(function* () {
|
|
17
|
+
const sql = yield* SqlClient.SqlClient;
|
|
18
|
+
const hierarchy = [runId];
|
|
19
|
+
let current = runId;
|
|
20
|
+
while (true) {
|
|
21
|
+
const row = (yield* sql `
|
|
22
|
+
SELECT parent_run_id FROM baton_runs WHERE run_id = ${current}
|
|
23
|
+
`)[0];
|
|
24
|
+
if (row?.parent_run_id === null || row?.parent_run_id === undefined)
|
|
25
|
+
break;
|
|
26
|
+
hierarchy.push(row.parent_run_id);
|
|
27
|
+
current = row.parent_run_id;
|
|
28
|
+
}
|
|
29
|
+
for (const id of hierarchy.reverse())
|
|
30
|
+
yield* lockRun(id);
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* One mailbox-level lock serializing admission into one target session's inbox.
|
|
34
|
+
*
|
|
35
|
+
* A mailbox entry takes the next sequence for its target, so concurrent senders must be serialized
|
|
36
|
+
* on the target rather than on any one sender's Run.
|
|
37
|
+
*/
|
|
38
|
+
export const lockMailbox = (targetSessionId) => Effect.gen(function* () {
|
|
39
|
+
const sql = yield* SqlClient.SqlClient;
|
|
40
|
+
yield* sql `SELECT pg_advisory_xact_lock(hashtext(${`mailbox:${targetSessionId}`}))`;
|
|
41
|
+
}).pipe(Effect.asVoid);
|
|
42
|
+
export const lockSpawnParent = (runId) => Effect.gen(function* () {
|
|
43
|
+
const sql = yield* SqlClient.SqlClient;
|
|
44
|
+
yield* sql `SELECT run_id FROM baton_runs WHERE run_id = ${runId} FOR UPDATE`;
|
|
45
|
+
const parent = yield* loadRun(runId);
|
|
46
|
+
if (parent === undefined)
|
|
47
|
+
return yield* RunNotFound.make({ runId });
|
|
48
|
+
if (isTerminal(parent.status))
|
|
49
|
+
return yield* RunTerminal.make({ runId, status: parent.status });
|
|
50
|
+
return parent;
|
|
51
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/unstable/sql";
|
|
3
|
+
import type { SqlError } from "effect/unstable/sql/SqlError";
|
|
4
|
+
import { PgClient } from "@effect/sql-pg";
|
|
5
|
+
import { type RunEvent } from "tenetkit/runtime/driver/run-event";
|
|
6
|
+
import type { ExecutableManifest, ExecutableRef } from "tenetkit/runtime/driver/executable-manifest";
|
|
7
|
+
import type { Message } from "tenetkit/runtime/driver/message";
|
|
8
|
+
import { type RunStatus } from "tenetkit/runtime/driver/run";
|
|
9
|
+
import { decodeMessage, decodeQueue, encodeQueue } from "tenetkit/runtime/driver/sql/codecs";
|
|
10
|
+
import type { EventHub } from "tenetkit/runtime/driver/sql/subscribers";
|
|
11
|
+
import type { DecodedRun } from "tenetkit/runtime/driver/sql/rows";
|
|
12
|
+
import type { EmittableAgentLoopEvent } from "tenetkit/runtime/driver/agent-event";
|
|
13
|
+
import { type ExecutionClaim } from "tenetkit/runtime/driver/run-store";
|
|
14
|
+
import type { ExecutionResult } from "tenetkit/runtime/driver/execution-state";
|
|
15
|
+
import { RunNotFound, RunTerminal, RuntimeUnavailable } from "tenetkit/runtime/driver/errors";
|
|
16
|
+
import { StaleClaim } from "tenetkit/runtime/driver/sql/errors";
|
|
17
|
+
type StoreError = RuntimeUnavailable | SqlError;
|
|
18
|
+
type StoreEffect<A> = Effect.Effect<A, StoreError, SqlClient.SqlClient>;
|
|
19
|
+
type SqlOnlyEffect<A> = Effect.Effect<A, SqlError, SqlClient.SqlClient>;
|
|
20
|
+
type RunEventEffect = Effect.Effect<RunEvent, RuntimeUnavailable | SqlError, SqlClient.SqlClient>;
|
|
21
|
+
type LaneEffect = Effect.Effect<{
|
|
22
|
+
acceptedSequence: number;
|
|
23
|
+
isHead: boolean;
|
|
24
|
+
}, SqlError, SqlClient.SqlClient>;
|
|
25
|
+
type AgentEventError = RunNotFound | RunTerminal | StoreError | StaleClaim;
|
|
26
|
+
type AgentEventEffect = Effect.Effect<undefined, AgentEventError, SqlClient.SqlClient>;
|
|
27
|
+
type CompleteRunEffect = Effect.Effect<undefined, RunTerminal | StoreError, SqlClient.SqlClient>;
|
|
28
|
+
type SettleParentEffect = Effect.Effect<void, StoreError, SqlClient.SqlClient | PgClient.PgClient>;
|
|
29
|
+
export type EventPartial = {
|
|
30
|
+
readonly _tag: string;
|
|
31
|
+
} & Record<string, unknown>;
|
|
32
|
+
export declare const loadRun: (runId: string) => Effect.Effect<DecodedRun | undefined, RuntimeUnavailable | SqlError, SqlClient.SqlClient>;
|
|
33
|
+
export declare const requireRun: (runId: string) => Effect.Effect<DecodedRun, RunNotFound | RuntimeUnavailable | SqlError, SqlClient.SqlClient>;
|
|
34
|
+
export declare const emitAgentEvent: {
|
|
35
|
+
(input: ExecutionClaim & {
|
|
36
|
+
readonly event: EmittableAgentLoopEvent;
|
|
37
|
+
}): (hub: EventHub) => AgentEventEffect;
|
|
38
|
+
(hub: EventHub, input: ExecutionClaim & {
|
|
39
|
+
readonly event: EmittableAgentLoopEvent;
|
|
40
|
+
}): AgentEventEffect;
|
|
41
|
+
};
|
|
42
|
+
export declare const loadEventsAfter: {
|
|
43
|
+
(cursor: number): (runId: string) => StoreEffect<RunEvent[]>;
|
|
44
|
+
(runId: string, cursor: number): StoreEffect<RunEvent[]>;
|
|
45
|
+
};
|
|
46
|
+
export declare const allocateSequence: (runId: string) => Effect.Effect<number, SqlError, SqlClient.SqlClient>;
|
|
47
|
+
export declare const appendEvent: {
|
|
48
|
+
(run: DecodedRun, partial: EventPartial, nextStatus?: RunStatus): (hub: EventHub) => RunEventEffect;
|
|
49
|
+
(hub: EventHub, run: DecodedRun, partial: EventPartial, nextStatus?: RunStatus): RunEventEffect;
|
|
50
|
+
};
|
|
51
|
+
export declare const promoteHead: {
|
|
52
|
+
(address: string, sessionId: string): (hub: EventHub) => StoreEffect<void>;
|
|
53
|
+
(hub: EventHub, address: string, sessionId: string): StoreEffect<void>;
|
|
54
|
+
};
|
|
55
|
+
export declare const removeFromLane: {
|
|
56
|
+
(sessionId: string, runId: string): (address: string) => SqlOnlyEffect<void>;
|
|
57
|
+
(address: string, sessionId: string, runId: string): SqlOnlyEffect<void>;
|
|
58
|
+
};
|
|
59
|
+
export declare const afterTerminal: {
|
|
60
|
+
(run: DecodedRun): (hub: EventHub) => StoreEffect<void>;
|
|
61
|
+
(hub: EventHub, run: DecodedRun): StoreEffect<void>;
|
|
62
|
+
};
|
|
63
|
+
export declare const completeRun: {
|
|
64
|
+
(run: DecodedRun, result: ExecutionResult): (hub: EventHub) => CompleteRunEffect;
|
|
65
|
+
(hub: EventHub, run: DecodedRun, result: ExecutionResult): CompleteRunEffect;
|
|
66
|
+
};
|
|
67
|
+
export declare const settleParent: {
|
|
68
|
+
(child: DecodedRun, terminalEventId: string): (hub: EventHub) => SettleParentEffect;
|
|
69
|
+
(hub: EventHub, child: DecodedRun, terminalEventId: string): SettleParentEffect;
|
|
70
|
+
};
|
|
71
|
+
export declare const insertRun: (input: {
|
|
72
|
+
readonly runId: string;
|
|
73
|
+
readonly status: RunStatus;
|
|
74
|
+
readonly message: Message;
|
|
75
|
+
readonly digest: string;
|
|
76
|
+
readonly executableRef: ExecutableRef;
|
|
77
|
+
readonly executableManifest: ExecutableManifest;
|
|
78
|
+
readonly rootRunId: string;
|
|
79
|
+
readonly depth: number;
|
|
80
|
+
readonly treePolicy: import("tenetkit/runtime/driver/tree-policy").TreePolicy;
|
|
81
|
+
readonly parentRunId?: string;
|
|
82
|
+
readonly invocationId?: string;
|
|
83
|
+
readonly acceptedSequence: number;
|
|
84
|
+
readonly attempt?: number;
|
|
85
|
+
}) => Effect.Effect<void, SqlError, SqlClient.SqlClient>;
|
|
86
|
+
export declare const enqueueLane: {
|
|
87
|
+
(sessionId: string, runId: string): (address: string) => LaneEffect;
|
|
88
|
+
(address: string, sessionId: string, runId: string): LaneEffect;
|
|
89
|
+
};
|
|
90
|
+
export { toOperationRecord } from "tenetkit/runtime/driver/sql/operations";
|
|
91
|
+
export { decodeMessage, encodeQueue, decodeQueue };
|