Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Storage Backends

MediaGit supports 7 storage backends through a unified trait-based abstraction.

Available Backends

  1. Local - File system storage
  2. S3 - Amazon S3
  3. Azure - Azure Blob Storage
  4. GCS - Google Cloud Storage
  5. B2 - Backblaze B2
  6. MinIO - Self-hosted S3-compatible
  7. Spaces - DigitalOcean Spaces

Backend Trait

#![allow(unused)]
fn main() {
#[async_trait]
pub trait Backend: Send + Sync {
    async fn get(&self, key: &str) -> Result<Vec<u8>>;
    async fn put(&self, key: &str, data: &[u8]) -> Result<()>;
    async fn exists(&self, key: &str) -> Result<bool>;
    async fn delete(&self, key: &str) -> Result<()>;
    async fn list(&self, prefix: &str) -> Result<Vec<String>>;
}
}

Configuration

See individual backend documentation:

Choosing a Backend

BackendBest ForCostPerformance
LocalDevelopment, small teamsFreeFastest
S3Production, global teams$$$Excellent
AzureMicrosoft ecosystem$$$Excellent
GCSGoogle Cloud users$$$Excellent
B2Cost-effective archival$Good
MinIOSelf-hosted, complianceFree*Excellent
SpacesSimple cloud storage$$Good

*MinIO requires infrastructure costs

Migration Between Backends

# Clone from S3 to local
mediagit clone s3://my-bucket/repo.git ./repo

# Push to different backend
cd repo
mediagit remote add azure azure://my-account/my-container/repo.git
mediagit push azure main