tero 0.1.0 → 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/README.md +64 -1
- package/dist/acid-engine.d.ts +224 -9
- package/dist/acid-engine.js +775 -158
- package/dist/backup.d.ts +38 -3
- package/dist/backup.js +269 -68
- package/dist/index.d.ts +51 -4
- package/dist/index.js +267 -135
- package/dist/recovery.js +2 -13
- package/dist/s3-config.d.ts +3 -0
- package/dist/s3-config.js +21 -0
- package/package.json +1 -1
package/dist/backup.d.ts
CHANGED
|
@@ -14,10 +14,27 @@ export interface LiveBackupStatus {
|
|
|
14
14
|
lastCheckpointError?: string;
|
|
15
15
|
}
|
|
16
16
|
export interface LiveBackupOptions {
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* - 'per-second': RPO ≤ 1 second of committed writes (intervalMs ≤ 1000).
|
|
19
|
+
* - 'interval': RPO = intervalMs (1000–300000). Each ship is one PUT per engine,
|
|
20
|
+
* so a slower cadence cuts bucket request costs proportionally.
|
|
21
|
+
*/
|
|
22
|
+
consistency: 'per-second' | 'interval';
|
|
19
23
|
/** Ship interval in ms. Default 1000. Minimum 250. */
|
|
20
24
|
intervalMs?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Automatic incremental checkpoint cadence (ms). Default 900000 (15 min); 0 disables.
|
|
27
|
+
* A checkpoint bounds three things: how much WAL a restore replays, how many
|
|
28
|
+
* dirty documents are held in memory, and (via pruning) how many WAL objects
|
|
29
|
+
* accumulate in the bucket.
|
|
30
|
+
*/
|
|
31
|
+
checkpointIntervalMs?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Wait this long before the initial FULL checkpoint (default 0). Lets a server
|
|
34
|
+
* finish booting before uploading every document. Safe: until it publishes, the
|
|
35
|
+
* previous checkpoint plus the shipped WAL still describe everything.
|
|
36
|
+
*/
|
|
37
|
+
initialCheckpointDelayMs?: number;
|
|
21
38
|
/** Stable identity for this node in the bucket. Persisted to <dbPath>/.tero-node-id. */
|
|
22
39
|
nodeId?: string;
|
|
23
40
|
}
|
|
@@ -33,6 +50,8 @@ export interface RestoreLiveResult {
|
|
|
33
50
|
segmentsReplayed: number;
|
|
34
51
|
baseLsn: number | null;
|
|
35
52
|
lastLsn: number;
|
|
53
|
+
/** Set only with allowWalGap: first LSN that could not be replayed because the bucket's WAL chain is broken there. */
|
|
54
|
+
walGapAtLsn?: number;
|
|
36
55
|
}
|
|
37
56
|
export interface CloudStorageConfig {
|
|
38
57
|
provider: 'aws-s3' | 'cloudflare-r2';
|
|
@@ -44,6 +63,10 @@ export interface CloudStorageConfig {
|
|
|
44
63
|
pathPrefix?: string;
|
|
45
64
|
/** Override the derived bucket subprefix (avoids basename collisions). Defaults to "<basename>-<hash>". */
|
|
46
65
|
dbName?: string;
|
|
66
|
+
/** Per-request timeout (ms). Default 30000. Without one, a hung connection blocks its caller forever. */
|
|
67
|
+
requestTimeoutMs?: number;
|
|
68
|
+
/** TCP/TLS connect timeout (ms). Default 5000. */
|
|
69
|
+
connectionTimeoutMs?: number;
|
|
47
70
|
}
|
|
48
71
|
/** Injectable logger for BackupManager. Pass your own to route backup logs into
|
|
49
72
|
* your observability stack, or pass console. Default is silent to prevent log noise. */
|
|
@@ -183,14 +206,24 @@ export declare class BackupManager {
|
|
|
183
206
|
private listPrefixWithMeta;
|
|
184
207
|
private deleteObject;
|
|
185
208
|
enableLiveBackup(engine: ACIDStorageEngine, opts: LiveBackupOptions): void;
|
|
209
|
+
private checkpointTimer?;
|
|
186
210
|
/** Initial full checkpoint with bounded retry. Stops on success or disable. */
|
|
187
211
|
private runInitialCheckpoint;
|
|
188
212
|
disableLiveBackup(): void;
|
|
189
213
|
getLiveBackupStatus(): LiveBackupStatus;
|
|
190
|
-
liveCheckpointToBucket(
|
|
214
|
+
liveCheckpointToBucket(opts?: {
|
|
191
215
|
tag?: string;
|
|
216
|
+
full?: boolean;
|
|
192
217
|
}): Promise<LiveCheckpointResult>;
|
|
193
218
|
private doLiveCheckpoint;
|
|
219
|
+
private doLiveCheckpointCaptured;
|
|
220
|
+
/**
|
|
221
|
+
* Delete bucket WAL objects the published checkpoint makes redundant: a restore
|
|
222
|
+
* replays only from replayFromLsn onward, so segments that END before it are
|
|
223
|
+
* never read again. Without this the WAL prefix grows by one object per ship
|
|
224
|
+
* forever, and every checkpoint's LIST gets slower and costlier. Best-effort.
|
|
225
|
+
*/
|
|
226
|
+
private pruneCoveredWal;
|
|
194
227
|
/**
|
|
195
228
|
* Crash-safe restore: downloads and replays WAL into a fresh temporary staging directory,
|
|
196
229
|
* then promotes staging to targetDir via a crash-safe .restore-in-progress marker protocol.
|
|
@@ -199,6 +232,7 @@ export declare class BackupManager {
|
|
|
199
232
|
nodeId?: string;
|
|
200
233
|
pointInTime?: number;
|
|
201
234
|
targetLsn?: number;
|
|
235
|
+
allowWalGap?: boolean;
|
|
202
236
|
}): Promise<RestoreLiveResult>;
|
|
203
237
|
/**
|
|
204
238
|
* Explicit merge restore: restores state directly into an existing target directory
|
|
@@ -208,6 +242,7 @@ export declare class BackupManager {
|
|
|
208
242
|
nodeId?: string;
|
|
209
243
|
pointInTime?: number;
|
|
210
244
|
targetLsn?: number;
|
|
245
|
+
allowWalGap?: boolean;
|
|
211
246
|
}): Promise<RestoreLiveResult>;
|
|
212
247
|
private _restoreToTargetDirectory;
|
|
213
248
|
}
|