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:
parent
508c1b1e9f
commit
aa887096f9
9 changed files with 69 additions and 23 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue