video thumbnails

This commit is contained in:
2025-11-25 22:34:05 +01:00
parent c4603a0b3a
commit 757abe9a0f
9 changed files with 389 additions and 15 deletions
+21
View File
@@ -27,6 +27,8 @@ pub trait ObjectStorage: Send + Sync + 'static {
async fn get_object(&self, key: &str) -> Result<Vec<u8>>;
async fn get_object_range(&self, key: &str, start: u64, end: Option<u64>) -> Result<Vec<u8>>;
async fn delete_object(&self, key: &str) -> Result<()>;
}
@@ -104,6 +106,15 @@ impl ObjectStorage for S3Storage {
Ok(data.into_bytes().to_vec())
}
async fn get_object_range(&self, key: &str, start: u64, end: Option<u64>) -> Result<Vec<u8>> {
let data = self
.bucket
.get_object_range(key, start, end)
.await
.context("failed to download ranged object from S3")?;
Ok(data.into_bytes().to_vec())
}
async fn delete_object(&self, key: &str) -> Result<()> {
self.bucket
.delete_object(key)
@@ -167,6 +178,16 @@ impl TenantStorage {
self.inner.get_object(&qualified).await
}
pub async fn get_object_range(
&self,
key: &str,
start: u64,
end: Option<u64>,
) -> Result<Vec<u8>> {
let qualified = self.qualify(key);
self.inner.get_object_range(&qualified, start, end).await
}
pub async fn delete_object(&self, key: &str) -> Result<()> {
let qualified = self.qualify(key);
self.inner.delete_object(&qualified).await