@delali/sirannon-db 0.3.4-next.62 → 0.3.4
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 +79 -56
- package/dist/backup/index.d.ts +44 -45
- package/dist/backup/index.mjs +7 -7
- package/dist/backup-scheduler/index.d.ts +42 -41
- package/dist/backup-scheduler/index.mjs +4 -4
- package/dist/baseline-Co3iIsN_.d.ts +19 -0
- package/dist/change-tracker-DqCdeEyx.d.ts +128 -0
- package/dist/{chunk-VOSJBZ6Q.mjs → chunk-2ES3DT4A.mjs} +71 -33
- package/dist/{chunk-6CMCO7S4.mjs → chunk-2O3PP4CF.mjs} +1 -1
- package/dist/{chunk-E7Q7HE46.mjs → chunk-3BZLZ47R.mjs} +26 -26
- package/dist/chunk-4KASJKKK.mjs +2501 -0
- package/dist/{chunk-MYNI2WFS.mjs → chunk-52XW3Z76.mjs} +40 -8
- package/dist/chunk-55YRLSM2.mjs +57 -0
- package/dist/{chunk-KDAHYFW7.mjs → chunk-6AOJCNRU.mjs} +5 -5
- package/dist/{chunk-KXTYR2OQ.mjs → chunk-A3PHCO6W.mjs} +39 -111
- package/dist/chunk-ADNWEHGZ.mjs +299 -0
- package/dist/{chunk-2QLXDHAP.mjs → chunk-BLMRNSUG.mjs} +11 -2
- package/dist/chunk-BVMZJOVM.mjs +5 -0
- package/dist/{chunk-IWGIYDMZ.mjs → chunk-BZWDPF4G.mjs} +1 -1
- package/dist/{chunk-YVF2ZJTE.mjs → chunk-CZL4D3BM.mjs} +1 -1
- package/dist/{chunk-7SC2TZAS.mjs → chunk-DX4WGJL7.mjs} +2 -2
- package/dist/{chunk-45MKELYA.mjs → chunk-ESTZZPT5.mjs} +132 -13
- package/dist/{chunk-QP5L5DFJ.mjs → chunk-FJPR2CJX.mjs} +3 -3
- package/dist/chunk-HR7K3GZW.mjs +36 -0
- package/dist/{chunk-LXCGPZPA.mjs → chunk-IEKIYO4V.mjs} +1 -1
- package/dist/{chunk-TUD5CJ76.mjs → chunk-KB4OLJAD.mjs} +26 -19
- package/dist/{chunk-PBRXXISQ.mjs → chunk-KINDFBQP.mjs} +3 -2
- package/dist/{chunk-E6IMX7RS.mjs → chunk-KJLNYOOL.mjs} +2 -2
- package/dist/{chunk-BTTFW4Z4.mjs → chunk-KU32OT4H.mjs} +2 -10
- package/dist/{chunk-JQWGHSEH.mjs → chunk-NVSQ2T5Q.mjs} +71 -70
- package/dist/{chunk-W4EUTJNT.mjs → chunk-NZGSDALX.mjs} +94 -96
- package/dist/{chunk-U445A3C4.mjs → chunk-QGVRRKB2.mjs} +1 -1
- package/dist/{chunk-GYCEJNU4.mjs → chunk-R7GBXNTO.mjs} +1 -1
- package/dist/{chunk-7C36BCSN.mjs → chunk-VDN6FHU4.mjs} +1 -1
- package/dist/{chunk-6IYS4WLH.mjs → chunk-VO3ZWA2G.mjs} +142 -115
- package/dist/chunk-WOMADPM4.mjs +12 -0
- package/dist/{chunk-OUSWVNWT.mjs → chunk-YCMB6GR4.mjs} +1 -1
- package/dist/{chunk-YNTDOFTN.mjs → chunk-YW7IKQ7T.mjs} +1 -1
- package/dist/{chunk-M2BEAH5I.mjs → chunk-ZN4HI5FK.mjs} +126 -72
- package/dist/{chunk-SBL6GN43.mjs → chunk-ZYWI45EN.mjs} +1 -1
- package/dist/client/index.d.ts +135 -137
- package/dist/client/index.mjs +177 -82
- package/dist/client/topology.d.ts +31 -31
- package/dist/client/topology.mjs +42 -23
- package/dist/client-base-BxTocU1x.d.ts +398 -0
- package/dist/client-streams-YKANXMWO.mjs +112 -0
- package/dist/codegen/cli.mjs +4 -4
- package/dist/codegen/index.d.ts +36 -29
- package/dist/codegen/index.mjs +4 -4
- package/dist/core/index.d.ts +130 -115
- package/dist/core/index.mjs +387 -297
- package/dist/core/writer-worker.mjs +3 -3
- package/dist/database-CGDsXW1K.d.ts +959 -0
- package/dist/database-backup-DcLhxoa1.d.ts +143 -0
- package/dist/driver/better-sqlite3.d.ts +11 -10
- package/dist/driver/better-sqlite3.mjs +11 -11
- package/dist/driver/bun.d.ts +9 -8
- package/dist/driver/expo.d.ts +6 -7
- package/dist/driver/node.d.ts +11 -10
- package/dist/driver/node.mjs +13 -11
- package/dist/driver/wa-sqlite.d.ts +6 -6
- package/dist/errors-CJUkQ-KL.d.ts +199 -0
- package/dist/file-migrations/index.d.ts +20 -18
- package/dist/file-migrations/index.mjs +3 -3
- package/dist/forward-rpc-VRWFZXHN.mjs +44 -0
- package/dist/operation-registry-CGhNT-Sn.d.ts +96 -0
- package/dist/primary-wins-CHNOYuN7.d.ts +81 -0
- package/dist/protocol-DFpNNsIT.d.ts +153 -0
- package/dist/query-types-5B02ixH0.d.ts +129 -0
- package/dist/react/index.d.ts +22 -22
- package/dist/replication/coordinator/etcd.d.ts +37 -31
- package/dist/replication/coordinator/etcd.mjs +296 -131
- package/dist/replication/index.d.ts +201 -161
- package/dist/replication/index.mjs +630 -529
- package/dist/restore-options-CH8mE-Tb.d.ts +84 -0
- package/dist/server/index.d.ts +201 -191
- package/dist/server/index.mjs +736 -619
- package/dist/server-options-aYtCkefX.d.ts +317 -0
- package/dist/server-streams-24XL4T43.mjs +254 -0
- package/dist/sirannon-J3EgPVD7.d.ts +179 -0
- package/dist/transport/grpc.d.ts +37 -24
- package/dist/transport/grpc.mjs +83 -3199
- package/dist/transport/memory.d.ts +25 -26
- package/dist/transport/memory.mjs +18 -9
- package/dist/types-BrAiDGOb.d.ts +505 -0
- package/dist/types-CEJG0eFS.d.ts +88 -0
- package/dist/types-Dc8oWlxj.d.ts +1580 -0
- package/dist/types-DqODKeOq.d.ts +123 -0
- package/dist/types-guEKSzMr.d.ts +367 -0
- package/package.json +7 -7
- package/dist/baseline-D93hcIEE.d.ts +0 -17
- package/dist/change-tracker-CjRFuZdB.d.ts +0 -144
- package/dist/client-base-Cmd9EVme.d.ts +0 -397
- package/dist/database-BLQvqjsw.d.ts +0 -917
- package/dist/database-backup-B7oszQ2n.d.ts +0 -141
- package/dist/errors-Dei4GdBb.d.ts +0 -196
- package/dist/operation-registry-oiPuSYI6.d.ts +0 -94
- package/dist/primary-wins-B0np8JS3.d.ts +0 -85
- package/dist/protocol-HI-nY8DD.d.ts +0 -152
- package/dist/query-types-p1liOP-b.d.ts +0 -127
- package/dist/restore-options-CksYsH1l.d.ts +0 -83
- package/dist/server-options-Bj5iJnjx.d.ts +0 -292
- package/dist/sirannon-BPxC5tC2.d.ts +0 -178
- package/dist/types-B0EhgDbr.d.ts +0 -340
- package/dist/types-CbjfRwrK.d.ts +0 -499
- package/dist/types-CjhxcjhA.d.ts +0 -123
- package/dist/types-DPSmjU54.d.ts +0 -1518
- package/dist/types-DTO4CYhW.d.ts +0 -88
package/dist/types-DPSmjU54.d.ts
DELETED
|
@@ -1,1518 +0,0 @@
|
|
|
1
|
-
import { P as Params, W as WriteConcern, R as ReadConcern, b as ChangeOperation, E as ExecuteResult, a as ReadConcernLevel } from './query-types-p1liOP-b.js';
|
|
2
|
-
|
|
3
|
-
/** One piece of a backup that a destination holds.
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
interface BackupPiece {
|
|
7
|
-
/** Position of this piece in the file, counted in whole pieces from zero. */
|
|
8
|
-
index: number;
|
|
9
|
-
/** Bytes this piece holds. */
|
|
10
|
-
byteLength: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Where Sirannon puts backup bytes and reads them back from. Sirannon carries
|
|
14
|
-
* no storage client, so a caller supplies these three operations and connects
|
|
15
|
-
* object storage, another machine, or anything else that moves bytes. Pieces
|
|
16
|
-
* are fixed in size and arrive in any order, because SQLite writes page one
|
|
17
|
-
* last. A backup chain uses more than one name, since its full copy, each
|
|
18
|
-
* change piece, and its own log are each stored under a name of their own.
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
interface BackupDestination {
|
|
23
|
-
/**
|
|
24
|
-
* Stores one piece of a named file. A second write to the same name and index
|
|
25
|
-
* must replace the piece already there, because a run that stops between
|
|
26
|
-
* storing a piece and recording it stores that piece again when it resumes.
|
|
27
|
-
*/
|
|
28
|
-
writePiece(name: string, index: number, bytes: Uint8Array): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Stores one piece only where that name and index hold none, and reports
|
|
31
|
-
* whether this call is the one that stored it. Sirannon claims each place in
|
|
32
|
-
* its list of chains through this, so two nodes writing at once keep both
|
|
33
|
-
* chains. Leave it out and Sirannon writes the record and reads it back
|
|
34
|
-
* instead, which loses a chain where the other node's write lands between
|
|
35
|
-
* those two calls.
|
|
36
|
-
*/
|
|
37
|
-
writePieceIfAbsent?(name: string, index: number, bytes: Uint8Array): Promise<boolean>;
|
|
38
|
-
/** Returns one piece of a named file. */
|
|
39
|
-
readPiece(name: string, index: number): Promise<Uint8Array>;
|
|
40
|
-
/** Returns every piece a named file has, in any order. */
|
|
41
|
-
listPieces(name: string): Promise<BackupPiece[]>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Name a destination stores the list of chains under, unless you set another.
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
declare const DEFAULT_CHAIN_NAME = "sirannon-backup-chain";
|
|
48
|
-
/** The stretch of a database's write-ahead log that one change piece covers.
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
interface BackupChainPosition {
|
|
52
|
-
/** Checkpoint sequence of the log these frames came from. SQLite adds one to it at every restart of the log. */
|
|
53
|
-
logSequence: number;
|
|
54
|
-
/** First salt of that log. The two salts together tell one run of the log from the next. */
|
|
55
|
-
salt1: number;
|
|
56
|
-
/** Second salt of it. */
|
|
57
|
-
salt2: number;
|
|
58
|
-
/** First frame in the piece, counted from one. */
|
|
59
|
-
firstFrame: number;
|
|
60
|
-
/** Last frame in it. */
|
|
61
|
-
lastFrame: number;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* The full copy at the head of a chain. A restore starts from this copy and
|
|
65
|
-
* replays the change pieces on top of it.
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
interface BackupChainBase {
|
|
70
|
-
/** Which kind of record this is. */
|
|
71
|
-
kind: 'full';
|
|
72
|
-
/** The chain this copy begins. */
|
|
73
|
-
chainId: string;
|
|
74
|
-
/** Name its pieces are stored under at the destination. */
|
|
75
|
-
name: string;
|
|
76
|
-
/** Identifier the run reported its progress under. */
|
|
77
|
-
runId: string;
|
|
78
|
-
/** Epoch milliseconds the copy finished. Any earlier moment needs an older chain. */
|
|
79
|
-
finishedAt: number;
|
|
80
|
-
/** How many pieces the copy came to. */
|
|
81
|
-
pieceCount: number;
|
|
82
|
-
/** Size of one whole piece, in bytes. */
|
|
83
|
-
pieceBytes: number;
|
|
84
|
-
/** How many bytes reached the destination. */
|
|
85
|
-
bytesWritten: number;
|
|
86
|
-
/** SHA-256 of the copy, unless fingerprinting was turned off. */
|
|
87
|
-
fingerprint?: string;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* One capture: the log frames a database wrote between the piece before this
|
|
91
|
-
* one and this one.
|
|
92
|
-
*
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
interface BackupChainChange {
|
|
96
|
-
/** Which kind of record this is. */
|
|
97
|
-
kind: 'change';
|
|
98
|
-
/** The chain this piece extends, which names the full copy underneath it. */
|
|
99
|
-
chainId: string;
|
|
100
|
-
/** Name it is stored under at the destination. */
|
|
101
|
-
name: string;
|
|
102
|
-
/** Identifier the capture reported its progress under. */
|
|
103
|
-
runId: string;
|
|
104
|
-
/** Where this piece comes in its chain, counted from one. */
|
|
105
|
-
sequence: number;
|
|
106
|
-
/** The stretch of log it covers. */
|
|
107
|
-
position: BackupChainPosition;
|
|
108
|
-
/** Epoch milliseconds the capture took the frames. A restore aims at moments like this one. */
|
|
109
|
-
capturedAt: number;
|
|
110
|
-
/** How many frames it holds. */
|
|
111
|
-
frameCount: number;
|
|
112
|
-
/** How many pieces the transfer came to. */
|
|
113
|
-
pieceCount: number;
|
|
114
|
-
/** Size of one whole piece, in bytes. */
|
|
115
|
-
pieceBytes: number;
|
|
116
|
-
/** How many bytes reached the destination. */
|
|
117
|
-
bytesWritten: number;
|
|
118
|
-
/** Whether the checkpoint after this capture emptied the log. */
|
|
119
|
-
checkpointed: boolean;
|
|
120
|
-
/** SHA-256 of the frames, unless fingerprinting was turned off. */
|
|
121
|
-
fingerprint?: string;
|
|
122
|
-
}
|
|
123
|
-
/** Either the full copy at the head of a chain or one change piece along it.
|
|
124
|
-
* @public
|
|
125
|
-
*/
|
|
126
|
-
type BackupChainRecord = BackupChainBase | BackupChainChange;
|
|
127
|
-
/** One full copy and every change piece taken from it.
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
|
-
interface BackupChain {
|
|
131
|
-
/** Identifier of this chain. */
|
|
132
|
-
chainId: string;
|
|
133
|
-
/** Epoch milliseconds it started. */
|
|
134
|
-
startedAt: number;
|
|
135
|
-
/** The chain this one replaced, where it replaced one. */
|
|
136
|
-
previousChainId?: string;
|
|
137
|
-
/**
|
|
138
|
-
* The full copy underneath. Once someone deletes that record the field is
|
|
139
|
-
* absent, and no restore can use the chain any more.
|
|
140
|
-
*/
|
|
141
|
-
base?: BackupChainBase;
|
|
142
|
-
/** The change pieces, oldest first. */
|
|
143
|
-
changes: BackupChainChange[];
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Names the file one chain stores its own records under. Each chain gets a name
|
|
147
|
-
* of its own, so deleting an old chain leaves the rest of the destination
|
|
148
|
-
* alone.
|
|
149
|
-
*
|
|
150
|
-
* @param chainName - Name the list of chains is stored under.
|
|
151
|
-
* @param chainId - Identifier of the chain.
|
|
152
|
-
* @returns The name to read and write that chain's records under.
|
|
153
|
-
*
|
|
154
|
-
* @public
|
|
155
|
-
*/
|
|
156
|
-
declare function chainLogName(chainName: string, chainId: string): string;
|
|
157
|
-
/**
|
|
158
|
-
* Tells you what a destination holds: every chain, its full copy, and every
|
|
159
|
-
* change piece taken from it. This reads nothing but the destination, so a
|
|
160
|
-
* restore on a fresh machine can call it before any database exists.
|
|
161
|
-
*
|
|
162
|
-
* @param destination - Where the backups and their records are stored.
|
|
163
|
-
* @param chainName - Name the list of chains is stored under. Defaults to `sirannon-backup-chain`.
|
|
164
|
-
* @returns The chains, newest first, each with its own records oldest first.
|
|
165
|
-
*
|
|
166
|
-
* @public
|
|
167
|
-
*/
|
|
168
|
-
declare function readBackupChains(destination: BackupDestination, chainName?: string): Promise<BackupChain[]>;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Which node of a replication group takes its backups.
|
|
172
|
-
*
|
|
173
|
-
* `'replica'` prefers a replica and falls back to the primary where the group
|
|
174
|
-
* has no other node to offer. `'primary'` puts the backups on the node the
|
|
175
|
-
* group names primary, and leaves them to no node at all while that node is out
|
|
176
|
-
* of service. An object names one node outright. A node matching itself against that name
|
|
177
|
-
* needs no coordinator to answer.
|
|
178
|
-
*
|
|
179
|
-
* @public
|
|
180
|
-
*/
|
|
181
|
-
type BackupNodePreference = 'replica' | 'primary' | {
|
|
182
|
-
nodeId: string;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Who a replication group names primary, and which of its nodes hold data
|
|
186
|
-
* current enough to back up.
|
|
187
|
-
*
|
|
188
|
-
* @public
|
|
189
|
-
*/
|
|
190
|
-
interface BackupGroupMembership {
|
|
191
|
-
/** Identifier of the primary, or null while the group names none. */
|
|
192
|
-
primaryNodeId: string | null;
|
|
193
|
-
/** Identifiers of the nodes eligible to take the backup. */
|
|
194
|
-
nodeIds: string[];
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Where the cycle reads this node's identity and its replication group's
|
|
198
|
-
* membership. A database opened without one backs itself up every turn, which
|
|
199
|
-
* is the answer a single-node deployment wants.
|
|
200
|
-
*
|
|
201
|
-
* `coordinatorBackupGroup` in the replication entry builds one of these over a
|
|
202
|
-
* cluster coordinator. Write your own where the membership you trust lives
|
|
203
|
-
* somewhere else.
|
|
204
|
-
*
|
|
205
|
-
* @public
|
|
206
|
-
*/
|
|
207
|
-
interface BackupGroupSource {
|
|
208
|
-
/** Identifier this node is known by inside the group. */
|
|
209
|
-
readonly nodeId: string;
|
|
210
|
-
/**
|
|
211
|
-
* Reads the group's membership as it stands right now.
|
|
212
|
-
*
|
|
213
|
-
* @returns Who the group names primary, and which nodes are eligible.
|
|
214
|
-
*/
|
|
215
|
-
readMembership(): Promise<BackupGroupMembership>;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Why one turn of the cycle wrote nothing.
|
|
219
|
-
*
|
|
220
|
-
* `'not-preferred'` means another node takes this group's backups.
|
|
221
|
-
* `'group-unavailable'` means this node could not read the membership it
|
|
222
|
-
* decides from. `'previous-run-active'` means the turn before this one had yet
|
|
223
|
-
* to finish.
|
|
224
|
-
*
|
|
225
|
-
* @public
|
|
226
|
-
*/
|
|
227
|
-
type BackupSkipReason = 'not-preferred' | 'group-unavailable' | 'previous-run-active';
|
|
228
|
-
/**
|
|
229
|
-
* One turn the cycle skipped, and what it skipped for.
|
|
230
|
-
*
|
|
231
|
-
* @public
|
|
232
|
-
*/
|
|
233
|
-
interface BackupSkip {
|
|
234
|
-
/** Which of the three conditions held. */
|
|
235
|
-
reason: BackupSkipReason;
|
|
236
|
-
/** What happened, in a sentence an operator can read in a log. */
|
|
237
|
-
message: string;
|
|
238
|
-
/** Identifier of this node, where a group source named one. */
|
|
239
|
-
nodeId?: string;
|
|
240
|
-
/** Identifier of the node whose turn it was, where the group named one. */
|
|
241
|
-
preferredNodeId?: string;
|
|
242
|
-
/**
|
|
243
|
-
* How many bytes of write-ahead log this node was holding when it skipped.
|
|
244
|
-
* Alert on this figure rising and you hear about a node holding its log long
|
|
245
|
-
* before `maxUncapturedLogBytes` ends its chain.
|
|
246
|
-
*/
|
|
247
|
-
uncapturedLogBytes?: number;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Where a database's write-ahead log had reached at one moment.
|
|
252
|
-
*
|
|
253
|
-
* A full copy states this, so you can tell which run of the log the database
|
|
254
|
-
* was on when that copy finished. SQLite stamps a fresh pair of salts on the
|
|
255
|
-
* log at every restart, and a checkpoint that empties the log restarts it.
|
|
256
|
-
*
|
|
257
|
-
* The checkpoint cycle checkpoints after each capture, and no checkpoint falls
|
|
258
|
-
* between a full copy and the first change piece extending its chain, so those
|
|
259
|
-
* two state the same salts. A change piece states later salts than the piece
|
|
260
|
-
* before it whenever the checkpoint between the two emptied the log. A reader
|
|
261
|
-
* can hold a checkpoint off, which leaves the log on the run it was already on,
|
|
262
|
-
* so two consecutive change pieces may state the same salts.
|
|
263
|
-
*
|
|
264
|
-
* @public
|
|
265
|
-
*/
|
|
266
|
-
interface BackupLogPosition {
|
|
267
|
-
/** Checkpoint sequence of the log. SQLite adds one to it at every restart of the log. */
|
|
268
|
-
logSequence: number;
|
|
269
|
-
/** First salt of that log. The two salts together tell one run of the log from the next. */
|
|
270
|
-
salt1: number;
|
|
271
|
-
/** Second salt of it. */
|
|
272
|
-
salt2: number;
|
|
273
|
-
/** The last frame that commits a transaction, counted from one. A log holding none reports zero. */
|
|
274
|
-
lastFrame: number;
|
|
275
|
-
}
|
|
276
|
-
/** How far one backup run has moved, reported at step resolution.
|
|
277
|
-
* @public
|
|
278
|
-
*/
|
|
279
|
-
interface BackupProgress {
|
|
280
|
-
/** Identifier of the run this progress belongs to. */
|
|
281
|
-
runId: string;
|
|
282
|
-
/** Whether the run is copying pages or sending pieces. */
|
|
283
|
-
phase: 'copy' | 'transfer';
|
|
284
|
-
/** Pages the copy has to move in total. A change piece reports the number of log frames it covers. */
|
|
285
|
-
totalPages: number;
|
|
286
|
-
/** Pages the copy has yet to move. Every report of the transfer phase states zero, since the copy has finished by then. */
|
|
287
|
-
remainingPages: number;
|
|
288
|
-
/** Times the copy has returned to page one. A change piece reports zero, since it reads the log and copies no pages. */
|
|
289
|
-
restarts: number;
|
|
290
|
-
/** Pieces the run has stored at the destination. */
|
|
291
|
-
piecesWritten: number;
|
|
292
|
-
/** Bytes the run has stored at the destination. */
|
|
293
|
-
bytesWritten: number;
|
|
294
|
-
}
|
|
295
|
-
/** What one finished backup run produced.
|
|
296
|
-
* @public
|
|
297
|
-
*/
|
|
298
|
-
interface BackupRunReport {
|
|
299
|
-
/** Identifier this run reports its progress under. */
|
|
300
|
-
runId: string;
|
|
301
|
-
/** Database the copy was taken from. */
|
|
302
|
-
databaseId: string;
|
|
303
|
-
/** File the copy was taken from. */
|
|
304
|
-
sourcePath: string;
|
|
305
|
-
/** What the run wrote: the whole database, or the log frames written since the run before it. */
|
|
306
|
-
kind: 'full' | 'change';
|
|
307
|
-
/** The chain this run belongs to. A full copy begins one, and every change piece after it extends the same one. */
|
|
308
|
-
chainId: string;
|
|
309
|
-
/** Whether the bytes reached the destination through a local file or without one. */
|
|
310
|
-
route: 'staged' | 'streamed';
|
|
311
|
-
/**
|
|
312
|
-
* Name the pieces are stored under at the destination. A run writes this one
|
|
313
|
-
* name and no other, because the journal SQLite opens beside a copy stays on
|
|
314
|
-
* local disk.
|
|
315
|
-
*/
|
|
316
|
-
destinationName: string;
|
|
317
|
-
/** Epoch milliseconds the run started at. */
|
|
318
|
-
startedAt: number;
|
|
319
|
-
/** Epoch milliseconds the run finished at. */
|
|
320
|
-
finishedAt: number;
|
|
321
|
-
/** Milliseconds the whole run took. */
|
|
322
|
-
durationMs: number;
|
|
323
|
-
/** Milliseconds SQLite spent copying pages. */
|
|
324
|
-
copyMs: number;
|
|
325
|
-
/** Milliseconds the pieces took to reach the destination. */
|
|
326
|
-
transferMs: number;
|
|
327
|
-
/** Pages the copy moved. */
|
|
328
|
-
pageCount: number;
|
|
329
|
-
/** Bytes one page holds. */
|
|
330
|
-
pageSize: number;
|
|
331
|
-
/** Bytes the run stored at the destination. */
|
|
332
|
-
bytesWritten: number;
|
|
333
|
-
/** Pieces the run stored at the destination. */
|
|
334
|
-
pieceCount: number;
|
|
335
|
-
/** Bytes one whole piece holds. */
|
|
336
|
-
pieceBytes: number;
|
|
337
|
-
/** Times the copy returned to page one. */
|
|
338
|
-
restarts: number;
|
|
339
|
-
/** The stretch of log a change piece covers. A full copy has none. */
|
|
340
|
-
position?: BackupChainPosition;
|
|
341
|
-
/**
|
|
342
|
-
* Where the write-ahead log had reached when a full copy finished. Sirannon
|
|
343
|
-
* reads the log after the copy has moved every page, so a writer committing
|
|
344
|
-
* between those two steps would put a frame here that the copy does not hold.
|
|
345
|
-
* A change piece states the stretch of log it holds in
|
|
346
|
-
* {@link BackupRunReport.position}, and a database that keeps no write-ahead
|
|
347
|
-
* log states neither.
|
|
348
|
-
*/
|
|
349
|
-
logPosition?: BackupLogPosition;
|
|
350
|
-
/** SHA-256 of the copied file, unless the caller turned it off. */
|
|
351
|
-
fingerprint?: string;
|
|
352
|
-
}
|
|
353
|
-
/** What one finished copy to a local file produced.
|
|
354
|
-
* @public
|
|
355
|
-
*/
|
|
356
|
-
interface BackupFileReport {
|
|
357
|
-
/** Identifier this run is known by. */
|
|
358
|
-
runId: string;
|
|
359
|
-
/** Database the copy was taken from. */
|
|
360
|
-
databaseId: string;
|
|
361
|
-
/** File the copy was taken from. */
|
|
362
|
-
sourcePath: string;
|
|
363
|
-
/** Absolute path of the file the copy was written to. */
|
|
364
|
-
destPath: string;
|
|
365
|
-
/** Epoch milliseconds the copy started at. */
|
|
366
|
-
startedAt: number;
|
|
367
|
-
/** Epoch milliseconds it finished at. */
|
|
368
|
-
finishedAt: number;
|
|
369
|
-
/** Milliseconds it took. */
|
|
370
|
-
durationMs: number;
|
|
371
|
-
/** Pages it moved. */
|
|
372
|
-
pageCount: number;
|
|
373
|
-
/** Bytes one page holds. */
|
|
374
|
-
pageSize: number;
|
|
375
|
-
/** Bytes the file it wrote holds. */
|
|
376
|
-
byteLength: number;
|
|
377
|
-
/** Times the copy returned to page one. */
|
|
378
|
-
restarts: number;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* What one copy to a local file produced. The controller that owns the database
|
|
382
|
-
* adds its identifier and its path to build a {@link BackupFileReport}.
|
|
383
|
-
*
|
|
384
|
-
* @internal
|
|
385
|
-
*/
|
|
386
|
-
type BackupFileCopy = Omit<BackupFileReport, 'databaseId' | 'sourcePath'>;
|
|
387
|
-
/** How Sirannon runs one backup to a caller-supplied destination.
|
|
388
|
-
* @public
|
|
389
|
-
*/
|
|
390
|
-
interface BackupToDestinationOptions {
|
|
391
|
-
/** Where the pieces go and where a restore reads them from. */
|
|
392
|
-
destination: BackupDestination;
|
|
393
|
-
/** Name the pieces are stored under. Defaults to a timestamped name. */
|
|
394
|
-
name?: string;
|
|
395
|
-
/** The chain this copy begins. Defaults to an identifier the run mints for itself. */
|
|
396
|
-
chainId?: string;
|
|
397
|
-
/**
|
|
398
|
-
* Bytes one whole piece holds. Defaults to 16 MiB. A streamed copy hands
|
|
399
|
-
* SQLite whole 512-byte blocks, so it needs a size that divides by 512.
|
|
400
|
-
*/
|
|
401
|
-
pieceBytes?: number;
|
|
402
|
-
/** Pages SQLite moves in one step. */
|
|
403
|
-
pagesPerStep?: number;
|
|
404
|
-
/** Restarts the copy survives before it stops with an error. */
|
|
405
|
-
restartLimit?: number;
|
|
406
|
-
/** Milliseconds the copy may move no pages before it stops with an error. */
|
|
407
|
-
stallTimeoutMs?: number;
|
|
408
|
-
/** Milliseconds one call to the destination may take before the run stops with an error. Defaults to 10 minutes, and zero leaves the calls unbounded. */
|
|
409
|
-
destinationTimeoutMs?: number;
|
|
410
|
-
/** Steps the copy may take without moving a page it had not already moved. */
|
|
411
|
-
noProgressStepLimit?: number;
|
|
412
|
-
/** Directory the staged route writes its local file in. Defaults to the system temporary directory. */
|
|
413
|
-
stagingDir?: string;
|
|
414
|
-
/**
|
|
415
|
-
* Whether the run fingerprints what it wrote. Defaults to true. A streamed
|
|
416
|
-
* copy reads every piece back from the destination to compute it, because it
|
|
417
|
-
* never holds the whole file, so a run to remote storage pays for that read.
|
|
418
|
-
*/
|
|
419
|
-
fingerprint?: boolean;
|
|
420
|
-
/** Called at step resolution while the run proceeds. */
|
|
421
|
-
onProgress?: (progress: BackupProgress) => void;
|
|
422
|
-
}
|
|
423
|
-
/** What one backup run needs beyond the caller's own options.
|
|
424
|
-
* @internal
|
|
425
|
-
*/
|
|
426
|
-
interface BackupRunRequest extends BackupToDestinationOptions {
|
|
427
|
-
/** Database the copy is taken from. */
|
|
428
|
-
databaseId: string;
|
|
429
|
-
/** File the copy is taken from. */
|
|
430
|
-
sourcePath: string;
|
|
431
|
-
/** Called once the copy's first step is done, so the writer lock can be handed back. */
|
|
432
|
-
onFirstStep?: () => void;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* How Sirannon runs the cycle that captures a database's change log and then
|
|
437
|
-
* checkpoints it.
|
|
438
|
-
*
|
|
439
|
-
* A database given these options takes checkpointing away from SQLite. It has
|
|
440
|
-
* to: a checkpoint lets SQLite overwrite log frames nothing has captured yet,
|
|
441
|
-
* and it reports success either way.
|
|
442
|
-
*
|
|
443
|
-
* @public
|
|
444
|
-
*/
|
|
445
|
-
interface BackupCycleOptions {
|
|
446
|
-
/** Where the full copy, the change pieces, and the chain records go. */
|
|
447
|
-
destination: BackupDestination;
|
|
448
|
-
/**
|
|
449
|
-
* How long to wait between captures, in milliseconds. Defaults to 60000. The
|
|
450
|
-
* shorter this is, the smaller the log grows and the fewer writes an unclean
|
|
451
|
-
* stop leaves uncaptured. At zero the cycle runs only when you ask it to.
|
|
452
|
-
*/
|
|
453
|
-
intervalMs?: number;
|
|
454
|
-
/**
|
|
455
|
-
* How long a chain runs before a fresh full copy starts a new one, in
|
|
456
|
-
* milliseconds. Defaults to 24 hours. Restoring means replaying every piece
|
|
457
|
-
* since the full copy, so this is what bounds how long that takes.
|
|
458
|
-
*/
|
|
459
|
-
fullCopyIntervalMs?: number;
|
|
460
|
-
/** Name to store the list of chains under. Defaults to `sirannon-backup-chain`. */
|
|
461
|
-
chainName?: string;
|
|
462
|
-
/** What to name the backups after at the destination. Defaults to `sirannon-backup`. */
|
|
463
|
-
namePrefix?: string;
|
|
464
|
-
/** Size of one whole piece, in bytes. Defaults to 16 MiB. */
|
|
465
|
-
pieceBytes?: number;
|
|
466
|
-
/** Whether to fingerprint each backup. Defaults to true. */
|
|
467
|
-
fingerprint?: boolean;
|
|
468
|
-
/**
|
|
469
|
-
* Where to stage a capture before it goes out, and where the full copy writes
|
|
470
|
-
* its own local file. Defaults to a directory beside the database file, so a
|
|
471
|
-
* capture that has yet to go out is still there after a restart.
|
|
472
|
-
*/
|
|
473
|
-
stagingDir?: string;
|
|
474
|
-
/** How many pages SQLite moves in one step of the full copy. */
|
|
475
|
-
pagesPerStep?: number;
|
|
476
|
-
/** How many restarts the full copy tolerates before it gives up. */
|
|
477
|
-
restartLimit?: number;
|
|
478
|
-
/** How long the full copy may move no pages at all, in milliseconds, before it gives up. */
|
|
479
|
-
stallTimeoutMs?: number;
|
|
480
|
-
/** How long one call to the destination may take, in milliseconds, before the cycle gives up on it. Defaults to 10 minutes, and zero leaves the calls unbounded. */
|
|
481
|
-
destinationTimeoutMs?: number;
|
|
482
|
-
/**
|
|
483
|
-
* How large the write-ahead log may grow while the cycle captures nothing, in
|
|
484
|
-
* bytes. It is unlimited by default, which keeps the chain whole and lets the
|
|
485
|
-
* log grow for as long as the stall lasts.
|
|
486
|
-
*
|
|
487
|
-
* Set it where the disk matters more than the chain. Sirannon measures the
|
|
488
|
-
* log after any turn that captured nothing. Past this figure it empties that
|
|
489
|
-
* log and reports `BACKUP_CHAIN_BROKEN`, so the writes the log held reach no
|
|
490
|
-
* backup and the next turn that can run starts a fresh chain with a full
|
|
491
|
-
* copy.
|
|
492
|
-
*/
|
|
493
|
-
maxUncapturedLogBytes?: number;
|
|
494
|
-
/** How many steps the full copy may take without reaching a page it had not already copied. */
|
|
495
|
-
noProgressStepLimit?: number;
|
|
496
|
-
/**
|
|
497
|
-
* Where this node reads its own identity and its replication group's
|
|
498
|
-
* membership. Every node of a group carries the same cycle, and this is what
|
|
499
|
-
* one turn asks before it copies anything. Leave it out on a single-node
|
|
500
|
-
* deployment, where every turn belongs to the only node there is.
|
|
501
|
-
*/
|
|
502
|
-
replicationGroup?: BackupGroupSource;
|
|
503
|
-
/**
|
|
504
|
-
* Which node of that group takes its backups. Defaults to `'replica'`, so
|
|
505
|
-
* the node serving writes keeps serving them. A group with no other node
|
|
506
|
-
* falls back to its primary.
|
|
507
|
-
*/
|
|
508
|
-
preferredNode?: BackupNodePreference;
|
|
509
|
-
/** Called with the report of every backup the cycle finishes. */
|
|
510
|
-
onRun?: (report: BackupRunReport) => void;
|
|
511
|
-
/**
|
|
512
|
-
* Called at step resolution while a turn proceeds, with the counters that
|
|
513
|
-
* turn has reached. A caller sending a large full copy to remote storage
|
|
514
|
-
* drives its own reporting from these. The cycle also records the latest
|
|
515
|
-
* figures as they arrive, so take this callback where you want every step,
|
|
516
|
-
* and read the cycle's status where you want the figure as it stands.
|
|
517
|
-
*/
|
|
518
|
-
onProgress?: (progress: BackupProgress) => void;
|
|
519
|
-
/**
|
|
520
|
-
* Called with every turn the cycle passed over, and what it passed it over
|
|
521
|
-
* for. A node that takes none of its group's backups reports one of these
|
|
522
|
-
* each turn.
|
|
523
|
-
*/
|
|
524
|
-
onSkip?: (skip: BackupSkip) => void;
|
|
525
|
-
/**
|
|
526
|
-
* Called when a capture, a transfer, or a checkpoint fails. Set this one. A
|
|
527
|
-
* cycle that stops running while writes carry on lets the log grow without
|
|
528
|
-
* bound, and without a callback here nothing reports that.
|
|
529
|
-
*/
|
|
530
|
-
onError?: (error: Error) => void;
|
|
531
|
-
}
|
|
532
|
-
/** What the cycle needs beyond the operator's own options.
|
|
533
|
-
* @internal
|
|
534
|
-
*/
|
|
535
|
-
interface BackupCycleRequest extends BackupCycleOptions {
|
|
536
|
-
/** Identifier of the database to capture from. */
|
|
537
|
-
databaseId: string;
|
|
538
|
-
/** Path of its file. */
|
|
539
|
-
sourcePath: string;
|
|
540
|
-
/** Runs an operation with nothing else holding the writer. */
|
|
541
|
-
runExclusive: (op: () => Promise<void>) => Promise<void>;
|
|
542
|
-
/** Hands back the connection that writes. No other connection may checkpoint. */
|
|
543
|
-
acquireWriter: () => SQLiteConnection;
|
|
544
|
-
/** Copies the whole database to the destination. Every chain starts with one of these. */
|
|
545
|
-
fullCopy: (options: BackupToDestinationOptions) => Promise<BackupRunReport>;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
/** A failure one turn of the cycle raised.
|
|
549
|
-
* @public
|
|
550
|
-
*/
|
|
551
|
-
interface BackupCycleError {
|
|
552
|
-
/** Code the failure states, which is what a caller matches on. */
|
|
553
|
-
code: string;
|
|
554
|
-
/** What happened, in a sentence an operator can read in a log. */
|
|
555
|
-
message: string;
|
|
556
|
-
/** Epoch milliseconds the cycle raised it. */
|
|
557
|
-
at: number;
|
|
558
|
-
/** Milliseconds from the start of the turn to the failure. */
|
|
559
|
-
durationMs: number;
|
|
560
|
-
/** The chain the cycle was extending, where it held one. */
|
|
561
|
-
chainId?: string;
|
|
562
|
-
/**
|
|
563
|
-
* How far the run had got when it failed. A turn that fails before its copy
|
|
564
|
-
* begins states none. A turn that fails part-way through states the run
|
|
565
|
-
* identifier, the pages it still had to move, and the pieces and bytes that
|
|
566
|
-
* had already reached the destination.
|
|
567
|
-
*/
|
|
568
|
-
progress?: BackupProgress;
|
|
569
|
-
}
|
|
570
|
-
/** What the cycle is doing now, and what its recent turns produced.
|
|
571
|
-
* @public
|
|
572
|
-
*/
|
|
573
|
-
interface BackupCycleStatus {
|
|
574
|
-
/** Whether a turn is under way. */
|
|
575
|
-
running: boolean;
|
|
576
|
-
/** The chain the cycle is extending, where it has one. */
|
|
577
|
-
chainId?: string;
|
|
578
|
-
/** How far the turn under way has got. It is absent between turns. */
|
|
579
|
-
progress?: BackupProgress;
|
|
580
|
-
/** What the most recent turn that wrote anything produced. */
|
|
581
|
-
lastRun?: BackupRunReport;
|
|
582
|
-
/** The most recent turn the cycle passed over, and what it passed that turn over for. */
|
|
583
|
-
lastSkip?: BackupSkip;
|
|
584
|
-
/** The most recent failure a turn raised. */
|
|
585
|
-
lastError?: BackupCycleError;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
/** What Sirannon found when it read one stored backup back out of a destination.
|
|
589
|
-
* @public
|
|
590
|
-
*/
|
|
591
|
-
interface BackupVerifyResult {
|
|
592
|
-
/** Name the pieces are stored under. */
|
|
593
|
-
name: string;
|
|
594
|
-
/** The chain this record belongs to. */
|
|
595
|
-
chainId: string;
|
|
596
|
-
/** Whether this is the full copy at the head of that chain or one change piece along it. */
|
|
597
|
-
kind: 'full' | 'change';
|
|
598
|
-
/** How many pieces the destination stored. */
|
|
599
|
-
pieceCount: number;
|
|
600
|
-
/** How many bytes those pieces add up to. */
|
|
601
|
-
bytesRead: number;
|
|
602
|
-
/** The SHA-256 Sirannon computed over what it read, where the backup recorded one to compare it against. */
|
|
603
|
-
fingerprint?: string;
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Reads one backup back out of the destination and compares it against the
|
|
607
|
-
* record the backup that wrote it left behind.
|
|
608
|
-
*
|
|
609
|
-
* A restore would fail on a damaged piece only once that restore had already
|
|
610
|
-
* begun, so an operator calls this beforehand. Sirannon fetches every piece in
|
|
611
|
-
* order and folds a SHA-256 over the bytes as they arrive, then compares that
|
|
612
|
-
* digest and the byte count against the record. Only one piece is in memory at
|
|
613
|
-
* any moment, and Sirannon writes none of them to disk, so a check over a large
|
|
614
|
-
* full copy needs no local storage of its own.
|
|
615
|
-
*
|
|
616
|
-
* A missing piece, a byte count that differs from the recorded one, and a
|
|
617
|
-
* digest that differs from the recorded one will each fail with
|
|
618
|
-
* `BACKUP_DESTINATION_ERROR`. Where the backup turned fingerprinting off, the
|
|
619
|
-
* piece listing and the byte count are the whole comparison, and the result
|
|
620
|
-
* reports no fingerprint.
|
|
621
|
-
*
|
|
622
|
-
* @param destination - Where the pieces are stored.
|
|
623
|
-
* @param chains - The chains that destination stores, as `readBackupChains` returns them.
|
|
624
|
-
* @param name - Name the backup is stored under, which every chain record states.
|
|
625
|
-
* @returns The pieces read, the bytes they add up to, and the digest where the backup recorded one.
|
|
626
|
-
*
|
|
627
|
-
* @public
|
|
628
|
-
*/
|
|
629
|
-
declare function verifyBackupRecord(destination: BackupDestination, chains: readonly BackupChain[], name: string): Promise<BackupVerifyResult>;
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* Captures a database's write-ahead log and then checkpoints it, in that order,
|
|
633
|
-
* on the interval the operator sets.
|
|
634
|
-
*
|
|
635
|
-
* The order is the whole point. A checkpoint lets SQLite overwrite frames
|
|
636
|
-
* nothing has captured yet, and it reports success either way. That is why a
|
|
637
|
-
* capture that fails also stops the checkpoint behind it.
|
|
638
|
-
*
|
|
639
|
-
* A database opens its cycle through the `backups` option. Nobody builds one
|
|
640
|
-
* of these by hand.
|
|
641
|
-
*
|
|
642
|
-
* @public
|
|
643
|
-
*/
|
|
644
|
-
declare class BackupCycle {
|
|
645
|
-
private readonly chainName;
|
|
646
|
-
private readonly namePrefix;
|
|
647
|
-
private readonly stagingDir;
|
|
648
|
-
private readonly logPath;
|
|
649
|
-
private readonly intervalMs;
|
|
650
|
-
private readonly fullCopyIntervalMs;
|
|
651
|
-
private readonly preferredNode;
|
|
652
|
-
private readonly timer;
|
|
653
|
-
private state;
|
|
654
|
-
private queued;
|
|
655
|
-
private readonly turns;
|
|
656
|
-
private started;
|
|
657
|
-
private verified;
|
|
658
|
-
private busy;
|
|
659
|
-
private captured;
|
|
660
|
-
private sendRefused;
|
|
661
|
-
private stopped;
|
|
662
|
-
private readonly request;
|
|
663
|
-
private readonly turnLog;
|
|
664
|
-
/** @internal */
|
|
665
|
-
constructor(request: BackupCycleRequest);
|
|
666
|
-
/**
|
|
667
|
-
* Picks a chain up where the previous run left it, or starts a new one with a
|
|
668
|
-
* full copy, and then repeats on the interval. A chain picked up takes an
|
|
669
|
-
* ordinary turn, so the frames written while this node was down reach the
|
|
670
|
-
* destination rather than waiting for the first interval.
|
|
671
|
-
*/
|
|
672
|
-
start(): Promise<void>;
|
|
673
|
-
/**
|
|
674
|
-
* Takes one turn now. A turn sends any capture still waiting, reads the
|
|
675
|
-
* frames written since the previous turn, and then checkpoints the log.
|
|
676
|
-
*
|
|
677
|
-
* One turn waits at a time. A call made while a turn is under way queues one
|
|
678
|
-
* behind it, and every call after that joins the queued turn, which reads the
|
|
679
|
-
* log once it begins and so covers their writes as well. Without that bound,
|
|
680
|
-
* a caller asking repeatedly during a long full copy would build a queue of
|
|
681
|
-
* turns with nothing left for any of them to capture.
|
|
682
|
-
*
|
|
683
|
-
* A turn on a node whose group backs up from somewhere else writes nothing
|
|
684
|
-
* and reports a skip.
|
|
685
|
-
*
|
|
686
|
-
* @returns What the turn wrote, or undefined where it wrote nothing.
|
|
687
|
-
*/
|
|
688
|
-
runOnce(): Promise<BackupRunReport | undefined>;
|
|
689
|
-
/**
|
|
690
|
-
* Stops the cycle. It captures the log one final time first, so the writes
|
|
691
|
-
* made since the previous turn reach the destination before the database
|
|
692
|
-
* closes behind it.
|
|
693
|
-
*/
|
|
694
|
-
stop(): Promise<void>;
|
|
695
|
-
/**
|
|
696
|
-
* Lists what the destination holds.
|
|
697
|
-
*
|
|
698
|
-
* @returns Every chain, newest first, each with its full copy and its change pieces.
|
|
699
|
-
*/
|
|
700
|
-
chains(): Promise<BackupChain[]>;
|
|
701
|
-
/**
|
|
702
|
-
* Reads what the cycle is doing at this moment, and what its recent turns
|
|
703
|
-
* produced.
|
|
704
|
-
*
|
|
705
|
-
* A caller following a long full copy reads this without having to wait on
|
|
706
|
-
* the turn, and it answers between turns as well.
|
|
707
|
-
*
|
|
708
|
-
* @returns Whether a turn is under way, how far it has got, and the last run, skip, and failure.
|
|
709
|
-
*/
|
|
710
|
-
status(): BackupCycleStatus;
|
|
711
|
-
/**
|
|
712
|
-
* Reads one of this chain's backups back out of the destination and compares
|
|
713
|
-
* it against the record the backup that wrote it left behind.
|
|
714
|
-
*
|
|
715
|
-
* @param name - Name the backup is stored under.
|
|
716
|
-
* @returns The pieces read, the bytes they add up to, and the digest where the backup recorded one.
|
|
717
|
-
*/
|
|
718
|
-
verify(name: string): Promise<BackupVerifyResult>;
|
|
719
|
-
/**
|
|
720
|
-
* Runs one turn and passes whatever broke it to the operator. A deeper step
|
|
721
|
-
* announces some failures itself and then raises them, so this announces a
|
|
722
|
-
* failure only where no step has announced it already. The operator therefore
|
|
723
|
-
* hears each failure exactly once. Sirannon empties a log the turn has
|
|
724
|
-
* outgrown once all of that is done, and the report of writes reaching no
|
|
725
|
-
* backup replaces whatever failure the turn recorded.
|
|
726
|
-
*/
|
|
727
|
-
private runTurn;
|
|
728
|
-
/** What the stand-down path needs of this cycle to let go of its chain. */
|
|
729
|
-
private get standDownRequest();
|
|
730
|
-
/** Empties a log this turn captured nothing from, past the operator's limit. */
|
|
731
|
-
private releaseLogPastLimit;
|
|
732
|
-
/**
|
|
733
|
-
* Asks whether this node takes the turn it is starting. A node the group
|
|
734
|
-
* backs up from somewhere else stands down from its chain and empties its
|
|
735
|
-
* log instead. A node that could not read its group holds everything where
|
|
736
|
-
* it is, because the frames it has yet to capture are still in no backup.
|
|
737
|
-
*/
|
|
738
|
-
private takesTheTurn;
|
|
739
|
-
/** Passes a skipped turn on, where the cycle has a reason to give for it. */
|
|
740
|
-
private reportSkip;
|
|
741
|
-
private tick;
|
|
742
|
-
private verifyChain;
|
|
743
|
-
private discardState;
|
|
744
|
-
/**
|
|
745
|
-
* Runs one turn. A log that restarted before the capture reached it leaves a
|
|
746
|
-
* chain nothing can extend, so this starts a fresh one. The caller still gets
|
|
747
|
-
* the error: those writes are in no backup, and an operator has to hear that.
|
|
748
|
-
* Where the replacement chain also fails to start, Sirannon records that
|
|
749
|
-
* second failure against the chain the restart broke, because the cycle holds
|
|
750
|
-
* no chain of its own by then and an operator reading the status has to know
|
|
751
|
-
* which one they have lost.
|
|
752
|
-
*/
|
|
753
|
-
private turnOrStartOver;
|
|
754
|
-
private turn;
|
|
755
|
-
/**
|
|
756
|
-
* Passes a failure to the operator and records it as the turn's outcome.
|
|
757
|
-
*
|
|
758
|
-
* @param err - What the turn failed with.
|
|
759
|
-
* @param chainId - The chain to record it against, which defaults to the one the cycle holds now.
|
|
760
|
-
*/
|
|
761
|
-
private report;
|
|
762
|
-
/** Records a failure against a chain the cycle may already have let go of. */
|
|
763
|
-
private reportAgainstChain;
|
|
764
|
-
private replaceChain;
|
|
765
|
-
private captureAndCheckpoint;
|
|
766
|
-
/**
|
|
767
|
-
* Sends the capture staged against the chain this cycle holds. A turn offers
|
|
768
|
-
* a capture the destination has already refused no second time, because that
|
|
769
|
-
* second offer waits out the destination deadline again and delays every turn
|
|
770
|
-
* behind it.
|
|
771
|
-
*/
|
|
772
|
-
private sendWaitingCapture;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
/** Context passed to query hooks.
|
|
776
|
-
* @public
|
|
777
|
-
*/
|
|
778
|
-
interface QueryHookContext {
|
|
779
|
-
/** Identifier of the database the statement runs against. */
|
|
780
|
-
databaseId: string;
|
|
781
|
-
/** The statement about to run, or the one that just ran. */
|
|
782
|
-
sql: string;
|
|
783
|
-
/** Parameters bound to the statement. */
|
|
784
|
-
params?: Params;
|
|
785
|
-
/** Values a caller attached to the request for its own hooks to read. */
|
|
786
|
-
metadata?: Record<string, unknown>;
|
|
787
|
-
/** Acknowledgements this write waits for. */
|
|
788
|
-
writeConcern?: WriteConcern;
|
|
789
|
-
/** Currency this read requires. */
|
|
790
|
-
readConcern?: ReadConcern;
|
|
791
|
-
}
|
|
792
|
-
/** Hook invoked before a query is executed. Throw to deny.
|
|
793
|
-
* @public
|
|
794
|
-
*/
|
|
795
|
-
type BeforeQueryHook = (ctx: QueryHookContext) => void | Promise<void>;
|
|
796
|
-
/** Context passed to the after-query hook, which is the query context plus how long the statement took.
|
|
797
|
-
* @public
|
|
798
|
-
*/
|
|
799
|
-
interface AfterQueryHookContext extends QueryHookContext {
|
|
800
|
-
/** Milliseconds the statement took, measured from the moment it was sent to the moment it returned. */
|
|
801
|
-
durationMs: number;
|
|
802
|
-
}
|
|
803
|
-
/** Hook invoked after a query is executed.
|
|
804
|
-
* @public
|
|
805
|
-
*/
|
|
806
|
-
type AfterQueryHook = (ctx: AfterQueryHookContext) => void | Promise<void>;
|
|
807
|
-
/** Context passed to connection hooks.
|
|
808
|
-
* @public
|
|
809
|
-
*/
|
|
810
|
-
interface ConnectionHookContext {
|
|
811
|
-
/** Identifier of the database being opened or closed. */
|
|
812
|
-
databaseId: string;
|
|
813
|
-
/** File path of the SQLite database. */
|
|
814
|
-
path: string;
|
|
815
|
-
}
|
|
816
|
-
/** Hook invoked before a database connection is established.
|
|
817
|
-
* @public
|
|
818
|
-
*/
|
|
819
|
-
type BeforeConnectHook = (ctx: ConnectionHookContext) => void | Promise<void>;
|
|
820
|
-
/** Hook invoked when a database is opened.
|
|
821
|
-
* @public
|
|
822
|
-
*/
|
|
823
|
-
type DatabaseOpenHook = (ctx: ConnectionHookContext) => void | Promise<void>;
|
|
824
|
-
/** Hook invoked when a database is closed.
|
|
825
|
-
* @public
|
|
826
|
-
*/
|
|
827
|
-
type DatabaseCloseHook = (ctx: ConnectionHookContext) => void | Promise<void>;
|
|
828
|
-
/** Hook invoked before a subscription is created. Throw to deny.
|
|
829
|
-
* @public
|
|
830
|
-
*/
|
|
831
|
-
type BeforeSubscribeHook = (ctx: {
|
|
832
|
-
/** Identifier of the database the subscription reads. */
|
|
833
|
-
databaseId: string;
|
|
834
|
-
/** Table the subscription watches. */
|
|
835
|
-
table: string;
|
|
836
|
-
/** Column values a change must carry to reach the subscriber. */
|
|
837
|
-
filter?: Record<string, unknown>;
|
|
838
|
-
/** Whoever the `authenticate` hook returned for the connection, and undefined where that connection carries no identity. */
|
|
839
|
-
identity?: unknown;
|
|
840
|
-
}) => void | Promise<void>;
|
|
841
|
-
/** Hook invoked before a served snapshot reads a table. Throw to deny.
|
|
842
|
-
* @public
|
|
843
|
-
*/
|
|
844
|
-
type BeforeSnapshotHook = (ctx: {
|
|
845
|
-
/** Identifier of the database the snapshot copies. */
|
|
846
|
-
databaseId: string;
|
|
847
|
-
/** Table the snapshot is about to read. */
|
|
848
|
-
table: string;
|
|
849
|
-
/** Whoever the `authenticate` hook returned for the request, and undefined where that request carries no identity. */
|
|
850
|
-
identity?: unknown;
|
|
851
|
-
}) => void | Promise<void>;
|
|
852
|
-
/** Aggregated hook configuration.
|
|
853
|
-
* @public
|
|
854
|
-
*/
|
|
855
|
-
interface HookConfig {
|
|
856
|
-
/** Runs before each statement. Throw to refuse it. */
|
|
857
|
-
onBeforeQuery?: BeforeQueryHook | BeforeQueryHook[];
|
|
858
|
-
/** Runs after each statement, with the time it took. */
|
|
859
|
-
onAfterQuery?: AfterQueryHook | AfterQueryHook[];
|
|
860
|
-
/** Runs before a database connection opens. */
|
|
861
|
-
onBeforeConnect?: BeforeConnectHook | BeforeConnectHook[];
|
|
862
|
-
/** Runs once a database is open. */
|
|
863
|
-
onDatabaseOpen?: DatabaseOpenHook | DatabaseOpenHook[];
|
|
864
|
-
/** Runs once a database is closed. */
|
|
865
|
-
onDatabaseClose?: DatabaseCloseHook | DatabaseCloseHook[];
|
|
866
|
-
/** Runs before a change subscription starts. Throw to refuse it. */
|
|
867
|
-
onBeforeSubscribe?: BeforeSubscribeHook | BeforeSubscribeHook[];
|
|
868
|
-
/** Runs before a served snapshot reads a table. Throw to refuse the snapshot. */
|
|
869
|
-
onBeforeSnapshot?: BeforeSnapshotHook | BeforeSnapshotHook[];
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
/** Metrics emitted after a query completes.
|
|
873
|
-
* @public
|
|
874
|
-
*/
|
|
875
|
-
interface QueryMetrics {
|
|
876
|
-
/** Identifier of the database the statement ran against. */
|
|
877
|
-
databaseId: string;
|
|
878
|
-
/** The statement that ran. */
|
|
879
|
-
sql: string;
|
|
880
|
-
/** How long the statement took, in milliseconds. */
|
|
881
|
-
durationMs: number;
|
|
882
|
-
/** Number of rows a read returned. */
|
|
883
|
-
rowsReturned?: number;
|
|
884
|
-
/** Number of rows a write changed. */
|
|
885
|
-
changes?: number;
|
|
886
|
-
/** Set when the statement threw. */
|
|
887
|
-
error?: boolean;
|
|
888
|
-
}
|
|
889
|
-
/** Metrics emitted when a connection opens or closes.
|
|
890
|
-
* @public
|
|
891
|
-
*/
|
|
892
|
-
interface ConnectionMetrics {
|
|
893
|
-
/** Identifier of the database whose connection opened or closed. */
|
|
894
|
-
databaseId: string;
|
|
895
|
-
/** File path of the SQLite database. */
|
|
896
|
-
path: string;
|
|
897
|
-
/** Number of read connections the pool holds. */
|
|
898
|
-
readerCount: number;
|
|
899
|
-
/** Whether the connection opened or closed. */
|
|
900
|
-
event: 'open' | 'close';
|
|
901
|
-
}
|
|
902
|
-
/** Metrics emitted when a CDC event is dispatched.
|
|
903
|
-
* @public
|
|
904
|
-
*/
|
|
905
|
-
interface CDCMetrics {
|
|
906
|
-
/** Identifier of the database the change came from. */
|
|
907
|
-
databaseId: string;
|
|
908
|
-
/** Table the changed row belongs to. */
|
|
909
|
-
table: string;
|
|
910
|
-
/** Whether the row was inserted, updated, or deleted. */
|
|
911
|
-
operation: ChangeOperation;
|
|
912
|
-
/** Number of subscribers the event reached. */
|
|
913
|
-
subscriberCount: number;
|
|
914
|
-
}
|
|
915
|
-
/** Callbacks for metrics collection.
|
|
916
|
-
* @public
|
|
917
|
-
*/
|
|
918
|
-
interface MetricsConfig {
|
|
919
|
-
/** Called once each statement finishes, whether it succeeded or threw. */
|
|
920
|
-
onQueryComplete?: (metrics: QueryMetrics) => void;
|
|
921
|
-
/** Called when a database connection opens. */
|
|
922
|
-
onConnectionOpen?: (metrics: ConnectionMetrics) => void;
|
|
923
|
-
/** Called when a database connection closes. */
|
|
924
|
-
onConnectionClose?: (metrics: ConnectionMetrics) => void;
|
|
925
|
-
/** Called each time a change event reaches its subscribers. */
|
|
926
|
-
onCDCEvent?: (metrics: CDCMetrics) => void;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Runs statements inside one transaction. A function passed to {@link Database.transaction} receives it.
|
|
931
|
-
*
|
|
932
|
-
* @public
|
|
933
|
-
*/
|
|
934
|
-
declare class Transaction {
|
|
935
|
-
private readonly conn;
|
|
936
|
-
private _lastInsertRowId;
|
|
937
|
-
constructor(conn: SQLiteConnection);
|
|
938
|
-
/**
|
|
939
|
-
* Runs a read inside this transaction.
|
|
940
|
-
*
|
|
941
|
-
* @param sql - The statement to run.
|
|
942
|
-
* @param params - Values bound to the statement, named or positional.
|
|
943
|
-
* @returns The rows the statement produced.
|
|
944
|
-
*/
|
|
945
|
-
query<T = Record<string, unknown>>(sql: string, params?: Params): Promise<T[]>;
|
|
946
|
-
/**
|
|
947
|
-
* Runs one write inside this transaction.
|
|
948
|
-
*
|
|
949
|
-
* @param sql - The statement to run.
|
|
950
|
-
* @param params - Values bound to the statement, named or positional.
|
|
951
|
-
* @returns How many rows changed, and the last inserted row id.
|
|
952
|
-
*/
|
|
953
|
-
execute(sql: string, params?: Params): Promise<ExecuteResult>;
|
|
954
|
-
/**
|
|
955
|
-
* Runs one statement over many parameter sets inside this transaction.
|
|
956
|
-
*
|
|
957
|
-
* @param sql - The statement to run for each parameter set.
|
|
958
|
-
* @param paramsBatch - One parameter set per run.
|
|
959
|
-
* @returns One result per parameter set, in order.
|
|
960
|
-
*/
|
|
961
|
-
executeBatch(sql: string, paramsBatch: Params[]): Promise<ExecuteResult[]>;
|
|
962
|
-
/**
|
|
963
|
-
* Row id SQLite assigned to the last row this transaction inserted.
|
|
964
|
-
*/
|
|
965
|
-
get lastInsertRowId(): number | bigint;
|
|
966
|
-
/** @internal */
|
|
967
|
-
static run<T>(conn: SQLiteConnection, fn: (tx: Transaction) => Promise<T>): Promise<T>;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
/** Characters a migration name may use: letters, digits, and underscores.
|
|
971
|
-
* @public
|
|
972
|
-
*/
|
|
973
|
-
declare const MIGRATION_NAME_RE: RegExp;
|
|
974
|
-
/**
|
|
975
|
-
* Marks a migration as the point an existing database starts from, so the
|
|
976
|
-
* runner records every earlier version as applied without running it.
|
|
977
|
-
*
|
|
978
|
-
* @public
|
|
979
|
-
*/
|
|
980
|
-
interface MigrationBaseline {
|
|
981
|
-
/** Highest version this baseline covers. */
|
|
982
|
-
through: number;
|
|
983
|
-
}
|
|
984
|
-
/** One schema change, with the statements that apply it and the statements that undo it.
|
|
985
|
-
* @public
|
|
986
|
-
*/
|
|
987
|
-
interface Migration {
|
|
988
|
-
/** Version number. The runner applies migrations in ascending order. */
|
|
989
|
-
version: number;
|
|
990
|
-
/** Name of the migration, using letters, digits, and underscores. */
|
|
991
|
-
name: string;
|
|
992
|
-
/** SQL that applies the change, or a function that runs it inside the migration's transaction. */
|
|
993
|
-
up: string | ((tx: Transaction) => void | Promise<void>);
|
|
994
|
-
/** SQL that undoes the change, or a function that runs it. A migration without this cannot roll back. */
|
|
995
|
-
down?: string | ((tx: Transaction) => void | Promise<void>);
|
|
996
|
-
/** Marks this migration as the point an existing database starts from. */
|
|
997
|
-
baseline?: MigrationBaseline;
|
|
998
|
-
}
|
|
999
|
-
/** Migrations to apply, either as an array or as a function that produces one.
|
|
1000
|
-
* @public
|
|
1001
|
-
*/
|
|
1002
|
-
type MigrationSource = Migration[] | (() => Migration[] | Promise<Migration[]>);
|
|
1003
|
-
/** One migration named in a migration or rollback result.
|
|
1004
|
-
* @public
|
|
1005
|
-
*/
|
|
1006
|
-
interface AppliedMigrationEntry {
|
|
1007
|
-
/** Version number of the migration. */
|
|
1008
|
-
version: number;
|
|
1009
|
-
/** Name of the migration. */
|
|
1010
|
-
name: string;
|
|
1011
|
-
}
|
|
1012
|
-
/** What one call to migrate did.
|
|
1013
|
-
* @public
|
|
1014
|
-
*/
|
|
1015
|
-
interface MigrationResult {
|
|
1016
|
-
/** Migrations this call applied, in the order it applied them. */
|
|
1017
|
-
applied: AppliedMigrationEntry[];
|
|
1018
|
-
/** Number of migrations the database had already applied. */
|
|
1019
|
-
skipped: number;
|
|
1020
|
-
}
|
|
1021
|
-
/** What one call to roll back did.
|
|
1022
|
-
* @public
|
|
1023
|
-
*/
|
|
1024
|
-
interface RollbackResult {
|
|
1025
|
-
/** Migrations this call undid, newest first. */
|
|
1026
|
-
rolledBack: AppliedMigrationEntry[];
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
/** One node a client can read from, and the read concerns it currently serves.
|
|
1030
|
-
* @public
|
|
1031
|
-
*/
|
|
1032
|
-
interface ClusterReadEndpointInfo {
|
|
1033
|
-
/** Identifier of the node behind this endpoint. */
|
|
1034
|
-
nodeId: string;
|
|
1035
|
-
/** Address a client sends its reads to. */
|
|
1036
|
-
endpoint: string;
|
|
1037
|
-
/** Read concerns this node meets right now. */
|
|
1038
|
-
readConcerns: ReadConcernLevel[];
|
|
1039
|
-
}
|
|
1040
|
-
/** Every value a node reports as its health state.
|
|
1041
|
-
* @public
|
|
1042
|
-
*/
|
|
1043
|
-
declare const NODE_HEALTH_STATES: readonly ["healthy", "degraded", "failing_over", "repairing", "syncing", "unavailable"];
|
|
1044
|
-
/** The single word describing what a node can do right now.
|
|
1045
|
-
* @public
|
|
1046
|
-
*/
|
|
1047
|
-
type NodeHealthState = (typeof NODE_HEALTH_STATES)[number];
|
|
1048
|
-
/** The condition that produced a {@link NodeHealthState}.
|
|
1049
|
-
* @public
|
|
1050
|
-
*/
|
|
1051
|
-
type NodeHealthReason = (typeof NODE_HEALTH_REASONS)[number];
|
|
1052
|
-
/** Every value a node reports as the reason behind its health state.
|
|
1053
|
-
* @public
|
|
1054
|
-
*/
|
|
1055
|
-
declare const NODE_HEALTH_REASONS: readonly ["in-sync", "lagging", "coordinator-unreachable", "draining", "repairing", "faulted", "sync-pending", "no-group-state"];
|
|
1056
|
-
/**
|
|
1057
|
-
* The health of one node, covering only the node that reports it.
|
|
1058
|
-
*
|
|
1059
|
-
* `canRead` and `canWrite` are what that node will accept at this moment;
|
|
1060
|
-
* `state` and `reason` name the condition behind them.
|
|
1061
|
-
*
|
|
1062
|
-
* @public
|
|
1063
|
-
*/
|
|
1064
|
-
interface NodeHealth {
|
|
1065
|
-
/** What the node can do right now. */
|
|
1066
|
-
state: NodeHealthState;
|
|
1067
|
-
/** The condition behind that state. */
|
|
1068
|
-
reason: NodeHealthReason;
|
|
1069
|
-
/** Whether the node serves reads at this moment. */
|
|
1070
|
-
canRead: boolean;
|
|
1071
|
-
/** Whether the node accepts writes at this moment. */
|
|
1072
|
-
canWrite: boolean;
|
|
1073
|
-
}
|
|
1074
|
-
/** What one node reports about its replication group, as served by `GET /db/{id}/cluster`.
|
|
1075
|
-
* @public
|
|
1076
|
-
*/
|
|
1077
|
-
interface ClusterStatusInfo {
|
|
1078
|
-
/** Identifier of the database this status describes. */
|
|
1079
|
-
databaseId: string;
|
|
1080
|
-
/** Identifier of the replication group the node belongs to. */
|
|
1081
|
-
replicationGroupId?: string;
|
|
1082
|
-
/** Whether this node accepts writes or serves reads. */
|
|
1083
|
-
role?: 'primary' | 'replica';
|
|
1084
|
-
/** The primary this node reports as current, or null when it has none. */
|
|
1085
|
-
currentPrimary?: {
|
|
1086
|
-
nodeId: string;
|
|
1087
|
-
endpoint?: string;
|
|
1088
|
-
} | null;
|
|
1089
|
-
/** The primary term this node reports as current. */
|
|
1090
|
-
primaryTerm?: bigint;
|
|
1091
|
-
/** Every node a client can read from, with the read concerns each one serves. */
|
|
1092
|
-
readEndpoints?: ClusterReadEndpointInfo[];
|
|
1093
|
-
/** What this node can do right now. */
|
|
1094
|
-
health: NodeHealthState;
|
|
1095
|
-
/** The condition behind that health. */
|
|
1096
|
-
healthReason: NodeHealthReason;
|
|
1097
|
-
}
|
|
1098
|
-
/** Configuration for automatic database lifecycle management.
|
|
1099
|
-
* @public
|
|
1100
|
-
*/
|
|
1101
|
-
interface LifecycleConfig {
|
|
1102
|
-
/** Opens a database the first time someone asks for an identifier the registry has not seen. */
|
|
1103
|
-
autoOpen?: {
|
|
1104
|
-
resolver: (id: string) => {
|
|
1105
|
-
path: string;
|
|
1106
|
-
options?: DatabaseOptions;
|
|
1107
|
-
} | undefined;
|
|
1108
|
-
};
|
|
1109
|
-
/** Milliseconds before an idle database is closed. 0 = disabled. */
|
|
1110
|
-
idleTimeout?: number;
|
|
1111
|
-
/** Maximum number of concurrently open databases. 0 = unlimited. */
|
|
1112
|
-
maxOpen?: number;
|
|
1113
|
-
}
|
|
1114
|
-
/** Options for opening a single database.
|
|
1115
|
-
* @public
|
|
1116
|
-
*/
|
|
1117
|
-
interface DatabaseOptions {
|
|
1118
|
-
/** Open the database in read-only mode. */
|
|
1119
|
-
readOnly?: boolean;
|
|
1120
|
-
/** Number of read connections in the pool. Default: 4. */
|
|
1121
|
-
readPoolSize?: number;
|
|
1122
|
-
/** Enable WAL mode. Default: true. */
|
|
1123
|
-
walMode?: boolean;
|
|
1124
|
-
/**
|
|
1125
|
-
* Writer durability (`PRAGMA synchronous`). Default: 'normal'. This is the
|
|
1126
|
-
* level restored after every bulk load, whatever the load relaxed it to.
|
|
1127
|
-
*/
|
|
1128
|
-
synchronous?: SynchronousLevel;
|
|
1129
|
-
/** CDC polling interval in milliseconds. Default: 50. */
|
|
1130
|
-
cdcPollInterval?: number;
|
|
1131
|
-
/** CDC retention period in milliseconds. Default: 3_600_000 (1 hour). */
|
|
1132
|
-
cdcRetention?: number;
|
|
1133
|
-
/**
|
|
1134
|
-
* Run writes on a dedicated worker thread so disk flushes never block the
|
|
1135
|
-
* thread serving connections; reads stay on the calling thread. Requires a
|
|
1136
|
-
* driver with a worker entry (the `better-sqlite3` and `node` drivers have
|
|
1137
|
-
* one), otherwise opening throws. Default: off.
|
|
1138
|
-
*/
|
|
1139
|
-
writerWorker?: boolean | WriterWorkerOptions;
|
|
1140
|
-
/**
|
|
1141
|
-
* Capture this database's write-ahead log to a destination you supply, on an
|
|
1142
|
-
* interval. A backup then costs what changed since the last one, not what the
|
|
1143
|
-
* database holds, so a terabyte that changed by 200 MB pays for 200 MB.
|
|
1144
|
-
*
|
|
1145
|
-
* A database given this option takes checkpointing away from SQLite and runs
|
|
1146
|
-
* it itself. It has to: a checkpoint lets SQLite overwrite log frames nothing
|
|
1147
|
-
* has captured yet. Default: off.
|
|
1148
|
-
*/
|
|
1149
|
-
backups?: BackupCycleOptions;
|
|
1150
|
-
}
|
|
1151
|
-
/** Limits and recovery settings for the thread that runs writes.
|
|
1152
|
-
* @public
|
|
1153
|
-
*/
|
|
1154
|
-
interface WriterWorkerOptions {
|
|
1155
|
-
/** Writes allowed in flight before new writes are rejected with a busy signal. Default: 1024. */
|
|
1156
|
-
maxPendingWrites?: number;
|
|
1157
|
-
/** Per-operation deadline in ms; when an operation stalls past it, its caller is rejected loudly while the worker keeps running, so a stalled write's outcome is indeterminate. 0 disables it. Default: 30000. */
|
|
1158
|
-
writeTimeoutMs?: number;
|
|
1159
|
-
/** Restarts the worker this many times after it crashes on its own before writes fail permanently. Default: 5. */
|
|
1160
|
-
maxRestarts?: number;
|
|
1161
|
-
}
|
|
1162
|
-
/** Top-level options for the Sirannon database registry.
|
|
1163
|
-
* @public
|
|
1164
|
-
*/
|
|
1165
|
-
interface SirannonOptions {
|
|
1166
|
-
/** SQLite driver every database in this registry opens through. */
|
|
1167
|
-
driver: SQLiteDriver;
|
|
1168
|
-
/** Lifecycle hooks that run for every database in this registry. */
|
|
1169
|
-
hooks?: HookConfig;
|
|
1170
|
-
/** Callbacks that receive statement, connection, and change-capture metrics. */
|
|
1171
|
-
metrics?: MetricsConfig;
|
|
1172
|
-
/** Automatic opening, idle eviction, and the limit on concurrently open databases. */
|
|
1173
|
-
lifecycle?: LifecycleConfig;
|
|
1174
|
-
/** Migrations every database in this registry applies when it opens. */
|
|
1175
|
-
migrations?: MigrationSource;
|
|
1176
|
-
/** Default writer-worker setting for the databases this registry opens. */
|
|
1177
|
-
writerWorker?: boolean | WriterWorkerOptions;
|
|
1178
|
-
}
|
|
1179
|
-
/** Options for scheduled backups.
|
|
1180
|
-
* @public
|
|
1181
|
-
*/
|
|
1182
|
-
interface BackupScheduleOptions {
|
|
1183
|
-
/** Cron expression (e.g., '0 * * * *' for hourly). */
|
|
1184
|
-
cron: string;
|
|
1185
|
-
/** Directory to store backup files. */
|
|
1186
|
-
destDir: string;
|
|
1187
|
-
/** Maximum number of backup files to keep. Default: 5. */
|
|
1188
|
-
maxFiles?: number;
|
|
1189
|
-
/**
|
|
1190
|
-
* Sirannon evaluates the cron expression in this IANA time zone (e.g. 'America/New_York').
|
|
1191
|
-
* When omitted, it uses the host's local time zone, which also sets the daylight saving rules that apply.
|
|
1192
|
-
*/
|
|
1193
|
-
timezone?: string;
|
|
1194
|
-
/**
|
|
1195
|
-
* Called after every copy the schedule finishes, with the file it wrote and
|
|
1196
|
-
* what that copy moved. Use it to send the file somewhere durable, or to
|
|
1197
|
-
* record that the schedule is still running.
|
|
1198
|
-
*
|
|
1199
|
-
* Sirannon waits for the promise this returns, and it clears the older files
|
|
1200
|
-
* only once that promise settles, so it deletes no copy your upload is still
|
|
1201
|
-
* reading. Sirannon passes a failure to
|
|
1202
|
-
* {@link BackupScheduleOptions.onError}, which is where it reports a failed
|
|
1203
|
-
* copy as well. The deadline in
|
|
1204
|
-
* {@link BackupScheduleOptions.onBackupTimeoutMs} bounds that wait.
|
|
1205
|
-
*/
|
|
1206
|
-
onBackup?: (report: BackupFileReport) => void | Promise<void>;
|
|
1207
|
-
/**
|
|
1208
|
-
* Milliseconds {@link BackupScheduleOptions.onBackup} may take before
|
|
1209
|
-
* Sirannon gives up waiting on it. It defaults to ten minutes, and zero
|
|
1210
|
-
* leaves the wait unbounded.
|
|
1211
|
-
*
|
|
1212
|
-
* Sirannon clears the older files and takes the next copy once this callback
|
|
1213
|
-
* settles or this deadline passes. Without a deadline, a callback left waiting
|
|
1214
|
-
* on a socket would hold the schedule still for good. Past the deadline
|
|
1215
|
-
* Sirannon reports the timeout through
|
|
1216
|
-
* {@link BackupScheduleOptions.onError} and goes on with the schedule. Your
|
|
1217
|
-
* callback keeps running while Sirannon counts that copy among the files it
|
|
1218
|
-
* may delete, so set this longer than your slowest upload takes.
|
|
1219
|
-
*/
|
|
1220
|
-
onBackupTimeoutMs?: number;
|
|
1221
|
-
/** Called when a scheduled backup fails. Without this, errors are silently discarded. */
|
|
1222
|
-
onError?: (error: Error) => void;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
/** Runs a backup while nothing else holds the writer, so that the copy never shares the writer connection with another write.
|
|
1226
|
-
* @public
|
|
1227
|
-
*/
|
|
1228
|
-
type RunExclusive = (op: () => Promise<void>) => Promise<void>;
|
|
1229
|
-
/**
|
|
1230
|
-
* What one repeating backup needs beyond the caller's own options, so that
|
|
1231
|
-
* every report it produces names the database the copy came from.
|
|
1232
|
-
*
|
|
1233
|
-
* @public
|
|
1234
|
-
*/
|
|
1235
|
-
interface BackupScheduleRequest extends BackupScheduleOptions {
|
|
1236
|
-
/** Database the copies are taken from. Defaults to the name of the file SQLite has open. */
|
|
1237
|
-
databaseId?: string;
|
|
1238
|
-
/** File the copies are taken from. Defaults to the file SQLite has open on the connection. */
|
|
1239
|
-
sourcePath?: string;
|
|
1240
|
-
/** Runs each copy with nothing else holding the writer. Defaults to running it with no lock of its own. */
|
|
1241
|
-
runExclusive?: RunExclusive;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
interface WorkerHostOptions {
|
|
1245
|
-
writeTimeoutMs?: number;
|
|
1246
|
-
maxRestarts?: number;
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
/** What one write reports back through the driver.
|
|
1250
|
-
* @public
|
|
1251
|
-
*/
|
|
1252
|
-
interface RunResult {
|
|
1253
|
-
/** Number of rows the statement inserted, updated, or deleted. */
|
|
1254
|
-
changes: number;
|
|
1255
|
-
/** Row id SQLite assigned to the last inserted row. */
|
|
1256
|
-
lastInsertRowId: number | bigint;
|
|
1257
|
-
}
|
|
1258
|
-
/**
|
|
1259
|
-
* Tells a caller running inside the operation that holds the writer from one
|
|
1260
|
-
* merely waiting on it. A runtime without async context tracking cannot answer
|
|
1261
|
-
* this, and answering it wrongly runs one caller's writes inside another
|
|
1262
|
-
* caller's transaction.
|
|
1263
|
-
*/
|
|
1264
|
-
interface WriterContext {
|
|
1265
|
-
/** Runs an operation marked as the one holding the writer. */
|
|
1266
|
-
run<T>(operation: () => T): T;
|
|
1267
|
-
/** Reports whether the caller is the operation holding the writer. */
|
|
1268
|
-
isActive(): boolean;
|
|
1269
|
-
/** Runs an operation outside the held writer, so its writes stay out of that transaction. */
|
|
1270
|
-
exit<T>(operation: () => T): T;
|
|
1271
|
-
}
|
|
1272
|
-
/**
|
|
1273
|
-
* Copies a database to a file, and repeats that copy on a schedule.
|
|
1274
|
-
*
|
|
1275
|
-
* @internal
|
|
1276
|
-
*/
|
|
1277
|
-
interface BackupEngine {
|
|
1278
|
-
/** Copies the database behind a connection to a destination path. */
|
|
1279
|
-
backup(conn: SQLiteConnection, destPath: string, onFirstStep?: () => void): Promise<BackupFileCopy>;
|
|
1280
|
-
/** Copies the database behind a connection to a caller-supplied destination. */
|
|
1281
|
-
copyToDestination(conn: SQLiteConnection, request: BackupRunRequest): Promise<BackupRunReport>;
|
|
1282
|
-
/** Reports whether a full copy reaches the destination without a local file. */
|
|
1283
|
-
streamsToDestination(): boolean;
|
|
1284
|
-
/** Builds the cycle that captures the write-ahead log and then checkpoints it. */
|
|
1285
|
-
createCycle(request: BackupCycleRequest): BackupCycle;
|
|
1286
|
-
/** Starts a repeating backup and returns a function that stops it. */
|
|
1287
|
-
schedule(conn: SQLiteConnection, request: BackupScheduleRequest): () => void;
|
|
1288
|
-
}
|
|
1289
|
-
/** What one step of a stepped database copy reported.
|
|
1290
|
-
* @public
|
|
1291
|
-
*/
|
|
1292
|
-
interface DatabaseCopyStep {
|
|
1293
|
-
/** Pages the copy has to move in total. */
|
|
1294
|
-
totalPages: number;
|
|
1295
|
-
/** Pages the copy has yet to move. */
|
|
1296
|
-
remainingPages: number;
|
|
1297
|
-
}
|
|
1298
|
-
/** What Sirannon asks a driver to copy, and how finely.
|
|
1299
|
-
* @public
|
|
1300
|
-
*/
|
|
1301
|
-
interface DatabaseCopyRequest {
|
|
1302
|
-
/** Path the copy is written to. */
|
|
1303
|
-
destPath: string;
|
|
1304
|
-
/** Pages the driver moves in one step. */
|
|
1305
|
-
pagesPerStep: number;
|
|
1306
|
-
/**
|
|
1307
|
-
* Called after every step with that step's counters. It returns the pages for
|
|
1308
|
-
* the next step, and a driver whose runtime takes a fresh count on each step
|
|
1309
|
-
* passes that number on. Zero holds the copy still while the caller catches
|
|
1310
|
-
* up.
|
|
1311
|
-
*/
|
|
1312
|
-
onStep?: (step: DatabaseCopyStep) => number;
|
|
1313
|
-
/**
|
|
1314
|
-
* Milliseconds the copy may report no step before the caller stops waiting
|
|
1315
|
-
* for it. A driver that steps the copy on another thread waits this long for
|
|
1316
|
-
* that thread, so a caller who allows a long stall keeps the copy running.
|
|
1317
|
-
* Zero leaves that wait unbounded.
|
|
1318
|
-
*/
|
|
1319
|
-
stallTimeoutMs?: number;
|
|
1320
|
-
}
|
|
1321
|
-
/** Totals for one statement applied over many parameter sets.
|
|
1322
|
-
* @public
|
|
1323
|
-
*/
|
|
1324
|
-
interface BatchSummary {
|
|
1325
|
-
/** Number of parameter sets the driver applied. */
|
|
1326
|
-
rowsLoaded: number;
|
|
1327
|
-
/** Number of rows those statements inserted, updated, or deleted. */
|
|
1328
|
-
changes: number;
|
|
1329
|
-
}
|
|
1330
|
-
/** One prepared statement a driver hands back, ready to run many times.
|
|
1331
|
-
* @public
|
|
1332
|
-
*/
|
|
1333
|
-
interface SQLiteStatement {
|
|
1334
|
-
/** Runs the statement and returns every row. */
|
|
1335
|
-
all<T = unknown>(...params: unknown[]): Promise<T[]>;
|
|
1336
|
-
/** Runs the statement and returns the first row, or undefined when there is none. */
|
|
1337
|
-
get<T = unknown>(...params: unknown[]): Promise<T | undefined>;
|
|
1338
|
-
/** Runs the statement as a write and reports what it changed. */
|
|
1339
|
-
run(...params: unknown[]): Promise<RunResult>;
|
|
1340
|
-
/**
|
|
1341
|
-
* Like {@link SQLiteStatement.all} but skips the safe-range BigInt narrowing, leaving every
|
|
1342
|
-
* integer as a BigInt. The server wire path narrows and tags in one pass, so
|
|
1343
|
-
* feeding it raw rows avoids a second walk. Optional: a driver that omits it
|
|
1344
|
-
* falls back to {@link SQLiteStatement.all}, still correct but with the extra narrowing walk.
|
|
1345
|
-
*/
|
|
1346
|
-
allRaw?<T = unknown>(...params: unknown[]): Promise<T[]>;
|
|
1347
|
-
}
|
|
1348
|
-
/**
|
|
1349
|
-
* Why one unit of a grouped run failed.
|
|
1350
|
-
*
|
|
1351
|
-
* @internal
|
|
1352
|
-
*/
|
|
1353
|
-
interface GroupRunError {
|
|
1354
|
-
/** Message SQLite or the driver raised. */
|
|
1355
|
-
message: string;
|
|
1356
|
-
/** Name of the error class. */
|
|
1357
|
-
name?: string;
|
|
1358
|
-
/** Machine-readable code, where the driver supplies one. */
|
|
1359
|
-
code?: string;
|
|
1360
|
-
}
|
|
1361
|
-
/**
|
|
1362
|
-
* What one unit of a grouped run produced.
|
|
1363
|
-
*
|
|
1364
|
-
* @internal
|
|
1365
|
-
*/
|
|
1366
|
-
type GroupRunOutcome = {
|
|
1367
|
-
ok: true;
|
|
1368
|
-
results: RunResult[];
|
|
1369
|
-
} | {
|
|
1370
|
-
ok: false;
|
|
1371
|
-
error: GroupRunError;
|
|
1372
|
-
};
|
|
1373
|
-
/** One open connection to a SQLite database.
|
|
1374
|
-
* @public
|
|
1375
|
-
*/
|
|
1376
|
-
interface SQLiteConnection {
|
|
1377
|
-
/** Runs one or more statements and returns no rows. */
|
|
1378
|
-
exec(sql: string): Promise<void>;
|
|
1379
|
-
/** Compiles a statement so the caller can run it many times. */
|
|
1380
|
-
prepare(sql: string): Promise<SQLiteStatement>;
|
|
1381
|
-
/** Runs a function inside one transaction, committing when it returns and rolling back when it throws. */
|
|
1382
|
-
transaction<T>(fn: (conn: SQLiteConnection) => Promise<T>): Promise<T>;
|
|
1383
|
-
/** Closes the connection. */
|
|
1384
|
-
close(): Promise<void>;
|
|
1385
|
-
/**
|
|
1386
|
-
* Loads a compiled SQLite extension into this connection through the
|
|
1387
|
-
* runtime's own loading call, so a query on this connection can call the
|
|
1388
|
-
* extension's functions. SQLite scopes a loaded extension to the connection
|
|
1389
|
-
* that loaded it, so a caller that needs it everywhere loads it on every
|
|
1390
|
-
* connection. Where the runtime carries no loading call, this rejects with an
|
|
1391
|
-
* error that names that runtime.
|
|
1392
|
-
*/
|
|
1393
|
-
loadExtension?(extensionPath: string): Promise<void>;
|
|
1394
|
-
/**
|
|
1395
|
-
* Copies this connection's database to a file through SQLite's stepped
|
|
1396
|
-
* backup interface, one step at a time, so writes on this connection run in
|
|
1397
|
-
* the gaps between steps. SQLite restarts a copy whose source is written
|
|
1398
|
-
* through any other connection, so the copy must run on the connection that
|
|
1399
|
-
* writes. A copy started while a transaction is already open on this
|
|
1400
|
-
* connection produces nothing, so the caller starts one only when no
|
|
1401
|
-
* transaction is open. Where the runtime carries no stepped backup call,
|
|
1402
|
-
* this rejects with an error that names that runtime.
|
|
1403
|
-
*/
|
|
1404
|
-
copyDatabase?(request: DatabaseCopyRequest): Promise<DatabaseCopyStep>;
|
|
1405
|
-
/**
|
|
1406
|
-
* Whether the runtime steps this connection's copy on a thread other than the
|
|
1407
|
-
* caller's. A copy on its own thread can wait for the caller to catch up, and
|
|
1408
|
-
* a copy on the caller's thread would stop the only thread there is.
|
|
1409
|
-
*/
|
|
1410
|
-
readonly copyRunsOffCallerThread?: boolean;
|
|
1411
|
-
/** Optional fast path that applies one statement over many parameter sets. */
|
|
1412
|
-
runBatch?(sql: string, paramsBatch: readonly unknown[][]): Promise<RunResult[]>;
|
|
1413
|
-
/** Optional fast path that applies one statement over many parameter sets and returns only the totals. */
|
|
1414
|
-
runBatchSummary?(sql: string, paramsBatch: readonly unknown[][]): Promise<BatchSummary>;
|
|
1415
|
-
/**
|
|
1416
|
-
* Runs several independent units in one transaction, one outcome per unit in
|
|
1417
|
-
* order. A unit is one write or one whole transaction, and a unit that fails
|
|
1418
|
-
* must not disturb the others.
|
|
1419
|
-
*/
|
|
1420
|
-
runGroup?(units: readonly {
|
|
1421
|
-
statements: readonly {
|
|
1422
|
-
sql: string;
|
|
1423
|
-
params?: readonly unknown[];
|
|
1424
|
-
trusted?: boolean;
|
|
1425
|
-
}[];
|
|
1426
|
-
}[]): Promise<GroupRunOutcome[]>;
|
|
1427
|
-
}
|
|
1428
|
-
/**
|
|
1429
|
-
* SQLite `PRAGMA synchronous` level applied to a connection. `normal` is safe
|
|
1430
|
-
* from corruption in WAL mode but can lose the most recent commits on power
|
|
1431
|
-
* loss; `full` fsyncs every commit; `extra` adds a directory sync after the
|
|
1432
|
-
* rollback journal is unlinked in DELETE journal mode and equals `full` in
|
|
1433
|
-
* WAL mode; `off` hands writes to the OS without syncing and is sanctioned
|
|
1434
|
-
* only for re-runnable bulk loads.
|
|
1435
|
-
*
|
|
1436
|
-
* @public
|
|
1437
|
-
*/
|
|
1438
|
-
type SynchronousLevel = 'off' | 'normal' | 'full' | 'extra';
|
|
1439
|
-
/** How a driver opens one database file.
|
|
1440
|
-
* @public
|
|
1441
|
-
*/
|
|
1442
|
-
interface OpenOptions {
|
|
1443
|
-
/** Opens the file for reads only. */
|
|
1444
|
-
readonly?: boolean;
|
|
1445
|
-
/** Puts the database in write-ahead logging mode. */
|
|
1446
|
-
walMode?: boolean;
|
|
1447
|
-
/** Writer durability the connection runs at. */
|
|
1448
|
-
synchronous?: SynchronousLevel;
|
|
1449
|
-
/**
|
|
1450
|
-
* How many frames the write-ahead log may reach before SQLite checkpoints it
|
|
1451
|
-
* on its own. Zero turns that off, which a database capturing its own log
|
|
1452
|
-
* needs: a checkpoint lets SQLite overwrite frames nothing has captured yet.
|
|
1453
|
-
*
|
|
1454
|
-
* SQLite holds this per connection, so a driver applies it every time it
|
|
1455
|
-
* opens one, including after a writer worker restarts.
|
|
1456
|
-
*/
|
|
1457
|
-
walAutoCheckpoint?: number;
|
|
1458
|
-
}
|
|
1459
|
-
/** What a driver's runtime supports.
|
|
1460
|
-
* @public
|
|
1461
|
-
*/
|
|
1462
|
-
interface DriverCapabilities {
|
|
1463
|
-
/** Whether the runtime opens more than one connection to the same file. */
|
|
1464
|
-
multipleConnections: boolean;
|
|
1465
|
-
/** Whether the runtime loads SQLite extensions. */
|
|
1466
|
-
extensions: boolean;
|
|
1467
|
-
/** Whether the runtime copies an open database through SQLite's stepped backup interface. */
|
|
1468
|
-
steppedCopy: boolean;
|
|
1469
|
-
}
|
|
1470
|
-
/**
|
|
1471
|
-
* Lets a worker thread rebuild the driver, since the driver's `open` function
|
|
1472
|
-
* cannot cross the thread boundary. `specifier` must be importable from the
|
|
1473
|
-
* worker and `config` must survive a structured clone; the worker imports the
|
|
1474
|
-
* module and calls its `exportName` factory (default export otherwise) with it.
|
|
1475
|
-
*
|
|
1476
|
-
* @public
|
|
1477
|
-
*/
|
|
1478
|
-
interface DriverWorkerEntry {
|
|
1479
|
-
/** Module the worker imports to rebuild the driver. */
|
|
1480
|
-
specifier: string;
|
|
1481
|
-
/** Named export the worker calls, or the default export when absent. */
|
|
1482
|
-
exportName?: string;
|
|
1483
|
-
/** Value passed to that factory, which must survive a structured clone. */
|
|
1484
|
-
config?: unknown;
|
|
1485
|
-
}
|
|
1486
|
-
/** How Sirannon opens SQLite on one runtime.
|
|
1487
|
-
* @public
|
|
1488
|
-
*/
|
|
1489
|
-
interface SQLiteDriver {
|
|
1490
|
-
/** What this driver's runtime supports. */
|
|
1491
|
-
readonly capabilities: DriverCapabilities;
|
|
1492
|
-
/** Opens a database file and returns a connection to it. */
|
|
1493
|
-
open(path: string, options?: OpenOptions): Promise<SQLiteConnection>;
|
|
1494
|
-
/** How a worker thread rebuilds this driver. */
|
|
1495
|
-
readonly worker?: DriverWorkerEntry;
|
|
1496
|
-
/**
|
|
1497
|
-
* Offloads writes to a worker thread. Only a driver whose runtime has
|
|
1498
|
-
* threads implements this, which is what keeps the thread machinery out of
|
|
1499
|
-
* bundles built for runtimes that do not.
|
|
1500
|
-
*/
|
|
1501
|
-
startWriterHost?(path: string, options: OpenOptions, hostOptions?: WorkerHostOptions): Promise<SQLiteConnection>;
|
|
1502
|
-
/** Builds the tracker that tells the caller holding the writer from one waiting on it. */
|
|
1503
|
-
createWriterContext?(): WriterContext;
|
|
1504
|
-
/**
|
|
1505
|
-
* Builds the engine that copies a database to a file. The driver is passed
|
|
1506
|
-
* back so the engine can open a connection of its own, which a streamed copy
|
|
1507
|
-
* needs for the extension that carries the bytes.
|
|
1508
|
-
*/
|
|
1509
|
-
createBackupEngine?(driver: SQLiteDriver): BackupEngine;
|
|
1510
|
-
/**
|
|
1511
|
-
* Makes an extension path absolute. Passing a bare name to `load_extension`
|
|
1512
|
-
* would let the dynamic linker search its own paths and open a different
|
|
1513
|
-
* library than the operator named.
|
|
1514
|
-
*/
|
|
1515
|
-
resolveExtensionPath?(extensionPath: string): string;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
export { type BeforeSnapshotHook as $, type AfterQueryHook as A, type BackupDestination as B, DEFAULT_CHAIN_NAME as C, type DatabaseOptions as D, chainLogName as E, readBackupChains as F, verifyBackupRecord as G, type ClusterStatusInfo as H, type SQLiteConnection as I, type BackupFileCopy as J, type BackupRunRequest as K, type BackupScheduleRequest as L, type Migration as M, type NodeHealth as N, type BackupScheduleOptions as O, type DriverCapabilities as P, type BackupEngine as Q, type RunExclusive as R, type SQLiteDriver as S, Transaction as T, type SynchronousLevel as U, type LifecycleConfig as V, type MigrationResult as W, type RollbackResult as X, type AfterQueryHookContext as Y, type AppliedMigrationEntry as Z, type BatchSummary as _, type SirannonOptions as a, type BeforeSubscribeHook as a0, type CDCMetrics as a1, type ClusterReadEndpointInfo as a2, type ConnectionHookContext as a3, type ConnectionMetrics as a4, type DatabaseCopyRequest as a5, type DatabaseCopyStep as a6, type DriverWorkerEntry as a7, type HookConfig as a8, MIGRATION_NAME_RE as a9, type MetricsConfig as aa, type MigrationBaseline as ab, type MigrationSource as ac, NODE_HEALTH_REASONS as ad, NODE_HEALTH_STATES as ae, type NodeHealthReason as af, type NodeHealthState as ag, type OpenOptions as ah, type QueryHookContext as ai, type QueryMetrics as aj, type RunResult as ak, type SQLiteStatement as al, type WriterWorkerOptions as am, type WorkerHostOptions as an, type WriterContext as ao, type BeforeQueryHook as b, type BeforeConnectHook as c, type DatabaseOpenHook as d, type DatabaseCloseHook as e, type BackupRunReport as f, type BackupChain as g, type BackupChainBase as h, type BackupChainChange as i, type BackupChainPosition as j, type BackupChainRecord as k, BackupCycle as l, type BackupCycleError as m, type BackupCycleOptions as n, type BackupCycleStatus as o, type BackupFileReport as p, type BackupGroupMembership as q, type BackupGroupSource as r, type BackupLogPosition as s, type BackupNodePreference as t, type BackupPiece as u, type BackupProgress as v, type BackupSkip as w, type BackupSkipReason as x, type BackupToDestinationOptions as y, type BackupVerifyResult as z };
|