greentic_deployer/bundle_upload/uploader.rs
1use std::path::Path;
2
3use super::error::BundleUploadResult;
4use super::types::{UploadOptions, UploadedBundle};
5
6/// Cloud-agnostic interface for uploading a `.gtbundle` and producing a fetchable URL.
7///
8/// Implementors:
9/// - `S3Uploader` (feature `bundle-upload-aws`)
10/// - `GcsUploader` (feature `bundle-upload-gcp`, currently stub)
11/// - `AzureUploader` (feature `bundle-upload-azure`, currently stub)
12#[async_trait::async_trait]
13pub trait BundleUploader: Send + Sync + std::fmt::Debug {
14 /// Upload `bundle_path`. If an object with matching digest already exists at
15 /// the target key, skip the byte upload and proceed to URL issuance.
16 async fn upload(
17 &self,
18 bundle_path: &Path,
19 opts: &UploadOptions,
20 ) -> BundleUploadResult<UploadedBundle>;
21
22 /// Re-issue a fresh URL for an existing uploaded bundle without re-uploading.
23 /// `object_ref` is the value previously returned in `UploadedBundle::object_ref`.
24 async fn refresh_url(
25 &self,
26 object_ref: &str,
27 opts: &UploadOptions,
28 ) -> BundleUploadResult<UploadedBundle>;
29}