tero
Version:
tero is a JSON document Manager, with ACID complaint and backup recovery mechanism.
65 lines (64 loc) • 1.73 kB
TypeScript
export interface CloudStorageConfig {
provider: 'aws-s3' | 'cloudflare-r2';
region: string;
bucket: string;
accessKeyId: string;
secretAccessKey: string;
endpoint?: string;
pathPrefix?: string;
}
export interface BackupConfig {
interval?: string;
retention?: string;
format: 'individual' | 'archive';
cloudStorage?: CloudStorageConfig;
localPath?: string;
compression?: boolean;
includeMetadata?: boolean;
metadataUse?: 'verification' | 'audit' | 'recovery' | 'none';
}
export interface BackupMetadata {
timestamp: string;
format: 'individual' | 'archive';
fileCount: number;
totalSize: number;
checksum: string;
retention: string;
}
export declare class BackupManager {
private s3Client?;
private scheduledBackups;
private config;
private dbPath;
constructor(dbPath: string, config: BackupConfig);
private initializeCloudStorage;
private parseInterval;
private parseRetention;
private calculateChecksum;
private getJsonFiles;
private createArchiveBackup;
private createIndividualBackup;
private uploadToCloud;
private uploadDirectoryToCloud;
private getCloudKey;
performBackup(): Promise<{
success: boolean;
metadata: BackupMetadata;
cloudUploaded?: boolean;
}>;
private cleanupOldBackups;
scheduleBackup(config: {
interval: string;
retention?: string;
}): string;
cancelScheduledBackup(scheduleId: string): boolean;
getScheduledBackups(): Array<{
id: string;
active: boolean;
}>;
testCloudConnection(): Promise<{
success: boolean;
message: string;
}>;
destroy(): void;
}