@hoshinotatsuya/pg-replica-sync 0.2.2 → 0.3.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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/compare-lsn.d.mts +3 -3
- package/dist/compare-lsn.d.ts +3 -3
- package/dist/compare-lsn.js +3 -3
- package/dist/constants/exclusion-reason.constant.d.mts +12 -12
- package/dist/constants/exclusion-reason.constant.d.ts +12 -12
- package/dist/constants/exclusion-reason.constant.d.ts.map +1 -1
- package/dist/constants/exclusion-reason.constant.js +12 -12
- package/dist/constants/exclusion-reason.constant.js.map +1 -1
- package/dist/constants/node-role.constant.d.mts +1 -1
- package/dist/constants/node-role.constant.d.ts +1 -1
- package/dist/constants/node-role.constant.d.ts.map +1 -1
- package/dist/constants/node-role.constant.js +1 -1
- package/dist/constants/node-role.constant.js.map +1 -1
- package/dist/constants/probe-sql.constant.d.mts +25 -25
- package/dist/constants/probe-sql.constant.d.ts +25 -25
- package/dist/constants/probe-sql.constant.js +25 -25
- package/dist/constants/replica-sync-defaults.constant.d.mts +26 -26
- package/dist/constants/replica-sync-defaults.constant.d.ts +26 -26
- package/dist/constants/replica-sync-defaults.constant.d.ts.map +1 -1
- package/dist/constants/replica-sync-defaults.constant.js +26 -26
- package/dist/constants/replica-sync-defaults.constant.js.map +1 -1
- package/dist/constants/route-reason.constant.d.mts +13 -13
- package/dist/constants/route-reason.constant.d.ts +13 -13
- package/dist/constants/route-reason.constant.d.ts.map +1 -1
- package/dist/constants/route-reason.constant.js +13 -13
- package/dist/constants/route-reason.constant.js.map +1 -1
- package/dist/constants/token-format.constant.d.mts +11 -11
- package/dist/constants/token-format.constant.d.ts +11 -11
- package/dist/constants/token-format.constant.d.ts.map +1 -1
- package/dist/constants/token-format.constant.js +11 -11
- package/dist/constants/token-format.constant.js.map +1 -1
- package/dist/constants/wal-format.constant.d.mts +6 -6
- package/dist/constants/wal-format.constant.d.ts +6 -6
- package/dist/constants/wal-format.constant.d.ts.map +1 -1
- package/dist/constants/wal-format.constant.js +6 -6
- package/dist/constants/wal-format.constant.js.map +1 -1
- package/dist/decode-canonical-base64url.d.mts +1 -1
- package/dist/decode-canonical-base64url.d.ts +1 -1
- package/dist/decode-canonical-base64url.d.ts.map +1 -1
- package/dist/decode-canonical-base64url.js +1 -1
- package/dist/decode-canonical-base64url.js.map +1 -1
- package/dist/deep-freeze.d.mts +7 -7
- package/dist/deep-freeze.d.ts +7 -7
- package/dist/deep-freeze.js +9 -9
- package/dist/deep-freeze.js.map +1 -1
- package/dist/destroy-client.d.mts +3 -3
- package/dist/destroy-client.d.ts +3 -3
- package/dist/destroy-client.js +3 -3
- package/dist/evaluate-replica.d.mts +3 -3
- package/dist/evaluate-replica.d.ts +3 -3
- package/dist/evaluate-replica.js +3 -3
- package/dist/format-lsn.d.mts +1 -1
- package/dist/format-lsn.d.ts +1 -1
- package/dist/format-lsn.d.ts.map +1 -1
- package/dist/format-lsn.js +2 -2
- package/dist/format-lsn.js.map +1 -1
- package/dist/invalid-lsn.error.d.mts +1 -1
- package/dist/invalid-lsn.error.d.ts +1 -1
- package/dist/invalid-lsn.error.d.ts.map +1 -1
- package/dist/invalid-lsn.error.js +2 -2
- package/dist/invalid-lsn.error.js.map +1 -1
- package/dist/invalid-replica-sync-options.error.d.mts +1 -1
- package/dist/invalid-replica-sync-options.error.d.ts +1 -1
- package/dist/invalid-replica-sync-options.error.d.ts.map +1 -1
- package/dist/invalid-replica-sync-options.error.js +1 -1
- package/dist/invalid-replica-sync-options.error.js.map +1 -1
- package/dist/lag-bytes.d.mts +3 -3
- package/dist/lag-bytes.d.ts +3 -3
- package/dist/lag-bytes.js +3 -3
- package/dist/lsn-or-null.d.mts +1 -1
- package/dist/lsn-or-null.d.ts +1 -1
- package/dist/lsn-or-null.d.ts.map +1 -1
- package/dist/lsn-or-null.js +1 -1
- package/dist/lsn-or-null.js.map +1 -1
- package/dist/notify.d.mts +7 -7
- package/dist/notify.d.ts +7 -7
- package/dist/notify.js +8 -8
- package/dist/notify.js.map +1 -1
- package/dist/parse-lsn.d.mts +3 -3
- package/dist/parse-lsn.d.ts +3 -3
- package/dist/parse-lsn.js +3 -3
- package/dist/probe-connection-closed.error.d.mts +1 -1
- package/dist/probe-connection-closed.error.d.ts +1 -1
- package/dist/probe-connection-closed.error.d.ts.map +1 -1
- package/dist/probe-connection-closed.error.js +2 -2
- package/dist/probe-connection-closed.error.js.map +1 -1
- package/dist/probe-connection.d.mts +20 -20
- package/dist/probe-connection.d.ts +20 -20
- package/dist/probe-connection.d.ts.map +1 -1
- package/dist/probe-connection.js +25 -25
- package/dist/probe-connection.js.map +1 -1
- package/dist/probe-timeout.error.d.mts +1 -1
- package/dist/probe-timeout.error.d.ts +1 -1
- package/dist/probe-timeout.error.d.ts.map +1 -1
- package/dist/probe-timeout.error.js +2 -2
- package/dist/probe-timeout.error.js.map +1 -1
- package/dist/read-node-state.d.mts +3 -3
- package/dist/read-node-state.d.ts +3 -3
- package/dist/read-node-state.js +4 -4
- package/dist/read-node-state.js.map +1 -1
- package/dist/replica-router.d.mts +133 -133
- package/dist/replica-router.d.ts +133 -133
- package/dist/replica-router.d.ts.map +1 -1
- package/dist/replica-router.js +162 -162
- package/dist/replica-router.js.map +1 -1
- package/dist/require-integer.d.mts +1 -1
- package/dist/require-integer.d.ts +1 -1
- package/dist/require-integer.d.ts.map +1 -1
- package/dist/require-integer.js +3 -3
- package/dist/require-integer.js.map +1 -1
- package/dist/secret-weakness.d.mts +13 -13
- package/dist/secret-weakness.d.ts +13 -13
- package/dist/secret-weakness.js +16 -16
- package/dist/secret-weakness.js.map +1 -1
- package/dist/smallest-period.d.mts +4 -4
- package/dist/smallest-period.d.ts +4 -4
- package/dist/smallest-period.js +4 -4
- package/dist/sql-state-of.d.mts +6 -6
- package/dist/sql-state-of.d.ts +6 -6
- package/dist/sql-state-of.js +6 -6
- package/dist/state-cache.d.mts +14 -14
- package/dist/state-cache.d.ts +14 -14
- package/dist/state-cache.d.ts.map +1 -1
- package/dist/state-cache.js +15 -15
- package/dist/state-cache.js.map +1 -1
- package/dist/timeline-of.d.mts +2 -2
- package/dist/timeline-of.d.ts +2 -2
- package/dist/timeline-of.js +2 -2
- package/dist/to-error.d.mts +1 -1
- package/dist/to-error.d.ts +1 -1
- package/dist/to-error.d.ts.map +1 -1
- package/dist/to-error.js +1 -1
- package/dist/to-error.js.map +1 -1
- package/dist/token-codec.d.mts +10 -10
- package/dist/token-codec.d.ts +10 -10
- package/dist/token-codec.js +31 -31
- package/dist/token-codec.js.map +1 -1
- package/dist/token-lsn.d.mts +13 -13
- package/dist/token-lsn.d.ts +13 -13
- package/dist/token-lsn.js +13 -13
- package/dist/transaction-not-committed.error.d.mts +2 -2
- package/dist/transaction-not-committed.error.d.ts +2 -2
- package/dist/transaction-not-committed.error.d.ts.map +1 -1
- package/dist/transaction-not-committed.error.js +3 -3
- package/dist/transaction-not-committed.error.js.map +1 -1
- package/dist/transaction-not-open.error.d.mts +5 -5
- package/dist/transaction-not-open.error.d.ts +5 -5
- package/dist/transaction-not-open.error.js +6 -6
- package/dist/transaction-not-open.error.js.map +1 -1
- package/dist/types/cache-entry.type.d.mts +4 -4
- package/dist/types/cache-entry.type.d.ts +4 -4
- package/dist/types/clock.type.d.mts +3 -3
- package/dist/types/clock.type.d.ts +3 -3
- package/dist/types/confirm-event.type.d.mts +3 -3
- package/dist/types/confirm-event.type.d.ts +3 -3
- package/dist/types/decoded-token.type.d.mts +2 -2
- package/dist/types/decoded-token.type.d.ts +2 -2
- package/dist/types/evaluated.type.d.mts +1 -1
- package/dist/types/evaluated.type.d.ts +1 -1
- package/dist/types/evaluated.type.d.ts.map +1 -1
- package/dist/types/exclusion.type.d.mts +1 -1
- package/dist/types/exclusion.type.d.ts +1 -1
- package/dist/types/exclusion.type.d.ts.map +1 -1
- package/dist/types/node-state.type.d.mts +13 -13
- package/dist/types/node-state.type.d.ts +13 -13
- package/dist/types/node-state.type.d.ts.map +1 -1
- package/dist/types/not-a-pool.type.d.mts +5 -5
- package/dist/types/not-a-pool.type.d.ts +5 -5
- package/dist/types/probe-event.type.d.mts +1 -1
- package/dist/types/probe-event.type.d.ts +1 -1
- package/dist/types/probe-event.type.d.ts.map +1 -1
- package/dist/types/probe-outcome.type.d.mts +1 -1
- package/dist/types/probe-outcome.type.d.ts +1 -1
- package/dist/types/probe-outcome.type.d.ts.map +1 -1
- package/dist/types/probe-sample.type.d.mts +1 -1
- package/dist/types/probe-sample.type.d.ts +1 -1
- package/dist/types/probe-sample.type.d.ts.map +1 -1
- package/dist/types/replica-node.type.d.mts +7 -7
- package/dist/types/replica-node.type.d.ts +7 -7
- package/dist/types/replica-requirement.type.d.mts +2 -2
- package/dist/types/replica-requirement.type.d.ts +2 -2
- package/dist/types/replica-router-options.type.d.mts +25 -25
- package/dist/types/replica-router-options.type.d.ts +25 -25
- package/dist/types/replica-router-options.type.d.ts.map +1 -1
- package/dist/types/route-decision.type.d.mts +5 -5
- package/dist/types/route-decision.type.d.ts +5 -5
- package/dist/types/route-decision.type.d.ts.map +1 -1
- package/dist/types/router-observer.type.d.mts +5 -5
- package/dist/types/router-observer.type.d.ts +5 -5
- package/dist/types/router-observer.type.d.ts.map +1 -1
- package/dist/types/router-stats.type.d.mts +8 -8
- package/dist/types/router-stats.type.d.ts +8 -8
- package/dist/types/router-stats.type.d.ts.map +1 -1
- package/dist/types/sql-command-executor.type.d.mts +4 -4
- package/dist/types/sql-command-executor.type.d.ts +4 -4
- package/dist/types/sql-query-executor.type.d.mts +3 -3
- package/dist/types/sql-query-executor.type.d.ts +3 -3
- package/dist/types/wal-layout.type.d.mts +1 -1
- package/dist/types/wal-layout.type.d.ts +1 -1
- package/dist/types/wal-layout.type.d.ts.map +1 -1
- package/dist/types/wal-position.type.d.mts +5 -5
- package/dist/types/wal-position.type.d.ts +5 -5
- package/dist/types/wal-position.type.d.ts.map +1 -1
- package/dist/value-text.d.mts +5 -5
- package/dist/value-text.d.ts +5 -5
- package/dist/value-text.js +6 -6
- package/dist/value-text.js.map +1 -1
- package/dist/wal-layout-of.d.mts +1 -1
- package/dist/wal-layout-of.d.ts +1 -1
- package/dist/wal-layout-of.d.ts.map +1 -1
- package/dist/wal-layout-of.js +1 -1
- package/dist/wal-layout-of.js.map +1 -1
- package/package.json +11 -9
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* COMMIT
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* There is no open transaction on the connection passed to `commitAndIssueToken`:
|
|
3
|
+
* COMMIT there would commit nothing (Postgres would answer with a warning with
|
|
4
|
+
* the `COMMIT` tag), and the caller's transaction — if it is on another connection —
|
|
5
|
+
* would stay open, and the token would be issued before its COMMIT. This happens with
|
|
6
|
+
* a pool and with any wrapper that sends queries to a random connection.
|
|
7
7
|
*/
|
|
8
8
|
export declare class TransactionNotOpenError extends Error {
|
|
9
9
|
readonly name = "TransactionNotOpenError";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* COMMIT
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* There is no open transaction on the connection passed to `commitAndIssueToken`:
|
|
3
|
+
* COMMIT there would commit nothing (Postgres would answer with a warning with
|
|
4
|
+
* the `COMMIT` tag), and the caller's transaction — if it is on another connection —
|
|
5
|
+
* would stay open, and the token would be issued before its COMMIT. This happens with
|
|
6
|
+
* a pool and with any wrapper that sends queries to a random connection.
|
|
7
7
|
*/
|
|
8
8
|
export declare class TransactionNotOpenError extends Error {
|
|
9
9
|
readonly name = "TransactionNotOpenError";
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransactionNotOpenError = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* COMMIT
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* There is no open transaction on the connection passed to `commitAndIssueToken`:
|
|
6
|
+
* COMMIT there would commit nothing (Postgres would answer with a warning with
|
|
7
|
+
* the `COMMIT` tag), and the caller's transaction — if it is on another connection —
|
|
8
|
+
* would stay open, and the token would be issued before its COMMIT. This happens with
|
|
9
|
+
* a pool and with any wrapper that sends queries to a random connection.
|
|
10
10
|
*/
|
|
11
11
|
class TransactionNotOpenError extends Error {
|
|
12
12
|
name = 'TransactionNotOpenError';
|
|
13
13
|
constructor() {
|
|
14
|
-
super('commitAndIssueToken:
|
|
14
|
+
super('commitAndIssueToken: there is no open transaction on this connection — the client of the transaction in which the write went is required (not a pool and not a wrapper over a pool); a write without BEGIN — issueToken(client)');
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.TransactionNotOpenError = TransactionNotOpenError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-not-open.error.js","sourceRoot":"","sources":["../src/transaction-not-open.error.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,MAAa,uBAAwB,SAAQ,KAAK;IAC9B,IAAI,GAAG,yBAAyB,CAAC;IAEnD;QACE,KAAK,CACH,
|
|
1
|
+
{"version":3,"file":"transaction-not-open.error.js","sourceRoot":"","sources":["../src/transaction-not-open.error.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,MAAa,uBAAwB,SAAQ,KAAK;IAC9B,IAAI,GAAG,yBAAyB,CAAC;IAEnD;QACE,KAAK,CACH,iOAAiO,CAClO,CAAC;IACJ,CAAC;CACF;AARD,0DAQC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ProbeOutcome } from './probe-outcome.type.mjs';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* (
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* A state cache entry: the probe outcome, the moment after which it is evicted
|
|
4
|
+
* (the cache clock), the probe number (it grows with each probe of the router: "taken after
|
|
5
|
+
* the start of this read") and the moment of its start by the monotonic clock (the probe frequency
|
|
6
|
+
* ceiling).
|
|
7
7
|
*/
|
|
8
8
|
export interface CacheEntry {
|
|
9
9
|
readonly outcome: ProbeOutcome;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ProbeOutcome } from './probe-outcome.type';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* (
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* A state cache entry: the probe outcome, the moment after which it is evicted
|
|
4
|
+
* (the cache clock), the probe number (it grows with each probe of the router: "taken after
|
|
5
|
+
* the start of this read") and the moment of its start by the monotonic clock (the probe frequency
|
|
6
|
+
* ceiling).
|
|
7
7
|
*/
|
|
8
8
|
export interface CacheEntry {
|
|
9
9
|
readonly outcome: ProbeOutcome;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* A time source (ms). It is substituted in specs so that the ceilings are checked without
|
|
3
|
+
* waiting. The cache clock must return a finite number: a step back or a non-number
|
|
4
|
+
* evict the whole cache (what was taken by the previous clock proves nothing anymore).
|
|
5
5
|
*/
|
|
6
6
|
export type Clock = () => number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* A time source (ms). It is substituted in specs so that the ceilings are checked without
|
|
3
|
+
* waiting. The cache clock must return a finite number: a step back or a non-number
|
|
4
|
+
* evict the whole cache (what was taken by the previous clock proves nothing anymore).
|
|
5
5
|
*/
|
|
6
6
|
export type Clock = () => number;
|
|
7
7
|
//# sourceMappingURL=clock.type.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ExclusionReason } from './exclusion-reason.type.mjs';
|
|
2
2
|
import type { RouteDecision } from './route-decision.type.mjs';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* (
|
|
4
|
+
* The outcome of `confirm` on the read connection. `reason` is why the read server did not
|
|
5
|
+
* fit (`null` means it fitted); `error` means the confirmation query did not run
|
|
6
|
+
* (a refusal, the time ceiling): then `reason` is `unavailable`.
|
|
7
7
|
*/
|
|
8
8
|
export interface ConfirmEvent {
|
|
9
9
|
readonly decision: RouteDecision<unknown>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ExclusionReason } from './exclusion-reason.type';
|
|
2
2
|
import type { RouteDecision } from './route-decision.type';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* (
|
|
4
|
+
* The outcome of `confirm` on the read connection. `reason` is why the read server did not
|
|
5
|
+
* fit (`null` means it fitted); `error` means the confirmation query did not run
|
|
6
|
+
* (a refusal, the time ceiling): then `reason` is `unavailable`.
|
|
7
7
|
*/
|
|
8
8
|
export interface ConfirmEvent {
|
|
9
9
|
readonly decision: RouteDecision<unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WalPosition } from './wal-position.type.mjs';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* `issuedAt`
|
|
3
|
+
* The outcome of parsing a token: a position, "issued without a position" or a parse refusal.
|
|
4
|
+
* `issuedAt` is the issue moment, Unix epoch ms by the clock of the issuing process.
|
|
5
5
|
*/
|
|
6
6
|
export type DecodedToken = {
|
|
7
7
|
readonly kind: 'position';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WalPosition } from './wal-position.type';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* `issuedAt`
|
|
3
|
+
* The outcome of parsing a token: a position, "issued without a position" or a parse refusal.
|
|
4
|
+
* `issuedAt` is the issue moment, Unix epoch ms by the clock of the issuing process.
|
|
5
5
|
*/
|
|
6
6
|
export type DecodedToken = {
|
|
7
7
|
readonly kind: 'position';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExclusionReason } from './exclusion-reason.type.mjs';
|
|
2
2
|
import type { ReplicaNode } from './replica-node.type.mjs';
|
|
3
|
-
/**
|
|
3
|
+
/** A replica considered for a read: `reason === null` means it fits. */
|
|
4
4
|
export interface Evaluated<TTarget> {
|
|
5
5
|
readonly node: string;
|
|
6
6
|
readonly replica: ReplicaNode<TTarget>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExclusionReason } from './exclusion-reason.type';
|
|
2
2
|
import type { ReplicaNode } from './replica-node.type';
|
|
3
|
-
/**
|
|
3
|
+
/** A replica considered for a read: `reason === null` means it fits. */
|
|
4
4
|
export interface Evaluated<TTarget> {
|
|
5
5
|
readonly node: string;
|
|
6
6
|
readonly replica: ReplicaNode<TTarget>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluated.type.d.ts","sourceRoot":"","sources":["../../src/types/evaluated.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,
|
|
1
|
+
{"version":3,"file":"evaluated.type.d.ts","sourceRoot":"","sources":["../../src/types/evaluated.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wEAAwE;AACxE,MAAM,WAAW,SAAS,CAAC,OAAO;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;CACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclusion.type.d.ts","sourceRoot":"","sources":["../../src/types/exclusion.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,
|
|
1
|
+
{"version":3,"file":"exclusion.type.d.ts","sourceRoot":"","sources":["../../src/types/exclusion.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,kDAAkD;AAClD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;CAClC"}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* What the probe learned about a node. `null` means "could not determine": a decision by such a
|
|
3
|
+
* field is an exclusion of the replica, not an admission.
|
|
4
4
|
*/
|
|
5
5
|
export interface NodeState {
|
|
6
6
|
readonly inRecovery: boolean;
|
|
7
7
|
readonly systemId: string | null;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* The server instance: `system_identifier` and the postmaster start moment. It changes
|
|
10
|
+
* on every restart — a state taken before it no longer applies to the node.
|
|
11
11
|
*/
|
|
12
12
|
readonly instance: string | null;
|
|
13
|
-
/**
|
|
13
|
+
/** Replica: the replay position; primary: null. */
|
|
14
14
|
readonly replayLsn: bigint | null;
|
|
15
|
-
/**
|
|
15
|
+
/** Primary: the insert position; replica: null. */
|
|
16
16
|
readonly insertLsn: bigint | null;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Primary: the position for a token — the insert position, and if it stands right after
|
|
19
|
+
* a WAL page header (there is no record on the page yet), the page boundary:
|
|
20
|
+
* the end of the last record, which the replica replays. If the WAL layout was not
|
|
21
|
+
* determined — the insert position as is. Replica: null.
|
|
22
22
|
*/
|
|
23
23
|
readonly tokenLsn: bigint | null;
|
|
24
24
|
readonly timeline: number | null;
|
|
25
|
-
/**
|
|
25
|
+
/** Replica: a pause is requested or in effect; primary: false. */
|
|
26
26
|
readonly paused: boolean;
|
|
27
|
-
/**
|
|
27
|
+
/** The probe role sees `pg_stat_wal_receiver`. */
|
|
28
28
|
readonly hasStatsPrivilege: boolean;
|
|
29
|
-
/**
|
|
29
|
+
/** The probe connection has an open transaction with a write (a transaction number is assigned, COMMIT did not go through). */
|
|
30
30
|
readonly writePending: boolean;
|
|
31
31
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* What the probe learned about a node. `null` means "could not determine": a decision by such a
|
|
3
|
+
* field is an exclusion of the replica, not an admission.
|
|
4
4
|
*/
|
|
5
5
|
export interface NodeState {
|
|
6
6
|
readonly inRecovery: boolean;
|
|
7
7
|
readonly systemId: string | null;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* The server instance: `system_identifier` and the postmaster start moment. It changes
|
|
10
|
+
* on every restart — a state taken before it no longer applies to the node.
|
|
11
11
|
*/
|
|
12
12
|
readonly instance: string | null;
|
|
13
|
-
/**
|
|
13
|
+
/** Replica: the replay position; primary: null. */
|
|
14
14
|
readonly replayLsn: bigint | null;
|
|
15
|
-
/**
|
|
15
|
+
/** Primary: the insert position; replica: null. */
|
|
16
16
|
readonly insertLsn: bigint | null;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Primary: the position for a token — the insert position, and if it stands right after
|
|
19
|
+
* a WAL page header (there is no record on the page yet), the page boundary:
|
|
20
|
+
* the end of the last record, which the replica replays. If the WAL layout was not
|
|
21
|
+
* determined — the insert position as is. Replica: null.
|
|
22
22
|
*/
|
|
23
23
|
readonly tokenLsn: bigint | null;
|
|
24
24
|
readonly timeline: number | null;
|
|
25
|
-
/**
|
|
25
|
+
/** Replica: a pause is requested or in effect; primary: false. */
|
|
26
26
|
readonly paused: boolean;
|
|
27
|
-
/**
|
|
27
|
+
/** The probe role sees `pg_stat_wal_receiver`. */
|
|
28
28
|
readonly hasStatsPrivilege: boolean;
|
|
29
|
-
/**
|
|
29
|
+
/** The probe connection has an open transaction with a write (a transaction number is assigned, COMMIT did not go through). */
|
|
30
30
|
readonly writePending: boolean;
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=node-state.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-state.type.d.ts","sourceRoot":"","sources":["../../src/types/node-state.type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,
|
|
1
|
+
{"version":3,"file":"node-state.type.d.ts","sourceRoot":"","sources":["../../src/types/node-state.type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,+HAA+H;IAC/H,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* (`TransactionNotOpenError`),
|
|
6
|
-
* `{ query }`
|
|
2
|
+
* Cuts off a pool at the type level: `pg.Pool` has connection counters, a transaction
|
|
3
|
+
* client (`pg.Client`, `pg.PoolClient`) does not. A COMMIT through a pool would go to
|
|
4
|
+
* a random connection; at runtime such a call is rejected anyway
|
|
5
|
+
* (`TransactionNotOpenError`), and here already at compile time. A wrapper of the form
|
|
6
|
+
* `{ query }` is not cut off by the type: only the runtime catches it.
|
|
7
7
|
*/
|
|
8
8
|
export interface NotAPool {
|
|
9
9
|
readonly totalCount?: never;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* (`TransactionNotOpenError`),
|
|
6
|
-
* `{ query }`
|
|
2
|
+
* Cuts off a pool at the type level: `pg.Pool` has connection counters, a transaction
|
|
3
|
+
* client (`pg.Client`, `pg.PoolClient`) does not. A COMMIT through a pool would go to
|
|
4
|
+
* a random connection; at runtime such a call is rejected anyway
|
|
5
|
+
* (`TransactionNotOpenError`), and here already at compile time. A wrapper of the form
|
|
6
|
+
* `{ query }` is not cut off by the type: only the runtime catches it.
|
|
7
7
|
*/
|
|
8
8
|
export interface NotAPool {
|
|
9
9
|
readonly totalCount?: never;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProbeOutcome } from './probe-outcome.type.mjs';
|
|
2
|
-
/**
|
|
2
|
+
/** A node probe is done (for metrics: the number of probes, refusals, the latency). */
|
|
3
3
|
export interface ProbeEvent {
|
|
4
4
|
readonly node: string;
|
|
5
5
|
readonly outcome: ProbeOutcome;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProbeOutcome } from './probe-outcome.type';
|
|
2
|
-
/**
|
|
2
|
+
/** A node probe is done (for metrics: the number of probes, refusals, the latency). */
|
|
3
3
|
export interface ProbeEvent {
|
|
4
4
|
readonly node: string;
|
|
5
5
|
readonly outcome: ProbeOutcome;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe-event.type.d.ts","sourceRoot":"","sources":["../../src/types/probe-event.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"probe-event.type.d.ts","sourceRoot":"","sources":["../../src/types/probe-event.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,uFAAuF;AACvF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NodeState } from './node-state.type.mjs';
|
|
2
|
-
/**
|
|
2
|
+
/** The probe outcome: a state or a refusal (a connection, an error, the time ceiling, an illegible answer). */
|
|
3
3
|
export type ProbeOutcome = {
|
|
4
4
|
readonly ok: true;
|
|
5
5
|
readonly state: NodeState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NodeState } from './node-state.type';
|
|
2
|
-
/**
|
|
2
|
+
/** The probe outcome: a state or a refusal (a connection, an error, the time ceiling, an illegible answer). */
|
|
3
3
|
export type ProbeOutcome = {
|
|
4
4
|
readonly ok: true;
|
|
5
5
|
readonly state: NodeState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe-outcome.type.d.ts","sourceRoot":"","sources":["../../src/types/probe-outcome.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"probe-outcome.type.d.ts","sourceRoot":"","sources":["../../src/types/probe-outcome.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,+GAA+G;AAC/G,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProbeOutcome } from './probe-outcome.type.mjs';
|
|
2
|
-
/**
|
|
2
|
+
/** The probe outcome and its number: a number greater than the one taken at the start of a read means the probe started after it. */
|
|
3
3
|
export interface ProbeSample {
|
|
4
4
|
readonly outcome: ProbeOutcome;
|
|
5
5
|
readonly seq: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProbeOutcome } from './probe-outcome.type';
|
|
2
|
-
/**
|
|
2
|
+
/** The probe outcome and its number: a number greater than the one taken at the start of a read means the probe started after it. */
|
|
3
3
|
export interface ProbeSample {
|
|
4
4
|
readonly outcome: ProbeOutcome;
|
|
5
5
|
readonly seq: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe-sample.type.d.ts","sourceRoot":"","sources":["../../src/types/probe-sample.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"probe-sample.type.d.ts","sourceRoot":"","sources":["../../src/types/probe-sample.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qIAAqI;AACrI,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ClientConfig } from 'pg';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* A node: a name (a metric label), an address for the state probe and `target` — what
|
|
4
|
+
* the caller reads from this node with (its own pool, drizzle, anything). The probe goes
|
|
5
|
+
* through ITS OWN connection: it can be torn at the ceiling without touching the application pool.
|
|
6
6
|
*/
|
|
7
7
|
export interface ReplicaNode<TTarget> {
|
|
8
8
|
readonly name: string;
|
|
9
9
|
readonly connection: string | ClientConfig;
|
|
10
10
|
readonly target: TTarget;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* (
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* The address leads not to ONE server but to a balancer over several replicas
|
|
13
|
+
* (a "read only" service, a proxy, a cloud read endpoint). The probe sees one
|
|
14
|
+
* server, while a read goes to any of them, so a "replica" decision for such a node
|
|
15
|
+
* must be confirmed on the read connection: `decision.mustConfirm` and
|
|
16
16
|
* `router.confirm(decision, connection)`.
|
|
17
17
|
*/
|
|
18
18
|
readonly balanced?: boolean | undefined;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ClientConfig } from 'pg';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* A node: a name (a metric label), an address for the state probe and `target` — what
|
|
4
|
+
* the caller reads from this node with (its own pool, drizzle, anything). The probe goes
|
|
5
|
+
* through ITS OWN connection: it can be torn at the ceiling without touching the application pool.
|
|
6
6
|
*/
|
|
7
7
|
export interface ReplicaNode<TTarget> {
|
|
8
8
|
readonly name: string;
|
|
9
9
|
readonly connection: string | ClientConfig;
|
|
10
10
|
readonly target: TTarget;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* (
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* The address leads not to ONE server but to a balancer over several replicas
|
|
13
|
+
* (a "read only" service, a proxy, a cloud read endpoint). The probe sees one
|
|
14
|
+
* server, while a read goes to any of them, so a "replica" decision for such a node
|
|
15
|
+
* must be confirmed on the read connection: `decision.mustConfirm` and
|
|
16
16
|
* `router.confirm(decision, connection)`.
|
|
17
17
|
*/
|
|
18
18
|
readonly balanced?: boolean | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WalPosition } from './wal-position.type.mjs';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* What is required from a replica for this read: catch up with the token position or (without
|
|
4
|
+
* a token) not lag behind the primary more than the ceiling.
|
|
5
5
|
*/
|
|
6
6
|
export type ReplicaRequirement = {
|
|
7
7
|
readonly kind: 'position';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WalPosition } from './wal-position.type';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* What is required from a replica for this read: catch up with the token position or (without
|
|
4
|
+
* a token) not lag behind the primary more than the ceiling.
|
|
5
5
|
*/
|
|
6
6
|
export type ReplicaRequirement = {
|
|
7
7
|
readonly kind: 'position';
|