backend: refactor recording metadata retrieval to use MeetStorageService and update StorageProvider interface
This commit is contained in:
parent
2e51681cd9
commit
325fb90550
@ -301,7 +301,7 @@ export class RecordingService {
|
|||||||
* @returns A promise that resolves to a MeetRecordingInfo object.
|
* @returns A promise that resolves to a MeetRecordingInfo object.
|
||||||
*/
|
*/
|
||||||
async getRecording(recordingId: string, fields?: string): Promise<MeetRecordingInfo> {
|
async getRecording(recordingId: string, fields?: string): Promise<MeetRecordingInfo> {
|
||||||
const { recordingInfo } = await this.getMeetRecordingInfoFromMetadata(recordingId);
|
const { recordingInfo } = await this.storageService.getRecordingMetadata(recordingId);
|
||||||
|
|
||||||
return UtilsHelper.filterObjectFields(recordingInfo, fields) as MeetRecordingInfo;
|
return UtilsHelper.filterObjectFields(recordingInfo, fields) as MeetRecordingInfo;
|
||||||
}
|
}
|
||||||
@ -508,7 +508,7 @@ export class RecordingService {
|
|||||||
protected async getDeletableRecordingFiles(
|
protected async getDeletableRecordingFiles(
|
||||||
recordingId: string
|
recordingId: string
|
||||||
): Promise<{ filesToDelete: Set<string>; recordingInfo: MeetRecordingInfo }> {
|
): Promise<{ filesToDelete: Set<string>; recordingInfo: MeetRecordingInfo }> {
|
||||||
const { metadataFilePath, recordingInfo } = await this.getMeetRecordingInfoFromMetadata(recordingId);
|
const { metadataFilePath, recordingInfo } = await this.storageService.getRecordingMetadata(recordingId);
|
||||||
const filesToDelete: Set<string> = new Set();
|
const filesToDelete: Set<string> = new Set();
|
||||||
|
|
||||||
// Validate the recording status
|
// Validate the recording status
|
||||||
@ -526,23 +526,23 @@ export class RecordingService {
|
|||||||
return { filesToDelete, recordingInfo };
|
return { filesToDelete, recordingInfo };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getMeetRecordingInfoFromMetadata(
|
// protected async getMeetRecordingInfoFromMetadata(
|
||||||
recordingId: string
|
// recordingId: string
|
||||||
): Promise<{ metadataFilePath: string; recordingInfo: MeetRecordingInfo }> {
|
// ): Promise<{ metadataFilePath: string; recordingInfo: MeetRecordingInfo }> {
|
||||||
const { roomId, egressId, uid } = RecordingHelper.extractInfoFromRecordingId(recordingId);
|
// const { roomId, egressId, uid } = RecordingHelper.extractInfoFromRecordingId(recordingId);
|
||||||
|
|
||||||
const metadataPath = `${INTERNAL_CONFIG.S3_RECORDINGS_PREFIX}/.metadata/${roomId}/${egressId}/${uid}.json`;
|
// const metadataPath = `${INTERNAL_CONFIG.S3_RECORDINGS_PREFIX}/.metadata/${roomId}/${egressId}/${uid}.json`;
|
||||||
this.logger.debug(`Retrieving metadata for recording ${recordingId} from ${metadataPath}`);
|
// this.logger.debug(`Retrieving metadata for recording ${recordingId} from ${metadataPath}`);
|
||||||
const recordingInfo = (await this.s3Service.getObjectAsJson(metadataPath)) as MeetRecordingInfo;
|
// const recordingInfo = (await this.s3Service.getObjectAsJson(metadataPath)) as MeetRecordingInfo;
|
||||||
|
|
||||||
if (!recordingInfo) {
|
// if (!recordingInfo) {
|
||||||
throw errorRecordingNotFound(recordingId);
|
// throw errorRecordingNotFound(recordingId);
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.logger.verbose(`Retrieved metadata for recording ${recordingId} from ${metadataPath}`);
|
// this.logger.verbose(`Retrieved metadata for recording ${recordingId} from ${metadataPath}`);
|
||||||
|
|
||||||
return { recordingInfo, metadataFilePath: metadataPath };
|
// return { recordingInfo, metadataFilePath: metadataPath };
|
||||||
}
|
// }
|
||||||
|
|
||||||
protected generateCompositeOptionsFromRequest(layout = 'grid'): RoomCompositeOptions {
|
protected generateCompositeOptionsFromRequest(layout = 'grid'): RoomCompositeOptions {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { PutObjectCommandOutput } from '@aws-sdk/client-s3';
|
|||||||
import { GlobalPreferences, MeetRecordingInfo, MeetRoom } from '@typings-ce';
|
import { GlobalPreferences, MeetRecordingInfo, MeetRoom } from '@typings-ce';
|
||||||
import { inject, injectable } from 'inversify';
|
import { inject, injectable } from 'inversify';
|
||||||
import INTERNAL_CONFIG from '../../../config/internal-config.js';
|
import INTERNAL_CONFIG from '../../../config/internal-config.js';
|
||||||
import { OpenViduMeetError, RedisKeyName } from '../../../models/index.js';
|
import { errorRecordingNotFound, OpenViduMeetError, RedisKeyName } from '../../../models/index.js';
|
||||||
import { LoggerService, RedisService, S3Service, StorageProvider } from '../../index.js';
|
import { LoggerService, RedisService, S3Service, StorageProvider } from '../../index.js';
|
||||||
import { RecordingHelper } from '../../../helpers/recording.helper.js';
|
import { RecordingHelper } from '../../../helpers/recording.helper.js';
|
||||||
|
|
||||||
@ -354,10 +354,23 @@ export class S3StorageProvider<
|
|||||||
this.logger.warn('deleteArchivedRoomMetadata is not implemented yet');
|
this.logger.warn('deleteArchivedRoomMetadata is not implemented yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRecordingMetadata(recordingId: string): Promise<MRec | null> {
|
async getRecordingMetadata(recordingId: string): Promise<{ recordingInfo: MRec; metadataFilePath: string }> {
|
||||||
//TODO : Implement this method to retrieve recording metadata for a room
|
try {
|
||||||
this.logger.warn('getRecordingMetadata is not implemented yet');
|
const metadataPath = RecordingHelper.buildMetadataFilePath(recordingId);
|
||||||
return null;
|
this.logger.debug(`Retrieving metadata for recording ${recordingId} from ${metadataPath}`);
|
||||||
|
const recordingInfo = (await this.s3Service.getObjectAsJson(metadataPath)) as MRec;
|
||||||
|
|
||||||
|
if (!recordingInfo) {
|
||||||
|
throw errorRecordingNotFound(recordingId);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.logger.verbose(`Retrieved metadata for recording ${recordingId} from ${metadataPath}`);
|
||||||
|
|
||||||
|
return { recordingInfo, metadataFilePath: metadataPath };
|
||||||
|
} catch (error) {
|
||||||
|
this.handleError(error, `Error fetching recording metadata for recording ${recordingId}`);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveRecordingMetadata(recordingInfo: MRec): Promise<MRec> {
|
async saveRecordingMetadata(recordingInfo: MRec): Promise<MRec> {
|
||||||
@ -371,10 +384,7 @@ export class S3StorageProvider<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteRecordingMetadata(recordingId: string): Promise<void> {
|
async deleteRecordingMetadata(recordingId: string): Promise<void> {}
|
||||||
//TODO : Implement this method to delete recording metadata for a room
|
|
||||||
this.logger.warn('deleteRecordingMetadata is not implemented yet');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves an object of type U from Redis by the given key.
|
* Retrieves an object of type U from Redis by the given key.
|
||||||
|
|||||||
@ -132,7 +132,7 @@ export interface StorageProvider<
|
|||||||
* @param recordingId - The unique identifier of the recording.
|
* @param recordingId - The unique identifier of the recording.
|
||||||
* @returns A promise that resolves to the recording metadata, or null if not found.
|
* @returns A promise that resolves to the recording metadata, or null if not found.
|
||||||
*/
|
*/
|
||||||
getRecordingMetadata(recordingId: string): Promise<MRec | null>;
|
getRecordingMetadata(recordingId: string): Promise<{ recordingInfo: MRec; metadataFilePath: string }>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the recording metadata for a specific recording ID.
|
* Deletes the recording metadata for a specific recording ID.
|
||||||
|
|||||||
@ -192,6 +192,13 @@ export class MeetStorageService<
|
|||||||
return this.storageProvider.saveRecordingMetadata(recordingInfo) as Promise<MRec>;
|
return this.storageProvider.saveRecordingMetadata(recordingInfo) as Promise<MRec>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getRecordingMetadata(recordingId: string): Promise<{ recordingInfo: MRec; metadataFilePath: string }> {
|
||||||
|
return this.storageProvider.getRecordingMetadata(recordingId) as Promise<{
|
||||||
|
recordingInfo: MRec;
|
||||||
|
metadataFilePath: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default global preferences.
|
* Returns the default global preferences.
|
||||||
* @returns {GPrefs}
|
* @returns {GPrefs}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user