tero 0.0.13 → 0.1.2
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 +16 -27
- package/dist/acid-engine.d.ts +230 -53
- package/dist/acid-engine.js +1201 -323
- package/dist/backup.d.ts +27 -0
- package/dist/backup.js +708 -167
- package/dist/index.d.ts +167 -61
- package/dist/index.js +1498 -277
- package/dist/recovery.d.ts +52 -5
- package/dist/recovery.js +398 -117
- package/package.json +20 -16
- package/dist/schema.d.ts +0 -61
- package/dist/schema.js +0 -425
package/dist/recovery.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { CloudStorageConfig } from "./backup.js";
|
|
2
|
+
export declare const MAX_DOCUMENT_SIZE: number;
|
|
3
|
+
export type RecoveryErrorKind = 'NOT_FOUND' | 'RETRYABLE_NETWORK' | 'FATAL_AUTH' | 'CANCELLED' | 'FATAL_CORRUPTION' | 'FATAL_UNKNOWN';
|
|
4
|
+
export declare function classifyRecoveryError(error: any): RecoveryErrorKind;
|
|
2
5
|
export interface RecoveryConfig {
|
|
3
6
|
cloudStorage: CloudStorageConfig;
|
|
4
7
|
localPath: string;
|
|
5
8
|
autoRecover?: boolean;
|
|
6
9
|
recoveryTimeout?: number;
|
|
7
|
-
mode?: 'all' | 'missing' | 'none';
|
|
8
10
|
continueOnError?: boolean;
|
|
9
11
|
concurrency?: number;
|
|
12
|
+
customS3Client?: any;
|
|
10
13
|
}
|
|
11
14
|
export interface RecoveryResult {
|
|
12
15
|
success: boolean;
|
|
@@ -31,21 +34,65 @@ export declare class DataRecovery {
|
|
|
31
34
|
private getCloudKey;
|
|
32
35
|
private isNotFound;
|
|
33
36
|
checkFileInCloud(key: string): Promise<FileRecoveryInfo>;
|
|
37
|
+
/**
|
|
38
|
+
* Efficiently fetches a single file from cloud storage, writes it atomically
|
|
39
|
+
* to the partitioned disk location, and returns the parsed JSON data directly
|
|
40
|
+
* from memory — avoiding redundant disk reads or extra syscalls.
|
|
41
|
+
*/
|
|
42
|
+
fetchAndPersist(key: string, options?: {
|
|
43
|
+
abortSignal?: AbortSignal;
|
|
44
|
+
}): Promise<any | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Delete a single document file from cloud storage.
|
|
47
|
+
* Used to propagate deletes in lazy-hydration mode.
|
|
48
|
+
*/
|
|
49
|
+
deleteFromCloud(key: string): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Upload a durable tombstone for a deleted key (P0-2). Tombstone carries
|
|
52
|
+
* a monotonic version (LSN or timestamp) so that a later re-create can
|
|
53
|
+
* invalidate it. Hydration must check tombstone before resurrecting.
|
|
54
|
+
*/
|
|
55
|
+
putTombstone(key: string, version?: number): Promise<void>;
|
|
56
|
+
deleteTombstone(key: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a tombstone exists for the key. If both a document and a tombstone
|
|
59
|
+
* exist, the newer LastModified wins (tombstone newer => logically deleted).
|
|
60
|
+
* Returns true if key is tombstoned (deleted) and hydration must not resurrect.
|
|
61
|
+
*/
|
|
62
|
+
hasTombstone(key: string): Promise<boolean>;
|
|
34
63
|
recoverSingleFile(key: string): Promise<boolean>;
|
|
35
64
|
recoverFromArchive(archiveName?: string): Promise<RecoveryResult>;
|
|
36
65
|
recoverIndividualFiles(keys?: string[], isCancelled?: () => boolean): Promise<RecoveryResult>;
|
|
37
|
-
|
|
38
|
-
|
|
66
|
+
iterateAvailableArchives(options?: {
|
|
67
|
+
abortSignal?: AbortSignal;
|
|
68
|
+
}): AsyncGenerator<{
|
|
69
|
+
name: string;
|
|
70
|
+
key: string;
|
|
71
|
+
lastModified?: Date;
|
|
72
|
+
}, void, unknown>;
|
|
73
|
+
listAvailableArchives(options?: {
|
|
74
|
+
abortSignal?: AbortSignal;
|
|
75
|
+
}): Promise<string[]>;
|
|
76
|
+
iterateAvailableFiles(options?: {
|
|
77
|
+
abortSignal?: AbortSignal;
|
|
78
|
+
}): AsyncGenerator<string, void, unknown>;
|
|
79
|
+
listAvailableFiles(options?: {
|
|
80
|
+
abortSignal?: AbortSignal;
|
|
81
|
+
}): Promise<string[]>;
|
|
39
82
|
/**
|
|
40
83
|
* List files that exist in the cloud bucket but are missing from the local directory.
|
|
41
84
|
* This is the v2 fast path used during hydrate-on-startup with mode='missing'.
|
|
42
85
|
*/
|
|
43
|
-
listMissingLocally(
|
|
86
|
+
listMissingLocally(options?: {
|
|
87
|
+
abortSignal?: AbortSignal;
|
|
88
|
+
}): Promise<string[]>;
|
|
44
89
|
/**
|
|
45
90
|
* Recover only files that exist in the cloud but are missing locally.
|
|
46
91
|
* Returns the standard RecoveryResult. Used by v2 hydrate-on-startup (mode='missing').
|
|
47
92
|
*/
|
|
48
|
-
recoverMissingFiles(
|
|
93
|
+
recoverMissingFiles(isCancelledOrOptions?: (() => boolean) | {
|
|
94
|
+
abortSignal?: AbortSignal;
|
|
95
|
+
}): Promise<RecoveryResult>;
|
|
49
96
|
private downloadFile;
|
|
50
97
|
private extractArchive;
|
|
51
98
|
testCloudConnection(): Promise<{
|