backend: implement deleteRecordingBinaryFilesByPaths method in StorageProvider and S3StorageProvider
This commit is contained in:
parent
2c03ecdd9a
commit
5295d6326e
@ -188,7 +188,9 @@ export class RecordingService {
|
||||
|
||||
if (binaryFilesToDelete.size > 0) {
|
||||
// Delete video files from S3
|
||||
deleteRecordingTasks.push(this.s3Service.deleteObjects(Array.from(binaryFilesToDelete)));
|
||||
deleteRecordingTasks.push(
|
||||
this.storageService.deleteRecordingBinaryFilesByPaths(Array.from(binaryFilesToDelete))
|
||||
);
|
||||
}
|
||||
|
||||
if (metadataFilesToDelete.size > 0) {
|
||||
@ -260,7 +262,7 @@ export class RecordingService {
|
||||
// Delete recordings and its metadata from S3
|
||||
try {
|
||||
await Promise.all([
|
||||
this.s3Service.deleteObjects(Array.from(allBinaryFilesToDelete)),
|
||||
this.storageService.deleteRecordingBinaryFilesByPaths(Array.from(allBinaryFilesToDelete)),
|
||||
this.storageService.deleteRecordingMetadataByPaths(Array.from(allMetadataFilesToDelete))
|
||||
]);
|
||||
this.logger.info(`BulkDelete: Successfully deleted ${allBinaryFilesToDelete.size} recordings.`);
|
||||
|
||||
@ -364,6 +364,23 @@ export class S3StorageProvider<
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes multiple recording binary files from S3 storage using their file paths.
|
||||
*
|
||||
* @param recordingPaths - Array of file paths/keys identifying the recording files to delete from S3
|
||||
* @returns A Promise that resolves when all files have been successfully deleted
|
||||
* @throws Will throw an error if the S3 delete operation fails
|
||||
*/
|
||||
async deleteRecordingBinaryFilesByPaths(recordingPaths: string[]): Promise<void> {
|
||||
try {
|
||||
await this.s3Service.deleteObjects(recordingPaths);
|
||||
this.logger.verbose(`Deleted recording binary files: ${recordingPaths.join(', ')}`);
|
||||
} catch (error) {
|
||||
this.handleError(error, `Error deleting recording binary files: ${recordingPaths.join(', ')}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async getRecordingMetadata(recordingId: string): Promise<{ recordingInfo: MRec; metadataFilePath: string }> {
|
||||
try {
|
||||
const metadataPath = RecordingHelper.buildMetadataFilePath(recordingId);
|
||||
|
||||
@ -141,4 +141,12 @@ export interface StorageProvider<
|
||||
*/
|
||||
deleteRecordingMetadataByPaths(metadataPaths: string[]): Promise<void>;
|
||||
|
||||
/**
|
||||
* Deletes multiple recording binary files by their paths.
|
||||
*
|
||||
* @param recordingPaths - An array of recording file paths to delete.
|
||||
* @returns A promise that resolves when the recording binary files have been deleted.
|
||||
*/
|
||||
deleteRecordingBinaryFilesByPaths(recordingPaths: string[]): Promise<void>;
|
||||
|
||||
}
|
||||
|
||||
@ -221,6 +221,18 @@ export class MeetStorageService<
|
||||
return this.storageProvider.deleteRecordingMetadataByPaths(metadataPaths);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes recording binary files from storage using the provided file paths.
|
||||
*
|
||||
* @param recordingPaths - Array of file paths pointing to the recording binary files to be deleted
|
||||
* @returns A Promise that resolves when all specified recording files have been successfully deleted
|
||||
* @throws May throw an error if any of the file deletion operations fail
|
||||
*/
|
||||
async deleteRecordingBinaryFilesByPaths(recordingPaths: string[]): Promise<void> {
|
||||
return this.storageProvider.deleteRecordingBinaryFilesByPaths(recordingPaths);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the default global preferences.
|
||||
* @returns {GPrefs}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user