Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import BackupRestorer from './backupRestorer.js';
export type Backend = 'filesystem' | 's3' | 'gcs' | 'azure';
export type BackupStatus = 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED';
export type BackupCompressionLevel = 'DefaultCompression' | 'BestSpeed' | 'BestCompression';
export type BackupListOrder = 'asc' | 'desc';

export interface Backup {
creator: () => BackupCreator;
Expand Down
12 changes: 9 additions & 3 deletions src/collections/backup/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
Backend,
BackupCreateStatusGetter,
BackupCreator,
BackupListOrder,
BackupRestoreStatusGetter,
BackupRestorer,
} from '../../backup/index.js';
Expand Down Expand Up @@ -205,8 +206,12 @@ export const backup = (connection: Connection): Backup => {
}
: parseResponse(res);
},
list: (backend: Backend): Promise<BackupReturn[]> => {
return connection.get<BackupReturn[]>(`/backups/${backend}`);
list: (backend: Backend, order?: BackupListOrder): Promise<BackupReturn[]> => {
let url = `/backups/${backend}`;
if (order) {
url += `?order=${order}`;
}
return connection.get<BackupReturn[]>(url);
},
};
};
Expand Down Expand Up @@ -261,7 +266,8 @@ export interface Backup {
/** List existing backups (completed and in-progress) created in a given backend.
*
* @param {Backend} backend Backend whence to list backups.
* @param {BackupListOrder} [order] Order in which to list backups.
* @returns {Promise<BackupReturn[]>} The response from Weaviate.
* */
list(backend: Backend): Promise<BackupReturn[]>;
list(backend: Backend, order?: BackupListOrder): Promise<BackupReturn[]>;
}
6 changes: 6 additions & 0 deletions src/collections/backup/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export type BackupReturn = BackupStatusReturn & {
backend: Backend;
/** The collections that were included in the backup */
collections: string[];
/** Timestamp when the backup process started */
startedAt?: Date;
/** Timestamp when the backup process completed (successfully or with failure) */
completedAt?: Date;
/** Size of the backup in Gibs */
size?: number;
};

/** Configuration options available when creating a backup */
Expand Down