@supalive/core 1.16.0 → 1.18.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/index-B2nE1y9E.d.ts +2384 -0
- package/dist/index-B2nE1y9E.d.ts.map +1 -0
- package/dist/index-B3i2G1gr.d.ts +2402 -0
- package/dist/index-B3i2G1gr.d.ts.map +1 -0
- package/dist/index-B5hAqW3O.d.ts +2402 -0
- package/dist/index-B5hAqW3O.d.ts.map +1 -0
- package/dist/index-BHs0EtJk.d.ts +2402 -0
- package/dist/index-BHs0EtJk.d.ts.map +1 -0
- package/dist/index-BI3MfAyI.d.ts +2399 -0
- package/dist/index-BI3MfAyI.d.ts.map +1 -0
- package/dist/index-BL90lDw7.d.ts +2400 -0
- package/dist/index-BL90lDw7.d.ts.map +1 -0
- package/dist/index-BMz7jVbX.d.ts +2402 -0
- package/dist/index-BMz7jVbX.d.ts.map +1 -0
- package/dist/index-BvryqYUm.d.ts +2394 -0
- package/dist/index-BvryqYUm.d.ts.map +1 -0
- package/dist/index-CjkNEwSc.d.ts +2402 -0
- package/dist/index-CjkNEwSc.d.ts.map +1 -0
- package/dist/index-Cng74DL5.d.ts +2404 -0
- package/dist/index-Cng74DL5.d.ts.map +1 -0
- package/dist/index-DYkOBnw_.d.ts +2378 -0
- package/dist/index-DYkOBnw_.d.ts.map +1 -0
- package/dist/index-DcM2uKpT.d.ts +2393 -0
- package/dist/index-DcM2uKpT.d.ts.map +1 -0
- package/dist/index-DsvdhOKL.d.ts +2400 -0
- package/dist/index-DsvdhOKL.d.ts.map +1 -0
- package/dist/index-yXV5AMh9.d.ts +2416 -0
- package/dist/index-yXV5AMh9.d.ts.map +1 -0
- package/dist/mysql-1ENHI0yX.d.ts +114 -0
- package/dist/mysql-1ENHI0yX.d.ts.map +1 -0
- package/dist/mysql-BJaQhVGE.d.ts +114 -0
- package/dist/mysql-BJaQhVGE.d.ts.map +1 -0
- package/dist/mysql-BKs5PTSR.d.ts +114 -0
- package/dist/mysql-BKs5PTSR.d.ts.map +1 -0
- package/dist/mysql-C6jg1Vpr.d.ts +114 -0
- package/dist/mysql-C6jg1Vpr.d.ts.map +1 -0
- package/dist/mysql-C7Km_lgc.d.ts +114 -0
- package/dist/mysql-C7Km_lgc.d.ts.map +1 -0
- package/dist/mysql-Cxro4f6T.d.ts +114 -0
- package/dist/mysql-Cxro4f6T.d.ts.map +1 -0
- package/dist/mysql-DKR33wfH.d.ts +114 -0
- package/dist/mysql-DKR33wfH.d.ts.map +1 -0
- package/dist/mysql-DNiYIZCK.d.ts +114 -0
- package/dist/mysql-DNiYIZCK.d.ts.map +1 -0
- package/dist/mysql-DS1s1c5M.d.ts +114 -0
- package/dist/mysql-DS1s1c5M.d.ts.map +1 -0
- package/dist/mysql-DcHgRk9f.d.ts +114 -0
- package/dist/mysql-DcHgRk9f.d.ts.map +1 -0
- package/dist/mysql-DnrIJoWL.d.ts +114 -0
- package/dist/mysql-DnrIJoWL.d.ts.map +1 -0
- package/dist/mysql-GsWYd6fG.d.ts +114 -0
- package/dist/mysql-GsWYd6fG.d.ts.map +1 -0
- package/dist/mysql-qTszEKAU.d.ts +114 -0
- package/dist/mysql-qTszEKAU.d.ts.map +1 -0
- package/dist/mysql-qW13LcGQ.d.ts +114 -0
- package/dist/mysql-qW13LcGQ.d.ts.map +1 -0
- package/dist/postgres-B0fqJe1X.d.ts +118 -0
- package/dist/postgres-B0fqJe1X.d.ts.map +1 -0
- package/dist/postgres-BATDLPml.d.ts +118 -0
- package/dist/postgres-BATDLPml.d.ts.map +1 -0
- package/dist/postgres-BUVYjnaT.d.ts +118 -0
- package/dist/postgres-BUVYjnaT.d.ts.map +1 -0
- package/dist/postgres-Bk_8PFRT.d.ts +118 -0
- package/dist/postgres-Bk_8PFRT.d.ts.map +1 -0
- package/dist/postgres-Bx79_JEy.d.ts +118 -0
- package/dist/postgres-Bx79_JEy.d.ts.map +1 -0
- package/dist/postgres-C3w741VH.d.ts +118 -0
- package/dist/postgres-C3w741VH.d.ts.map +1 -0
- package/dist/postgres-CAZYYgbZ.d.ts +118 -0
- package/dist/postgres-CAZYYgbZ.d.ts.map +1 -0
- package/dist/postgres-CFarR3cB.d.ts +118 -0
- package/dist/postgres-CFarR3cB.d.ts.map +1 -0
- package/dist/postgres-CWVM-KKP.d.ts +118 -0
- package/dist/postgres-CWVM-KKP.d.ts.map +1 -0
- package/dist/postgres-D50xpaQ-.d.ts +118 -0
- package/dist/postgres-D50xpaQ-.d.ts.map +1 -0
- package/dist/postgres-bhVzeRf2.d.ts +118 -0
- package/dist/postgres-bhVzeRf2.d.ts.map +1 -0
- package/dist/postgres-tVdgYJkj.d.ts +118 -0
- package/dist/postgres-tVdgYJkj.d.ts.map +1 -0
- package/dist/postgres-yAn2CF7j.d.ts +118 -0
- package/dist/postgres-yAn2CF7j.d.ts.map +1 -0
- package/dist/postgres-yTjQ-Nxk.d.ts +118 -0
- package/dist/postgres-yTjQ-Nxk.d.ts.map +1 -0
- package/dist/router-Bk0eLfmB.js +285 -0
- package/dist/router-Bk0eLfmB.js.map +1 -0
- package/dist/router-DP2ThAwh.js.map +1 -1
- package/dist/src/client/index.d.ts +2 -2
- package/dist/src/client/index.js +18 -5
- package/dist/src/client/index.js.map +1 -1
- package/dist/src/exports/mysql.d.ts +1 -1
- package/dist/src/exports/postgres.d.ts +1 -1
- package/dist/src/exports/procedure.d.ts +1 -1
- package/dist/src/exports/schema-sql.d.ts +1 -1
- package/dist/src/exports/server.d.ts +11 -7
- package/dist/src/exports/server.d.ts.map +1 -1
- package/dist/src/exports/server.js +34 -15
- package/dist/src/exports/server.js.map +1 -1
- package/dist/src/exports/sub-manager-worker-entry.js +1 -1
- package/dist/src/exports/types.d.ts +3 -3
- package/dist/src/exports/types.js +1 -1
- package/dist/sub-worker-dispatch-Cvqarej5.js +826 -0
- package/dist/sub-worker-dispatch-Cvqarej5.js.map +1 -0
- package/dist/sub-worker-dispatch-D-3VPkd4.js +826 -0
- package/dist/sub-worker-dispatch-D-3VPkd4.js.map +1 -0
- package/dist/sub-worker-dispatch-qiSs5Xkm.js.map +1 -1
- package/dist/types_client_rpc-B8jh6MKl.js +154 -0
- package/dist/types_client_rpc-B8jh6MKl.js.map +1 -0
- package/dist/types_client_rpc-BRCAgeyJ.js +155 -0
- package/dist/types_client_rpc-BRCAgeyJ.js.map +1 -0
- package/dist/types_server-AXVa_2mF.d.ts +684 -0
- package/dist/types_server-AXVa_2mF.d.ts.map +1 -0
- package/dist/types_server-B5KQ6PAO.d.ts +692 -0
- package/dist/types_server-B5KQ6PAO.d.ts.map +1 -0
- package/dist/types_server-BJBeSk6n.d.ts +691 -0
- package/dist/types_server-BJBeSk6n.d.ts.map +1 -0
- package/dist/types_server-BXeiSmd8.d.ts +691 -0
- package/dist/types_server-BXeiSmd8.d.ts.map +1 -0
- package/dist/types_server-BnRmctWG.d.ts +699 -0
- package/dist/types_server-BnRmctWG.d.ts.map +1 -0
- package/dist/types_server-C20ibVGu.d.ts +692 -0
- package/dist/types_server-C20ibVGu.d.ts.map +1 -0
- package/dist/types_server-CUPM08l2.d.ts +684 -0
- package/dist/types_server-CUPM08l2.d.ts.map +1 -0
- package/dist/types_server-CjjJIQps.d.ts +691 -0
- package/dist/types_server-CjjJIQps.d.ts.map +1 -0
- package/dist/types_server-CjzRPllt.d.ts +691 -0
- package/dist/types_server-CjzRPllt.d.ts.map +1 -0
- package/dist/types_server-CtYRmHdO.d.ts +684 -0
- package/dist/types_server-CtYRmHdO.d.ts.map +1 -0
- package/dist/types_server-Cy4bvdeN.d.ts +691 -0
- package/dist/types_server-Cy4bvdeN.d.ts.map +1 -0
- package/dist/types_server-DHRi8bGO.d.ts +684 -0
- package/dist/types_server-DHRi8bGO.d.ts.map +1 -0
- package/dist/types_server-DoeybfmY.d.ts +684 -0
- package/dist/types_server-DoeybfmY.d.ts.map +1 -0
- package/dist/types_server-JK14NE0j.d.ts +684 -0
- package/dist/types_server-JK14NE0j.d.ts.map +1 -0
- package/dist/types_server-hYv2--1M.d.ts +684 -0
- package/dist/types_server-hYv2--1M.d.ts.map +1 -0
- package/dist/types_server-kkQJDSjA.d.ts +684 -0
- package/dist/types_server-kkQJDSjA.d.ts.map +1 -0
- package/package.json +1 -2
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { $n as SqlBuilder, $r as ReadEntry, Gn as CoreInitLockCtx, Jn as DbType, Kn as Database, Sr as CommitLogEntry, Xn as PooledClient, Yn as LazyCommitTsParam, Zn as PreparedQueries, er as TxDatabase, ni as WriteEntry, qn as DbQueryResult, tr as CacheLayer } from "./index-DcM2uKpT.js";
|
|
2
|
+
import { Pool, PoolConfig } from "pg";
|
|
3
|
+
import { Logger } from "pino";
|
|
4
|
+
|
|
5
|
+
//#region src/db/postgres.d.ts
|
|
6
|
+
declare class PgDatabase implements Database {
|
|
7
|
+
constructor(logger: Logger, config: PoolConfig, pool?: Pool | undefined);
|
|
8
|
+
private logger;
|
|
9
|
+
config: PoolConfig;
|
|
10
|
+
private pool;
|
|
11
|
+
readonly sqlBuilder: SqlBuilder;
|
|
12
|
+
readonly dbType: DbType;
|
|
13
|
+
columnTypes: Map<string, Map<string, string>>;
|
|
14
|
+
protected sqlCache: Map<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches actual column types from Postgres for `table` and returns a
|
|
17
|
+
* map of DB column name → PG type string (as produced by `format_type`,
|
|
18
|
+
* e.g. `bigint`, `integer`, `character varying(32)`, `text[]`, `jsonb`).
|
|
19
|
+
* No caching here — see {@link getColumnTypes} for the cached path.
|
|
20
|
+
*/
|
|
21
|
+
loadColumnTypesFromPg(table: string): Promise<Map<string, string>>;
|
|
22
|
+
/**
|
|
23
|
+
* Synchronous column-type lookup. The apply path calls this on every
|
|
24
|
+
* batched write, so it can't await — populate the cache via
|
|
25
|
+
* {@link bootstrapColumnTypes} at server start. Throws if `table` is
|
|
26
|
+
* missing (programmer error / bootstrap skipped).
|
|
27
|
+
*/
|
|
28
|
+
getColumnTypes(table: string): Map<string, string> | null;
|
|
29
|
+
/**
|
|
30
|
+
* Eagerly load column types into the in-memory cache. With a Redis
|
|
31
|
+
* client supplied, attempts the cache key first and falls through to
|
|
32
|
+
* Postgres on miss (writing the result back to Redis). This is the
|
|
33
|
+
* "one server queries PG, the rest read from Redis" pattern for cold
|
|
34
|
+
* starts in a multi-instance deploy. Without Redis, always queries PG.
|
|
35
|
+
*
|
|
36
|
+
* Pass `tables` to limit the load to a specific list; otherwise every
|
|
37
|
+
* user table in the connected database is loaded.
|
|
38
|
+
*
|
|
39
|
+
* The Redis cache key should encode whatever invalidates types in your
|
|
40
|
+
* environment (typically a schema version / deploy version). The
|
|
41
|
+
* subscriber in supalive-server.ts is expected to publish a reload
|
|
42
|
+
* signal after migrations and invoke {@link invalidateColumnTypes}.
|
|
43
|
+
*/
|
|
44
|
+
bootstrapColumnTypes(opts: {
|
|
45
|
+
redis?: CacheLayer;
|
|
46
|
+
cacheKey: string;
|
|
47
|
+
tables?: string[];
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Invalidate cached types (and dependent SQL) for `table`, or the entire
|
|
51
|
+
* cache if `table` is omitted. The Redis-pubsub reload signal in
|
|
52
|
+
* supalive-server.ts is expected to call this on schema changes.
|
|
53
|
+
*/
|
|
54
|
+
private invalidateColumnTypes;
|
|
55
|
+
/** Enumerate the user-defined tables in the connected database — used
|
|
56
|
+
* by bootstrapColumnTypes() when no explicit list is provided. */
|
|
57
|
+
private listUserTables;
|
|
58
|
+
getCoreVersion(): Promise<bigint>;
|
|
59
|
+
getAppMigration(): Promise<bigint>;
|
|
60
|
+
coreMigrationStatements(toVersion: bigint): string[];
|
|
61
|
+
withCoreInitLock(fn: (ctx: CoreInitLockCtx) => Promise<void>): Promise<void>;
|
|
62
|
+
query<T = any>(sql: string, params?: unknown[]): Promise<DbQueryResult<T>>;
|
|
63
|
+
getClient(): Promise<PooledClient>;
|
|
64
|
+
getTransactionClient(): Promise<TxDatabase>;
|
|
65
|
+
/** Internal: replace this instance's caches with shared references from
|
|
66
|
+
* a parent. Used by PgDatabase.getTransactionClient. */
|
|
67
|
+
adoptCaches(columnTypes: Map<string, Map<string, string>>, sqlCache: Map<string, string>): void;
|
|
68
|
+
getLatestSnapshotTimestamp(): Promise<bigint>;
|
|
69
|
+
updateLatestSnapshotTimestamp(commitTs: bigint): Promise<void>;
|
|
70
|
+
getMinSnapshotTimestamp(): Promise<bigint>;
|
|
71
|
+
updateMinSnapshotTimestamp(ts: bigint): Promise<void>;
|
|
72
|
+
getNextTimestamp(): Promise<bigint>;
|
|
73
|
+
attachPrevDataToWriteSet(writeSet: WriteEntry[], readSet: ReadEntry[]): Promise<void>;
|
|
74
|
+
prepareCommitWrites(readSet: ReadEntry[], writeSet: WriteEntry[], commitTs: LazyCommitTsParam): Promise<PreparedQueries>;
|
|
75
|
+
private pgPrepareBatchWrites;
|
|
76
|
+
private pgPrepareInsertSingle;
|
|
77
|
+
private pgPrepareInsertBatch;
|
|
78
|
+
private pgPrepareUpdateSingle;
|
|
79
|
+
private pgPrepareUpdateBatch;
|
|
80
|
+
private pgPrepareDeleteSingle;
|
|
81
|
+
private pgPrepareDeleteBatch;
|
|
82
|
+
private buildOrGetInsertSql;
|
|
83
|
+
private buildOrGetUpdateSql;
|
|
84
|
+
private buildOrGetDeleteSql;
|
|
85
|
+
private pgPrepareCommitLogs;
|
|
86
|
+
/**
|
|
87
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
88
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
89
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
90
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
91
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
92
|
+
*/
|
|
93
|
+
private pgPrepareValidatePointReadsByCommitTs;
|
|
94
|
+
commitWrites(beginTs: bigint, queries: PreparedQueries, commitTs: bigint): Promise<{
|
|
95
|
+
success: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
private pgApplyWrites;
|
|
98
|
+
/**
|
|
99
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
100
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
101
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
102
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
103
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
104
|
+
*/
|
|
105
|
+
private validatePointReadsByCommitTs;
|
|
106
|
+
pruneCommitLogsBefore(ts: bigint): Promise<bigint>;
|
|
107
|
+
getMinCommitLogTs(): Promise<bigint | null>;
|
|
108
|
+
getCommitLogsBetweenTs(beginTs: bigint, endTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
109
|
+
hasCommitForPoints(beginTs: bigint, endTs: bigint, points: {
|
|
110
|
+
tableId: Uint8Array;
|
|
111
|
+
id: Uint8Array;
|
|
112
|
+
}[]): Promise<boolean>;
|
|
113
|
+
getCommitLogsSinceTs(sinceTs: bigint, excludeTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
114
|
+
close(): Promise<void>;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { PgDatabase as t };
|
|
118
|
+
//# sourceMappingURL=postgres-C3w741VH.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-C3w741VH.d.ts","names":[],"sources":["../src/db/postgres.ts"],"mappings":";;;;;cAiBa,UAAA,YAAsB,QAAA;cAE/B,MAAA,EAAQ,MAAA,EACR,MAAA,EAAQ,UAAA,EACR,IAAA,GAAM,IAAA;EAAA,QAWA,MAAA;EACD,MAAA,EAAQ,UAAA;EAAA,QACP,IAAA;EAAA,SACC,UAAA,EAAY,UAAA;EAAA,SACZ,MAAA,EAAQ,MAAA;EAMV,WAAA,EAAa,GAAA,SAAY,GAAA;EAAA,UAGtB,QAAA,EAAU,GAAA;EAHY;;;;;;EAW1B,qBAAA,C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QAcM,mBAAA;EA9rBkB;;;;;;;EAAA,QA4uBxB,qCAAA;EAkDF,YAAA,CACJ,OAAA,UACA,OAAA,EAAS,eAAA,EACT,QAAA,WACC,OAAA;IAAU,OAAA;EAAA;EAAA,QAqCC,aAAA;EA3wBJ;;;;;;;EAAA,QAs3BI,4BAAA;EA0CR,qBAAA,CAAsB,EAAA,WAAa,OAAA;EAQnC,iBAAA,IAAqB,OAAA;EAQrB,sBAAA,CAAuB,OAAA,UAAiB,KAAA,UAAe,QAAA,EAAU,UAAA,KAAe,OAAA,CAAQ,cAAA;EAmBxF,kBAAA,CACJ,OAAA,UACA,KAAA,UACA,MAAA;IAAU,OAAA,EAAS,UAAA;IAAY,EAAA,EAAI,UAAA;EAAA,MAClC,OAAA;EAsBG,oBAAA,CAAqB,OAAA,UAAiB,SAAA,UAAmB,QAAA,EAAU,UAAA,KAAe,OAAA,CAAQ,cAAA;EAmB1F,KAAA,IAAS,OAAA;AAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Cr as CommitLogEntry, Jn as DbQueryResult, Kn as CoreInitLockCtx, Qn as PreparedQueries, Xn as LazyCommitTsParam, Yn as DbType, Zn as PooledClient, ei as ReadEntry, er as SqlBuilder, nr as CacheLayer, qn as Database, ri as WriteEntry, tr as TxDatabase } from "./index-DsvdhOKL.js";
|
|
2
|
+
import { Pool, PoolConfig } from "pg";
|
|
3
|
+
import { Logger } from "pino";
|
|
4
|
+
|
|
5
|
+
//#region src/db/postgres.d.ts
|
|
6
|
+
declare class PgDatabase implements Database {
|
|
7
|
+
constructor(logger: Logger, config: PoolConfig, pool?: Pool | undefined);
|
|
8
|
+
private logger;
|
|
9
|
+
config: PoolConfig;
|
|
10
|
+
private pool;
|
|
11
|
+
readonly sqlBuilder: SqlBuilder;
|
|
12
|
+
readonly dbType: DbType;
|
|
13
|
+
columnTypes: Map<string, Map<string, string>>;
|
|
14
|
+
protected sqlCache: Map<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches actual column types from Postgres for `table` and returns a
|
|
17
|
+
* map of DB column name → PG type string (as produced by `format_type`,
|
|
18
|
+
* e.g. `bigint`, `integer`, `character varying(32)`, `text[]`, `jsonb`).
|
|
19
|
+
* No caching here — see {@link getColumnTypes} for the cached path.
|
|
20
|
+
*/
|
|
21
|
+
loadColumnTypesFromPg(table: string): Promise<Map<string, string>>;
|
|
22
|
+
/**
|
|
23
|
+
* Synchronous column-type lookup. The apply path calls this on every
|
|
24
|
+
* batched write, so it can't await — populate the cache via
|
|
25
|
+
* {@link bootstrapColumnTypes} at server start. Throws if `table` is
|
|
26
|
+
* missing (programmer error / bootstrap skipped).
|
|
27
|
+
*/
|
|
28
|
+
getColumnTypes(table: string): Map<string, string> | null;
|
|
29
|
+
/**
|
|
30
|
+
* Eagerly load column types into the in-memory cache. With a Redis
|
|
31
|
+
* client supplied, attempts the cache key first and falls through to
|
|
32
|
+
* Postgres on miss (writing the result back to Redis). This is the
|
|
33
|
+
* "one server queries PG, the rest read from Redis" pattern for cold
|
|
34
|
+
* starts in a multi-instance deploy. Without Redis, always queries PG.
|
|
35
|
+
*
|
|
36
|
+
* Pass `tables` to limit the load to a specific list; otherwise every
|
|
37
|
+
* user table in the connected database is loaded.
|
|
38
|
+
*
|
|
39
|
+
* The Redis cache key should encode whatever invalidates types in your
|
|
40
|
+
* environment (typically a schema version / deploy version). The
|
|
41
|
+
* subscriber in supalive-server.ts is expected to publish a reload
|
|
42
|
+
* signal after migrations and invoke {@link invalidateColumnTypes}.
|
|
43
|
+
*/
|
|
44
|
+
bootstrapColumnTypes(opts: {
|
|
45
|
+
redis?: CacheLayer;
|
|
46
|
+
cacheKey: string;
|
|
47
|
+
tables?: string[];
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Invalidate cached types (and dependent SQL) for `table`, or the entire
|
|
51
|
+
* cache if `table` is omitted. The Redis-pubsub reload signal in
|
|
52
|
+
* supalive-server.ts is expected to call this on schema changes.
|
|
53
|
+
*/
|
|
54
|
+
private invalidateColumnTypes;
|
|
55
|
+
/** Enumerate the user-defined tables in the connected database — used
|
|
56
|
+
* by bootstrapColumnTypes() when no explicit list is provided. */
|
|
57
|
+
private listUserTables;
|
|
58
|
+
getCoreVersion(): Promise<bigint>;
|
|
59
|
+
getAppMigration(): Promise<bigint>;
|
|
60
|
+
coreMigrationStatements(toVersion: bigint): string[];
|
|
61
|
+
withCoreInitLock(fn: (ctx: CoreInitLockCtx) => Promise<void>): Promise<void>;
|
|
62
|
+
query<T = any>(sql: string, params?: unknown[]): Promise<DbQueryResult<T>>;
|
|
63
|
+
getClient(): Promise<PooledClient>;
|
|
64
|
+
getTransactionClient(): Promise<TxDatabase>;
|
|
65
|
+
/** Internal: replace this instance's caches with shared references from
|
|
66
|
+
* a parent. Used by PgDatabase.getTransactionClient. */
|
|
67
|
+
adoptCaches(columnTypes: Map<string, Map<string, string>>, sqlCache: Map<string, string>): void;
|
|
68
|
+
getLatestSnapshotTimestamp(): Promise<bigint>;
|
|
69
|
+
updateLatestSnapshotTimestamp(commitTs: bigint): Promise<void>;
|
|
70
|
+
getMinSnapshotTimestamp(): Promise<bigint>;
|
|
71
|
+
updateMinSnapshotTimestamp(ts: bigint): Promise<void>;
|
|
72
|
+
getNextTimestamp(): Promise<bigint>;
|
|
73
|
+
attachPrevDataToWriteSet(writeSet: WriteEntry[], readSet: ReadEntry[]): Promise<void>;
|
|
74
|
+
prepareCommitWrites(readSet: ReadEntry[], writeSet: WriteEntry[], commitTs: LazyCommitTsParam): Promise<PreparedQueries>;
|
|
75
|
+
private pgPrepareBatchWrites;
|
|
76
|
+
private pgPrepareInsertSingle;
|
|
77
|
+
private pgPrepareInsertBatch;
|
|
78
|
+
private pgPrepareUpdateSingle;
|
|
79
|
+
private pgPrepareUpdateBatch;
|
|
80
|
+
private pgPrepareDeleteSingle;
|
|
81
|
+
private pgPrepareDeleteBatch;
|
|
82
|
+
private buildOrGetInsertSql;
|
|
83
|
+
private buildOrGetUpdateSql;
|
|
84
|
+
private buildOrGetDeleteSql;
|
|
85
|
+
private pgPrepareCommitLogs;
|
|
86
|
+
/**
|
|
87
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
88
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
89
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
90
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
91
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
92
|
+
*/
|
|
93
|
+
private pgPrepareValidatePointReadsByCommitTs;
|
|
94
|
+
commitWrites(beginTs: bigint, queries: PreparedQueries, commitTs: bigint): Promise<{
|
|
95
|
+
success: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
private pgApplyWrites;
|
|
98
|
+
/**
|
|
99
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
100
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
101
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
102
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
103
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
104
|
+
*/
|
|
105
|
+
private validatePointReadsByCommitTs;
|
|
106
|
+
pruneCommitLogsBefore(ts: bigint): Promise<bigint>;
|
|
107
|
+
getMinCommitLogTs(): Promise<bigint | null>;
|
|
108
|
+
getCommitLogsBetweenTs(beginTs: bigint, endTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
109
|
+
hasCommitForPoints(beginTs: bigint, endTs: bigint, points: {
|
|
110
|
+
tableId: Uint8Array;
|
|
111
|
+
id: Uint8Array;
|
|
112
|
+
}[]): Promise<boolean>;
|
|
113
|
+
getCommitLogsSinceTs(sinceTs: bigint, excludeTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
114
|
+
close(): Promise<void>;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { PgDatabase as t };
|
|
118
|
+
//#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B,0BAAA,CAA2B,EAAA,WAAa,OAAA;EAOxC,gBAAA,IAAoB,OAAA;EAuBpB,wBAAA,CAAyB,QAAA,EAAU,UAAA,IAAc,OAAA,EAAS,SAAA,KAAc,OAAA;EAgExE,mBAAA,CACJ,OAAA,EAAS,SAAA,IACT,QAAA,EAAU,UAAA,IACV,QAAA,EAAU,iBAAA,GACT,OAAA,CAAQ,eAAA;EAAA,QAqBG,oBAAA;EAAA,QA2BN,qBAAA;EAAA,QAkBM,oBAAA;EAAA,QA+DN,qBAAA;EAAA,QAwBM,oBAAA;EAAA,QAsEN,qBAAA;EAAA,QAgBM,oBAAA;EAAA,QAiDN,mBAAA;EAAA,QAqBA,mBAAA;EAAA,QA4BA,mBAAA;EAAA,QAcM,mBAAA;EA9rBkB;;;;;;;EAAA,QA4uBxB,qCAAA;EAkDF,YAAA,CACJ,OAAA,UACA,OAAA,EAAS,eAAA,EACT,QAAA,WACC,OAAA;IAAU,OAAA;EAAA;EAAA,QAqCC,aAAA;EA3wBJ;;;;;;;EAAA,QAs3BI,4BAAA;EA0CR,qBAAA,CAAsB,EAAA,WAAa,OAAA;EAQnC,iBAAA,IAAqB,OAAA;EAQrB,sBAAA,CAAuB,OAAA,UAAiB,KAAA,UAAe,QAAA,EAAU,UAAA,KAAe,OAAA,CAAQ,cAAA;EAmBxF,kBAAA,CACJ,OAAA,UACA,KAAA,UACA,MAAA;IAAU,OAAA,EAAS,UAAA;IAAY,EAAA,EAAI,UAAA;EAAA,MAClC,OAAA;EAsBG,oBAAA,CAAqB,OAAA,UAAiB,SAAA,UAAmB,QAAA,EAAU,UAAA,KAAe,OAAA,CAAQ,cAAA;EAmB1F,KAAA,IAAS,OAAA;AAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Jn as DbQueryResult, Kn as CoreInitLockCtx, Qn as PreparedQueries, Xn as LazyCommitTsParam, Yn as DbType, Zn as PooledClient, er as SqlBuilder, ii as WriteEntry, nr as CacheLayer, qn as Database, ti as ReadEntry, tr as TxDatabase, wr as CommitLogEntry } from "./index-CjkNEwSc.js";
|
|
2
|
+
import { Pool, PoolConfig } from "pg";
|
|
3
|
+
import { Logger } from "pino";
|
|
4
|
+
|
|
5
|
+
//#region src/db/postgres.d.ts
|
|
6
|
+
declare class PgDatabase implements Database {
|
|
7
|
+
constructor(logger: Logger, config: PoolConfig, pool?: Pool | undefined);
|
|
8
|
+
private logger;
|
|
9
|
+
config: PoolConfig;
|
|
10
|
+
private pool;
|
|
11
|
+
readonly sqlBuilder: SqlBuilder;
|
|
12
|
+
readonly dbType: DbType;
|
|
13
|
+
columnTypes: Map<string, Map<string, string>>;
|
|
14
|
+
protected sqlCache: Map<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches actual column types from Postgres for `table` and returns a
|
|
17
|
+
* map of DB column name → PG type string (as produced by `format_type`,
|
|
18
|
+
* e.g. `bigint`, `integer`, `character varying(32)`, `text[]`, `jsonb`).
|
|
19
|
+
* No caching here — see {@link getColumnTypes} for the cached path.
|
|
20
|
+
*/
|
|
21
|
+
loadColumnTypesFromPg(table: string): Promise<Map<string, string>>;
|
|
22
|
+
/**
|
|
23
|
+
* Synchronous column-type lookup. The apply path calls this on every
|
|
24
|
+
* batched write, so it can't await — populate the cache via
|
|
25
|
+
* {@link bootstrapColumnTypes} at server start. Throws if `table` is
|
|
26
|
+
* missing (programmer error / bootstrap skipped).
|
|
27
|
+
*/
|
|
28
|
+
getColumnTypes(table: string): Map<string, string> | null;
|
|
29
|
+
/**
|
|
30
|
+
* Eagerly load column types into the in-memory cache. With a Redis
|
|
31
|
+
* client supplied, attempts the cache key first and falls through to
|
|
32
|
+
* Postgres on miss (writing the result back to Redis). This is the
|
|
33
|
+
* "one server queries PG, the rest read from Redis" pattern for cold
|
|
34
|
+
* starts in a multi-instance deploy. Without Redis, always queries PG.
|
|
35
|
+
*
|
|
36
|
+
* Pass `tables` to limit the load to a specific list; otherwise every
|
|
37
|
+
* user table in the connected database is loaded.
|
|
38
|
+
*
|
|
39
|
+
* The Redis cache key should encode whatever invalidates types in your
|
|
40
|
+
* environment (typically a schema version / deploy version). The
|
|
41
|
+
* subscriber in supalive-server.ts is expected to publish a reload
|
|
42
|
+
* signal after migrations and invoke {@link invalidateColumnTypes}.
|
|
43
|
+
*/
|
|
44
|
+
bootstrapColumnTypes(opts: {
|
|
45
|
+
redis?: CacheLayer;
|
|
46
|
+
cacheKey: string;
|
|
47
|
+
tables?: string[];
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Invalidate cached types (and dependent SQL) for `table`, or the entire
|
|
51
|
+
* cache if `table` is omitted. The Redis-pubsub reload signal in
|
|
52
|
+
* supalive-server.ts is expected to call this on schema changes.
|
|
53
|
+
*/
|
|
54
|
+
private invalidateColumnTypes;
|
|
55
|
+
/** Enumerate the user-defined tables in the connected database — used
|
|
56
|
+
* by bootstrapColumnTypes() when no explicit list is provided. */
|
|
57
|
+
private listUserTables;
|
|
58
|
+
getCoreVersion(): Promise<bigint>;
|
|
59
|
+
getAppMigration(): Promise<bigint>;
|
|
60
|
+
coreMigrationStatements(toVersion: bigint): string[];
|
|
61
|
+
withCoreInitLock(fn: (ctx: CoreInitLockCtx) => Promise<void>): Promise<void>;
|
|
62
|
+
query<T = any>(sql: string, params?: unknown[]): Promise<DbQueryResult<T>>;
|
|
63
|
+
getClient(): Promise<PooledClient>;
|
|
64
|
+
getTransactionClient(): Promise<TxDatabase>;
|
|
65
|
+
/** Internal: replace this instance's caches with shared references from
|
|
66
|
+
* a parent. Used by PgDatabase.getTransactionClient. */
|
|
67
|
+
adoptCaches(columnTypes: Map<string, Map<string, string>>, sqlCache: Map<string, string>): void;
|
|
68
|
+
getLatestSnapshotTimestamp(): Promise<bigint>;
|
|
69
|
+
updateLatestSnapshotTimestamp(commitTs: bigint): Promise<void>;
|
|
70
|
+
getMinSnapshotTimestamp(): Promise<bigint>;
|
|
71
|
+
updateMinSnapshotTimestamp(ts: bigint): Promise<void>;
|
|
72
|
+
getNextTimestamp(): Promise<bigint>;
|
|
73
|
+
attachPrevDataToWriteSet(writeSet: WriteEntry[], readSet: ReadEntry[]): Promise<void>;
|
|
74
|
+
prepareCommitWrites(readSet: ReadEntry[], writeSet: WriteEntry[], commitTs: LazyCommitTsParam): Promise<PreparedQueries>;
|
|
75
|
+
private pgPrepareBatchWrites;
|
|
76
|
+
private pgPrepareInsertSingle;
|
|
77
|
+
private pgPrepareInsertBatch;
|
|
78
|
+
private pgPrepareUpdateSingle;
|
|
79
|
+
private pgPrepareUpdateBatch;
|
|
80
|
+
private pgPrepareDeleteSingle;
|
|
81
|
+
private pgPrepareDeleteBatch;
|
|
82
|
+
private buildOrGetInsertSql;
|
|
83
|
+
private buildOrGetUpdateSql;
|
|
84
|
+
private buildOrGetDeleteSql;
|
|
85
|
+
private pgPrepareCommitLogs;
|
|
86
|
+
/**
|
|
87
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
88
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
89
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
90
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
91
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
92
|
+
*/
|
|
93
|
+
private pgPrepareValidatePointReadsByCommitTs;
|
|
94
|
+
commitWrites(beginTs: bigint, queries: PreparedQueries, commitTs: bigint): Promise<{
|
|
95
|
+
success: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
private pgApplyWrites;
|
|
98
|
+
/**
|
|
99
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
100
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
101
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
102
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
103
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
104
|
+
*/
|
|
105
|
+
private validatePointReadsByCommitTs;
|
|
106
|
+
pruneCommitLogsBefore(ts: bigint): Promise<bigint>;
|
|
107
|
+
getMinCommitLogTs(): Promise<bigint | null>;
|
|
108
|
+
getCommitLogsBetweenTs(beginTs: bigint, endTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
109
|
+
hasCommitForPoints(beginTs: bigint, endTs: bigint, points: {
|
|
110
|
+
tableId: Uint8Array;
|
|
111
|
+
id: Uint8Array;
|
|
112
|
+
}[]): Promise<boolean>;
|
|
113
|
+
getCommitLogsSinceTs(sinceTs: bigint, excludeTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
114
|
+
close(): Promise<void>;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { PgDatabase as t };
|
|
118
|
+
//# sourceMappingURL=postgres-CFarR3cB.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-CFarR3cB.d.ts","names":[],"sources":["../src/db/postgres.ts"],"mappings":";;;;;cAiBa,UAAA,YAAsB,QAAA;cAE/B,MAAA,EAAQ,MAAA,EACR,MAAA,EAAQ,UAAA,EACR,IAAA,GAAM,IAAA;EAAA,QAWA,MAAA;EACD,MAAA,EAAQ,UAAA;EAAA,QACP,IAAA;EAAA,SACC,UAAA,EAAY,UAAA;EAAA,SACZ,MAAA,EAAQ,MAAA;EAMV,WAAA,EAAa,GAAA,SAAY,GAAA;EAAA,UAGtB,QAAA,EAAU,GAAA;EAHY;;;;;;EAW1B,qBAAA,CAAsB,KAAA,WAAgB,OAAA,CAAQ,GAAA;EAoDhD;;;;;;EA5BJ,cAAA,CAAe,KAAA,WAAgB,GAAA;EAgKoC;;;;;;;;;;;;;;;EAxI7D,oBAAA,CAAqB,IAAA;IACzB,KAAA,GAAQ,UAAA;IACR,QAAA;IACA,MAAA;EAAA,IACE,OAAA;EAgSO;;;;;EAAA,QAtPH,qBAAA;EAm4B+D;;EAAA,QAr3BzD,cAAA;EAUR,cAAA,IAAkB,OAAA;EAOlB,eAAA,IAAm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EAAU,UAAA,KAAe,OAAA,CAAQ,cAAA;EAmBxF,kBAAA,CACJ,OAAA,UACA,KAAA,UACA,MAAA;IAAU,OAAA,EAAS,UAAA;IAAY,EAAA,EAAI,UAAA;EAAA,MAClC,OAAA;EAsBG,oBAAA,CAAqB,OAAA,UAAiB,SAAA,UAAmB,QAAA,EAAU,UAAA,KAAe,OAAA,CAAQ,cAAA;EAmB1F,KAAA,IAAS,OAAA;AAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Jn as DbQueryResult, Kn as CoreInitLockCtx, Qn as PreparedQueries, Xn as LazyCommitTsParam, Yn as DbType, Zn as PooledClient, er as SqlBuilder, ii as WriteEntry, nr as CacheLayer, qn as Database, ti as ReadEntry, tr as TxDatabase, wr as CommitLogEntry } from "./index-yXV5AMh9.js";
|
|
2
|
+
import { Pool, PoolConfig } from "pg";
|
|
3
|
+
import { Logger } from "pino";
|
|
4
|
+
|
|
5
|
+
//#region src/db/postgres.d.ts
|
|
6
|
+
declare class PgDatabase implements Database {
|
|
7
|
+
constructor(logger: Logger, config: PoolConfig, pool?: Pool | undefined);
|
|
8
|
+
private logger;
|
|
9
|
+
config: PoolConfig;
|
|
10
|
+
private pool;
|
|
11
|
+
readonly sqlBuilder: SqlBuilder;
|
|
12
|
+
readonly dbType: DbType;
|
|
13
|
+
columnTypes: Map<string, Map<string, string>>;
|
|
14
|
+
protected sqlCache: Map<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches actual column types from Postgres for `table` and returns a
|
|
17
|
+
* map of DB column name → PG type string (as produced by `format_type`,
|
|
18
|
+
* e.g. `bigint`, `integer`, `character varying(32)`, `text[]`, `jsonb`).
|
|
19
|
+
* No caching here — see {@link getColumnTypes} for the cached path.
|
|
20
|
+
*/
|
|
21
|
+
loadColumnTypesFromPg(table: string): Promise<Map<string, string>>;
|
|
22
|
+
/**
|
|
23
|
+
* Synchronous column-type lookup. The apply path calls this on every
|
|
24
|
+
* batched write, so it can't await — populate the cache via
|
|
25
|
+
* {@link bootstrapColumnTypes} at server start. Throws if `table` is
|
|
26
|
+
* missing (programmer error / bootstrap skipped).
|
|
27
|
+
*/
|
|
28
|
+
getColumnTypes(table: string): Map<string, string> | null;
|
|
29
|
+
/**
|
|
30
|
+
* Eagerly load column types into the in-memory cache. With a Redis
|
|
31
|
+
* client supplied, attempts the cache key first and falls through to
|
|
32
|
+
* Postgres on miss (writing the result back to Redis). This is the
|
|
33
|
+
* "one server queries PG, the rest read from Redis" pattern for cold
|
|
34
|
+
* starts in a multi-instance deploy. Without Redis, always queries PG.
|
|
35
|
+
*
|
|
36
|
+
* Pass `tables` to limit the load to a specific list; otherwise every
|
|
37
|
+
* user table in the connected database is loaded.
|
|
38
|
+
*
|
|
39
|
+
* The Redis cache key should encode whatever invalidates types in your
|
|
40
|
+
* environment (typically a schema version / deploy version). The
|
|
41
|
+
* subscriber in supalive-server.ts is expected to publish a reload
|
|
42
|
+
* signal after migrations and invoke {@link invalidateColumnTypes}.
|
|
43
|
+
*/
|
|
44
|
+
bootstrapColumnTypes(opts: {
|
|
45
|
+
redis?: CacheLayer;
|
|
46
|
+
cacheKey: string;
|
|
47
|
+
tables?: string[];
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Invalidate cached types (and dependent SQL) for `table`, or the entire
|
|
51
|
+
* cache if `table` is omitted. The Redis-pubsub reload signal in
|
|
52
|
+
* supalive-server.ts is expected to call this on schema changes.
|
|
53
|
+
*/
|
|
54
|
+
private invalidateColumnTypes;
|
|
55
|
+
/** Enumerate the user-defined tables in the connected database — used
|
|
56
|
+
* by bootstrapColumnTypes() when no explicit list is provided. */
|
|
57
|
+
private listUserTables;
|
|
58
|
+
getCoreVersion(): Promise<bigint>;
|
|
59
|
+
getAppMigration(): Promise<bigint>;
|
|
60
|
+
coreMigrationStatements(toVersion: bigint): string[];
|
|
61
|
+
withCoreInitLock(fn: (ctx: CoreInitLockCtx) => Promise<void>): Promise<void>;
|
|
62
|
+
query<T = any>(sql: string, params?: unknown[]): Promise<DbQueryResult<T>>;
|
|
63
|
+
getClient(): Promise<PooledClient>;
|
|
64
|
+
getTransactionClient(): Promise<TxDatabase>;
|
|
65
|
+
/** Internal: replace this instance's caches with shared references from
|
|
66
|
+
* a parent. Used by PgDatabase.getTransactionClient. */
|
|
67
|
+
adoptCaches(columnTypes: Map<string, Map<string, string>>, sqlCache: Map<string, string>): void;
|
|
68
|
+
getLatestSnapshotTimestamp(): Promise<bigint>;
|
|
69
|
+
updateLatestSnapshotTimestamp(commitTs: bigint): Promise<void>;
|
|
70
|
+
getMinSnapshotTimestamp(): Promise<bigint>;
|
|
71
|
+
updateMinSnapshotTimestamp(ts: bigint): Promise<void>;
|
|
72
|
+
getNextTimestamp(): Promise<bigint>;
|
|
73
|
+
attachPrevDataToWriteSet(writeSet: WriteEntry[], readSet: ReadEntry[]): Promise<void>;
|
|
74
|
+
prepareCommitWrites(readSet: ReadEntry[], writeSet: WriteEntry[], commitTs: LazyCommitTsParam): Promise<PreparedQueries>;
|
|
75
|
+
private pgPrepareBatchWrites;
|
|
76
|
+
private pgPrepareInsertSingle;
|
|
77
|
+
private pgPrepareInsertBatch;
|
|
78
|
+
private pgPrepareUpdateSingle;
|
|
79
|
+
private pgPrepareUpdateBatch;
|
|
80
|
+
private pgPrepareDeleteSingle;
|
|
81
|
+
private pgPrepareDeleteBatch;
|
|
82
|
+
private buildOrGetInsertSql;
|
|
83
|
+
private buildOrGetUpdateSql;
|
|
84
|
+
private buildOrGetDeleteSql;
|
|
85
|
+
private pgPrepareCommitLogs;
|
|
86
|
+
/**
|
|
87
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
88
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
89
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
90
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
91
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
92
|
+
*/
|
|
93
|
+
private pgPrepareValidatePointReadsByCommitTs;
|
|
94
|
+
commitWrites(beginTs: bigint, queries: PreparedQueries, commitTs: bigint): Promise<{
|
|
95
|
+
success: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
private pgApplyWrites;
|
|
98
|
+
/**
|
|
99
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
100
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
101
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
102
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
103
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
104
|
+
*/
|
|
105
|
+
private validatePointReadsByCommitTs;
|
|
106
|
+
pruneCommitLogsBefore(ts: bigint): Promise<bigint>;
|
|
107
|
+
getMinCommitLogTs(): Promise<bigint | null>;
|
|
108
|
+
getCommitLogsBetweenTs(beginTs: bigint, endTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
109
|
+
hasCommitForPoints(beginTs: bigint, endTs: bigint, points: {
|
|
110
|
+
tableId: Uint8Array;
|
|
111
|
+
id: Uint8Array;
|
|
112
|
+
}[]): Promise<boolean>;
|
|
113
|
+
getCommitLogsSinceTs(sinceTs: bigint, excludeTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
114
|
+
close(): Promise<void>;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { PgDatabase as t };
|
|
118
|
+
//# sourceMappingURL=postgres-CWVM-KKP.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-CWVM-KKP.d.ts","names":[],"sources":["../src/db/postgres.ts"],"mappings":";;;;;cAiBa,UAAA,YAAsB,QAAA;cAE/B,MAAA,EAAQ,MAAA,EACR,MAAA,EAAQ,UAAA,EACR,IAAA,GAAM,IAAA;EAAA,QAWA,MAAA;EACD,MAAA,EAAQ,UAAA;EAAA,QACP,IAAA;EAAA,SACC,UAAA,E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,qBAAA;EAAA,QAwBM,oBAAA;EAAA,QAsEN,qBAAA;EAAA,QAgBM,oBAAA;EAAA,QAiDN,mBAAA;EAAA,QAqBA,mBAAA;EAAA,QA4BA,mBAAA;EAAA,QAcM,mBAAA;EA9rBkB;;;;;;;EAAA,QA4uBxB,qCAAA;EAkDF,YAAA,CACJ,OAAA,UACA,OAAA,EAAS,eAAA,EACT,QAAA,WACC,OAAA;IAAU,OAAA;EAAA;EAAA,QAqCC,aAAA;EA3wBJ;;;;;;;EAAA,QAs3BI,4BAAA;EA0CR,qBAAA,CAAsB,EAAA,WAAa,OAAA;EAQnC,iBAAA,IAAqB,OAAA;EAQrB,sBAAA,CAAuB,OAAA,UAAiB,KAAA,UAAe,QAAA,EAAU,UAAA,KAAe,OAAA,CAAQ,cAAA;EAmBxF,kBAAA,CACJ,OAAA,UACA,KAAA,UACA,MAAA;IAAU,OAAA,EAAS,UAAA;IAAY,EAAA,EAAI,UAAA;EAAA,MAClC,OAAA;EAsBG,oBAAA,CAAqB,OAAA,UAAiB,SAAA,UAAmB,QAAA,EAAU,UAAA,KAAe,OAAA,CAAQ,cAAA;EAmB1F,KAAA,IAAS,OAAA;AAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Jn as DbQueryResult, Kn as CoreInitLockCtx, Qn as PreparedQueries, Xn as LazyCommitTsParam, Yn as DbType, Zn as PooledClient, er as SqlBuilder, ii as WriteEntry, nr as CacheLayer, qn as Database, ti as ReadEntry, tr as TxDatabase, wr as CommitLogEntry } from "./index-BMz7jVbX.js";
|
|
2
|
+
import { Pool, PoolConfig } from "pg";
|
|
3
|
+
import { Logger } from "pino";
|
|
4
|
+
|
|
5
|
+
//#region src/db/postgres.d.ts
|
|
6
|
+
declare class PgDatabase implements Database {
|
|
7
|
+
constructor(logger: Logger, config: PoolConfig, pool?: Pool | undefined);
|
|
8
|
+
private logger;
|
|
9
|
+
config: PoolConfig;
|
|
10
|
+
private pool;
|
|
11
|
+
readonly sqlBuilder: SqlBuilder;
|
|
12
|
+
readonly dbType: DbType;
|
|
13
|
+
columnTypes: Map<string, Map<string, string>>;
|
|
14
|
+
protected sqlCache: Map<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches actual column types from Postgres for `table` and returns a
|
|
17
|
+
* map of DB column name → PG type string (as produced by `format_type`,
|
|
18
|
+
* e.g. `bigint`, `integer`, `character varying(32)`, `text[]`, `jsonb`).
|
|
19
|
+
* No caching here — see {@link getColumnTypes} for the cached path.
|
|
20
|
+
*/
|
|
21
|
+
loadColumnTypesFromPg(table: string): Promise<Map<string, string>>;
|
|
22
|
+
/**
|
|
23
|
+
* Synchronous column-type lookup. The apply path calls this on every
|
|
24
|
+
* batched write, so it can't await — populate the cache via
|
|
25
|
+
* {@link bootstrapColumnTypes} at server start. Throws if `table` is
|
|
26
|
+
* missing (programmer error / bootstrap skipped).
|
|
27
|
+
*/
|
|
28
|
+
getColumnTypes(table: string): Map<string, string> | null;
|
|
29
|
+
/**
|
|
30
|
+
* Eagerly load column types into the in-memory cache. With a Redis
|
|
31
|
+
* client supplied, attempts the cache key first and falls through to
|
|
32
|
+
* Postgres on miss (writing the result back to Redis). This is the
|
|
33
|
+
* "one server queries PG, the rest read from Redis" pattern for cold
|
|
34
|
+
* starts in a multi-instance deploy. Without Redis, always queries PG.
|
|
35
|
+
*
|
|
36
|
+
* Pass `tables` to limit the load to a specific list; otherwise every
|
|
37
|
+
* user table in the connected database is loaded.
|
|
38
|
+
*
|
|
39
|
+
* The Redis cache key should encode whatever invalidates types in your
|
|
40
|
+
* environment (typically a schema version / deploy version). The
|
|
41
|
+
* subscriber in supalive-server.ts is expected to publish a reload
|
|
42
|
+
* signal after migrations and invoke {@link invalidateColumnTypes}.
|
|
43
|
+
*/
|
|
44
|
+
bootstrapColumnTypes(opts: {
|
|
45
|
+
redis?: CacheLayer;
|
|
46
|
+
cacheKey: string;
|
|
47
|
+
tables?: string[];
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Invalidate cached types (and dependent SQL) for `table`, or the entire
|
|
51
|
+
* cache if `table` is omitted. The Redis-pubsub reload signal in
|
|
52
|
+
* supalive-server.ts is expected to call this on schema changes.
|
|
53
|
+
*/
|
|
54
|
+
private invalidateColumnTypes;
|
|
55
|
+
/** Enumerate the user-defined tables in the connected database — used
|
|
56
|
+
* by bootstrapColumnTypes() when no explicit list is provided. */
|
|
57
|
+
private listUserTables;
|
|
58
|
+
getCoreVersion(): Promise<bigint>;
|
|
59
|
+
getAppMigration(): Promise<bigint>;
|
|
60
|
+
coreMigrationStatements(toVersion: bigint): string[];
|
|
61
|
+
withCoreInitLock(fn: (ctx: CoreInitLockCtx) => Promise<void>): Promise<void>;
|
|
62
|
+
query<T = any>(sql: string, params?: unknown[]): Promise<DbQueryResult<T>>;
|
|
63
|
+
getClient(): Promise<PooledClient>;
|
|
64
|
+
getTransactionClient(): Promise<TxDatabase>;
|
|
65
|
+
/** Internal: replace this instance's caches with shared references from
|
|
66
|
+
* a parent. Used by PgDatabase.getTransactionClient. */
|
|
67
|
+
adoptCaches(columnTypes: Map<string, Map<string, string>>, sqlCache: Map<string, string>): void;
|
|
68
|
+
getLatestSnapshotTimestamp(): Promise<bigint>;
|
|
69
|
+
updateLatestSnapshotTimestamp(commitTs: bigint): Promise<void>;
|
|
70
|
+
getMinSnapshotTimestamp(): Promise<bigint>;
|
|
71
|
+
updateMinSnapshotTimestamp(ts: bigint): Promise<void>;
|
|
72
|
+
getNextTimestamp(): Promise<bigint>;
|
|
73
|
+
attachPrevDataToWriteSet(writeSet: WriteEntry[], readSet: ReadEntry[]): Promise<void>;
|
|
74
|
+
prepareCommitWrites(readSet: ReadEntry[], writeSet: WriteEntry[], commitTs: LazyCommitTsParam): Promise<PreparedQueries>;
|
|
75
|
+
private pgPrepareBatchWrites;
|
|
76
|
+
private pgPrepareInsertSingle;
|
|
77
|
+
private pgPrepareInsertBatch;
|
|
78
|
+
private pgPrepareUpdateSingle;
|
|
79
|
+
private pgPrepareUpdateBatch;
|
|
80
|
+
private pgPrepareDeleteSingle;
|
|
81
|
+
private pgPrepareDeleteBatch;
|
|
82
|
+
private buildOrGetInsertSql;
|
|
83
|
+
private buildOrGetUpdateSql;
|
|
84
|
+
private buildOrGetDeleteSql;
|
|
85
|
+
private pgPrepareCommitLogs;
|
|
86
|
+
/**
|
|
87
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
88
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
89
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
90
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
91
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
92
|
+
*/
|
|
93
|
+
private pgPrepareValidatePointReadsByCommitTs;
|
|
94
|
+
commitWrites(beginTs: bigint, queries: PreparedQueries, commitTs: bigint): Promise<{
|
|
95
|
+
success: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
private pgApplyWrites;
|
|
98
|
+
/**
|
|
99
|
+
* Point-only OCC check. For each genuine point read, compare the row's
|
|
100
|
+
* current commit_ts against the value captured at read time. A `null`
|
|
101
|
+
* expectedCommitTs means "row didn't exist when we read"; any row found
|
|
102
|
+
* now is a conflict. Reads whose row is being written in this same txn
|
|
103
|
+
* are skipped — the CAS UPDATE/DELETE already validated those.
|
|
104
|
+
*/
|
|
105
|
+
private validatePointReadsByCommitTs;
|
|
106
|
+
pruneCommitLogsBefore(ts: bigint): Promise<bigint>;
|
|
107
|
+
getMinCommitLogTs(): Promise<bigint | null>;
|
|
108
|
+
getCommitLogsBetweenTs(beginTs: bigint, endTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
109
|
+
hasCommitForPoints(beginTs: bigint, endTs: bigint, points: {
|
|
110
|
+
tableId: Uint8Array;
|
|
111
|
+
id: Uint8Array;
|
|
112
|
+
}[]): Promise<boolean>;
|
|
113
|
+
getCommitLogsSinceTs(sinceTs: bigint, excludeTs: bigint, tableIds: Uint8Array[]): Promise<CommitLogEntry[]>;
|
|
114
|
+
close(): Promise<void>;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { PgDatabase as t };
|
|
118
|
+
//# sourceMappingURL=postgres-D50xpaQ-.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-D50xpaQ-.d.ts","names":[],"sources":["../src/db/postgres.ts"],"mappings":";;;;;cAiBa,UAAA,YAAsB,QAAA;cAE/B,MAAA,EAAQ,MAAA,EACR,MAAA,EAAQ,UAAA,EACR,IAAA,GAAM,IAAA;EAAA,QAWA,MAAA;EACD,MAAA,EAAQ,UAAA;EAAA,QACP,IAAA;EAAA,SACC,UAAA,EAAY,UAAA;EAAA,SACZ,MAAA,EAAQ,MAAA;EAMV,WAAA,EAAa,GAAA,SAAY,GAAA;EAAA,UAGtB,QAAA,EAAU,GAAA;EAHY;;;;;;EAW1B,qBAAA,CAAsB,KAAA,WAAgB,OAAA,CAAQ,GAAA;EAoDhD;;;;;;EA5BJ,cAAA,CAAe,KAAA,WAAgB,GAAA;EAgKoC;;;;;;;;;;;;;;;EAxI7D,oBAAA,CAAqB,IAAA;IACzB,KAAA,GAAQ,UAAA;IACR,QAAA;IACA,MAAA;EAAA,IACE,OAAA;EAgSO;;;;;EAAA,QAtPH,qBAAA;EAm4B+D;;EAAA,QAr3BzD,cAAA;EAUR,cAAA,IAAkB,OAAA;EAOlB,eAAA,IAAmB,OAAA;EAWzB,uBAAA,CAAwB,SAAA;EAUlB,gBAAA,CAAiB,EAAA,GAAK,GAAA,EAAK,eAAA,KAAoB,OAAA,SAAgB,OAAA;EAsC/D,KAAA,UAAe,GAAA,UAAa,MAAA,eAAyB,OAAA,CAAQ,aAAA,CAAc,CAAA;EAe3E,SAAA,IAAa,OAAA,CAAQ,YAAA;EAIrB,oBAAA,IAAwB,OAAA,CAAQ,UAAA;EA/OL;;EA2PjC,WAAA,CACE,WAAA,EAAa,GAAA,SAA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