1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Correctly delete live files from object storage

This commit is contained in:
Chocobozzz 2022-10-25 14:18:59 +02:00
parent 508c1b1e9f
commit aa887096f9
No known key found for this signature in database
GPG key ID: 583A612D890159BE
9 changed files with 69 additions and 23 deletions

View file

@ -110,11 +110,15 @@ function updatePrefixACL (options: {
function removeObject (objectStorageKey: string, bucketInfo: BucketInfo) {
const key = buildKey(objectStorageKey, bucketInfo)
logger.debug('Removing file %s in bucket %s', key, bucketInfo.BUCKET_NAME, lTags())
return removeObjectByFullKey(key, bucketInfo)
}
function removeObjectByFullKey (fullKey: string, bucketInfo: BucketInfo) {
logger.debug('Removing file %s in bucket %s', fullKey, bucketInfo.BUCKET_NAME, lTags())
const command = new DeleteObjectCommand({
Bucket: bucketInfo.BUCKET_NAME,
Key: key
Key: fullKey
})
return getClient().send(command)
@ -195,6 +199,7 @@ export {
storeObject,
removeObject,
removeObjectByFullKey,
removePrefix,
makeAvailable,

View file

@ -11,6 +11,7 @@ import {
lTags,
makeAvailable,
removeObject,
removeObjectByFullKey,
removePrefix,
storeObject,
updateObjectACL,
@ -76,10 +77,18 @@ function removeHLSObjectStorage (playlist: MStreamingPlaylistVideo) {
return removePrefix(generateHLSObjectBaseStorageKey(playlist), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS)
}
function removeHLSFileObjectStorage (playlist: MStreamingPlaylistVideo, filename: string) {
function removeHLSFileObjectStorageByFilename (playlist: MStreamingPlaylistVideo, filename: string) {
return removeObject(generateHLSObjectStorageKey(playlist, filename), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS)
}
function removeHLSFileObjectStorageByPath (playlist: MStreamingPlaylistVideo, path: string) {
return removeObject(generateHLSObjectStorageKey(playlist, basename(path)), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS)
}
function removeHLSFileObjectStorageByFullKey (key: string) {
return removeObjectByFullKey(key, CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS)
}
// ---------------------------------------------------------------------------
function removeWebTorrentObjectStorage (videoFile: MVideoFile) {
@ -162,7 +171,10 @@ export {
updateHLSFilesACL,
removeHLSObjectStorage,
removeHLSFileObjectStorage,
removeHLSFileObjectStorageByFilename,
removeHLSFileObjectStorageByPath,
removeHLSFileObjectStorageByFullKey,
removeWebTorrentObjectStorage,
makeWebTorrentFileAvailable,