| 177 |
177 |
|
async fn object_exists(&self, s3_key: &str) -> Result<bool>;
|
| 178 |
178 |
|
async fn object_size(&self, s3_key: &str) -> Result<Option<i64>>;
|
| 179 |
179 |
|
async fn download_object(&self, s3_key: &str) -> Result<Vec<u8>>;
|
|
180 |
+ |
/// Stream the object body without buffering the whole payload. Callers
|
|
181 |
+ |
/// drive the stream to disk (scanner spool) or to a layer that consumes
|
|
182 |
+ |
/// chunks directly.
|
|
183 |
+ |
async fn download_stream(&self, s3_key: &str) -> Result<s3_storage::ByteStream>;
|
| 180 |
184 |
|
async fn upload_object(&self, s3_key: &str, content_type: &str, data: Vec<u8>, cache_control: Option<&str>) -> Result<()>;
|
| 181 |
185 |
|
async fn delete_object(&self, s3_key: &str) -> Result<()>;
|
| 182 |
186 |
|
/// Delete a batch of objects in a single S3 `DeleteObjects` request
|
| 393 |
397 |
|
.map_err(AppError::Storage)
|
| 394 |
398 |
|
}
|
| 395 |
399 |
|
|
|
400 |
+ |
/// Stream an object's body from S3 without buffering. See trait docs.
|
|
401 |
+ |
pub async fn download_stream(&self, s3_key: &str) -> Result<s3_storage::ByteStream> {
|
|
402 |
+ |
self.inner
|
|
403 |
+ |
.download_stream(s3_key)
|
|
404 |
+ |
.await
|
|
405 |
+ |
.map_err(AppError::Storage)
|
|
406 |
+ |
}
|
|
407 |
+ |
|
| 396 |
408 |
|
/// Upload an object to S3 from bytes
|
| 397 |
409 |
|
pub async fn upload_object(
|
| 398 |
410 |
|
&self,
|
| 587 |
599 |
|
self.download_object(s3_key).await
|
| 588 |
600 |
|
}
|
| 589 |
601 |
|
|
|
602 |
+ |
async fn download_stream(&self, s3_key: &str) -> Result<s3_storage::ByteStream> {
|
|
603 |
+ |
self.download_stream(s3_key).await
|
|
604 |
+ |
}
|
|
605 |
+ |
|
| 590 |
606 |
|
async fn upload_object(&self, s3_key: &str, content_type: &str, data: Vec<u8>, cache_control: Option<&str>) -> Result<()> {
|
| 591 |
607 |
|
self.upload_object(s3_key, content_type, data, cache_control).await
|
| 592 |
608 |
|
}
|