src/restore-drill-types.tsTypeScript
@@ -0,0 +1,71 @@
1+
export interface BaseBackup {2+
id: string;3+
completedAt: Date;4+
location: string;5+
checksum: string;6+
endLsn: string;7+
}8+
9+
export interface WalSegment {10+
startLsn: string;11+
endLsn: string;12+
finalRecordAt: Date;13+
location: string;14+
}15+
16+
export interface RecoveryCatalog {17+
completedBackups(): Promise<readonly BaseBackup[]>;18+
walAfter(lsn: string): Promise<readonly WalSegment[]>;19+
}20+
21+
export interface BackupChecksumVerifier {22+
verify(location: string, expectedChecksum: string): Promise<boolean>;23+
}24+
25+
export interface WalReplayResult {26+
appliedThrough: { lsn: string; recordAt: Date } | null;27+
completedSegment: boolean;28+
}29+
30+
export interface RecoveryExpectations {31+
schemaHash: string;32+
requiredTableRowCounts: Readonly<Record<string, number>>;33+
sampledChecksums: Readonly<Record<string, string>>;34+
}35+
36+
export interface RestoreCluster {37+
id: string;38+
restoreBase(location: string): Promise<void>;39+
applyWal(40+
location: string,41+
options?: { stopAt: Date },42+
): Promise<WalReplayResult>;43+
ping(): Promise<boolean>;44+
schemaHash(): Promise<string>;45+
tableRowCounts(): Promise<Readonly<Record<string, number>>>;46+
sampledChecksums(): Promise<Readonly<Record<string, string>>>;47+
runReadOnlySmoke(): Promise<void>;48+
dispose(): Promise<void>;49+
}50+
51+
export interface RestoreClusters {52+
createIsolatedDrill(options: {53+
encryptionProfile: "production-compatible";54+
}): Promise<RestoreCluster>;55+
production(): Promise<RestoreCluster>;56+
}57+
58+
export interface ProductionRouter {59+
promote(clusterId: string): Promise<void>;60+
}61+
62+
export interface DrillAudit {63+
success(input: {64+
backupId: string;65+
targetTime: Date;66+
finalLsn: string;67+
finalReplayTime: Date;68+
measurements: Readonly<Record<string, unknown>>;69+
}): Promise<void>;70+
failure(input: { targetTime: Date; reason: string }): Promise<void>;71+
}