diff options
Diffstat (limited to 'server/lib/object-storage')
-rw-r--r-- | server/lib/object-storage/shared/object-storage-helpers.ts | 9 | ||||
-rw-r--r-- | server/lib/object-storage/videos.ts | 16 |
2 files changed, 21 insertions, 4 deletions
diff --git a/server/lib/object-storage/shared/object-storage-helpers.ts b/server/lib/object-storage/shared/object-storage-helpers.ts index d13c25798..3046d76bc 100644 --- a/server/lib/object-storage/shared/object-storage-helpers.ts +++ b/server/lib/object-storage/shared/object-storage-helpers.ts | |||
@@ -110,11 +110,15 @@ function updatePrefixACL (options: { | |||
110 | function removeObject (objectStorageKey: string, bucketInfo: BucketInfo) { | 110 | function removeObject (objectStorageKey: string, bucketInfo: BucketInfo) { |
111 | const key = buildKey(objectStorageKey, bucketInfo) | 111 | const key = buildKey(objectStorageKey, bucketInfo) |
112 | 112 | ||
113 | logger.debug('Removing file %s in bucket %s', key, bucketInfo.BUCKET_NAME, lTags()) | 113 | return removeObjectByFullKey(key, bucketInfo) |
114 | } | ||
115 | |||
116 | function removeObjectByFullKey (fullKey: string, bucketInfo: BucketInfo) { | ||
117 | logger.debug('Removing file %s in bucket %s', fullKey, bucketInfo.BUCKET_NAME, lTags()) | ||
114 | 118 | ||
115 | const command = new DeleteObjectCommand({ | 119 | const command = new DeleteObjectCommand({ |
116 | Bucket: bucketInfo.BUCKET_NAME, | 120 | Bucket: bucketInfo.BUCKET_NAME, |
117 | Key: key | 121 | Key: fullKey |
118 | }) | 122 | }) |
119 | 123 | ||
120 | return getClient().send(command) | 124 | return getClient().send(command) |
@@ -195,6 +199,7 @@ export { | |||
195 | storeObject, | 199 | storeObject, |
196 | 200 | ||
197 | removeObject, | 201 | removeObject, |
202 | removeObjectByFullKey, | ||
198 | removePrefix, | 203 | removePrefix, |
199 | 204 | ||
200 | makeAvailable, | 205 | makeAvailable, |
diff --git a/server/lib/object-storage/videos.ts b/server/lib/object-storage/videos.ts index 003807826..b764e4b22 100644 --- a/server/lib/object-storage/videos.ts +++ b/server/lib/object-storage/videos.ts | |||
@@ -11,6 +11,7 @@ import { | |||
11 | lTags, | 11 | lTags, |
12 | makeAvailable, | 12 | makeAvailable, |
13 | removeObject, | 13 | removeObject, |
14 | removeObjectByFullKey, | ||
14 | removePrefix, | 15 | removePrefix, |
15 | storeObject, | 16 | storeObject, |
16 | updateObjectACL, | 17 | updateObjectACL, |
@@ -76,10 +77,18 @@ function removeHLSObjectStorage (playlist: MStreamingPlaylistVideo) { | |||
76 | return removePrefix(generateHLSObjectBaseStorageKey(playlist), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS) | 77 | return removePrefix(generateHLSObjectBaseStorageKey(playlist), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS) |
77 | } | 78 | } |
78 | 79 | ||
79 | function removeHLSFileObjectStorage (playlist: MStreamingPlaylistVideo, filename: string) { | 80 | function removeHLSFileObjectStorageByFilename (playlist: MStreamingPlaylistVideo, filename: string) { |
80 | return removeObject(generateHLSObjectStorageKey(playlist, filename), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS) | 81 | return removeObject(generateHLSObjectStorageKey(playlist, filename), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS) |
81 | } | 82 | } |
82 | 83 | ||
84 | function removeHLSFileObjectStorageByPath (playlist: MStreamingPlaylistVideo, path: string) { | ||
85 | return removeObject(generateHLSObjectStorageKey(playlist, basename(path)), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS) | ||
86 | } | ||
87 | |||
88 | function removeHLSFileObjectStorageByFullKey (key: string) { | ||
89 | return removeObjectByFullKey(key, CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS) | ||
90 | } | ||
91 | |||
83 | // --------------------------------------------------------------------------- | 92 | // --------------------------------------------------------------------------- |
84 | 93 | ||
85 | function removeWebTorrentObjectStorage (videoFile: MVideoFile) { | 94 | function removeWebTorrentObjectStorage (videoFile: MVideoFile) { |
@@ -162,7 +171,10 @@ export { | |||
162 | updateHLSFilesACL, | 171 | updateHLSFilesACL, |
163 | 172 | ||
164 | removeHLSObjectStorage, | 173 | removeHLSObjectStorage, |
165 | removeHLSFileObjectStorage, | 174 | removeHLSFileObjectStorageByFilename, |
175 | removeHLSFileObjectStorageByPath, | ||
176 | removeHLSFileObjectStorageByFullKey, | ||
177 | |||
166 | removeWebTorrentObjectStorage, | 178 | removeWebTorrentObjectStorage, |
167 | 179 | ||
168 | makeWebTorrentFileAvailable, | 180 | makeWebTorrentFileAvailable, |