97 lines
2.1 KiB
TypeScript
97 lines
2.1 KiB
TypeScript
export type TBackupStatus =
|
|
| 'pending'
|
|
| 'running'
|
|
| 'replicating'
|
|
| 'replicated'
|
|
| 'ready'
|
|
| 'failed'
|
|
| 'restoring'
|
|
| 'restored';
|
|
|
|
export type TBackupTrigger = 'manual' | 'scheduled';
|
|
|
|
export type TBackupResourceType = 'volume' | 'database' | 'objectstorage';
|
|
|
|
export interface IBackupSnapshotBase {
|
|
type: TBackupResourceType;
|
|
snapshotId: string;
|
|
snapshotName?: string;
|
|
originalSize: number;
|
|
storedSize: number;
|
|
createdAt: number;
|
|
tags?: Record<string, string>;
|
|
}
|
|
|
|
export interface IBackupVolumeSnapshot extends IBackupSnapshotBase {
|
|
type: 'volume';
|
|
volumeName: string;
|
|
mountPath: string;
|
|
}
|
|
|
|
export interface IBackupDatabaseSnapshot extends IBackupSnapshotBase {
|
|
type: 'database';
|
|
resourceName: string;
|
|
databaseName: string;
|
|
}
|
|
|
|
export interface IBackupObjectStorageSnapshot extends IBackupSnapshotBase {
|
|
type: 'objectstorage';
|
|
resourceName: string;
|
|
bucketName: string;
|
|
}
|
|
|
|
export type TBackupSnapshot =
|
|
| IBackupVolumeSnapshot
|
|
| IBackupDatabaseSnapshot
|
|
| IBackupObjectStorageSnapshot;
|
|
|
|
export type TBackupReplicationTargetType = 's3' | 'smb';
|
|
|
|
export interface IBackupArchiveObject {
|
|
path: string;
|
|
size: number;
|
|
sha256: string;
|
|
}
|
|
|
|
export interface IBackupArchiveManifest {
|
|
version: 1;
|
|
backupId: string;
|
|
createdAt: number;
|
|
objects: IBackupArchiveObject[];
|
|
totalSize: number;
|
|
}
|
|
|
|
export interface IBackupReplicationResult {
|
|
targetType: TBackupReplicationTargetType;
|
|
targetPath: string;
|
|
manifestPath: string;
|
|
manifestSha256: string;
|
|
objectCount: number;
|
|
totalSize: number;
|
|
completedAt: number;
|
|
}
|
|
|
|
export interface IBackupRestoreEvent {
|
|
restoredAt: number;
|
|
status: 'restored' | 'failed';
|
|
errorText?: string;
|
|
}
|
|
|
|
export interface IBackupRecord {
|
|
id: string;
|
|
serviceId: string;
|
|
serviceName?: string;
|
|
clusterId?: string;
|
|
status: TBackupStatus;
|
|
trigger: TBackupTrigger;
|
|
snapshots: TBackupSnapshot[];
|
|
replication?: IBackupReplicationResult;
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
completedAt?: number;
|
|
requestedBy?: string;
|
|
errorText?: string;
|
|
restoreHistory?: IBackupRestoreEvent[];
|
|
tags?: Record<string, string>;
|
|
}
|