Skip to content

Commit aaf65cc

Browse files
committed
move transaction types into the runs replication service
1 parent 024c30a commit aaf65cc

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

apps/webapp/app/services/runsReplicationService.server.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import type { ClickHouse, RawTaskRunPayloadV1, TaskRunV1 } from "@internal/clickhouse";
22
import { RedisOptions } from "@internal/redis";
3-
import { LogicalReplicationClient, Transaction, type PgoutputMessage } from "@internal/replication";
3+
import {
4+
LogicalReplicationClient,
5+
type MessageDelete,
6+
type MessageInsert,
7+
type MessageUpdate,
8+
type PgoutputMessage,
9+
} from "@internal/replication";
410
import { Span, startSpan, trace, type Tracer } from "@internal/tracing";
511
import { Logger, LogLevel } from "@trigger.dev/core/logger";
612
import { tryCatch } from "@trigger.dev/core/utils";
@@ -10,6 +16,20 @@ import { nanoid } from "nanoid";
1016
import EventEmitter from "node:events";
1117
import pLimit from "p-limit";
1218

19+
interface TransactionEvent<T = any> {
20+
tag: "insert" | "update" | "delete";
21+
data: T;
22+
raw: MessageInsert | MessageUpdate | MessageDelete;
23+
}
24+
25+
interface Transaction<T = any> {
26+
commitLsn: string | null;
27+
commitEndLsn: string | null;
28+
xid: number;
29+
events: TransactionEvent<T>[];
30+
replicationLagMs: number;
31+
}
32+
1333
export type RunsReplicationServiceOptions = {
1434
clickhouse: ClickHouse;
1535
pgConnectionUrl: string;

0 commit comments

Comments
 (0)