Storage Backends
MediaGit supports 7 storage backends through a unified trait-based abstraction.
Available Backends
- Local - File system storage
- S3 - Amazon S3
- Azure - Azure Blob Storage
- GCS - Google Cloud Storage
- B2 - Backblaze B2
- MinIO - Self-hosted S3-compatible
- 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
| Backend | Best For | Cost | Performance |
|---|---|---|---|
| Local | Development, small teams | Free | Fastest |
| S3 | Production, global teams | $$$ | Excellent |
| Azure | Microsoft ecosystem | $$$ | Excellent |
| GCS | Google Cloud users | $$$ | Excellent |
| B2 | Cost-effective archival | $ | Good |
| MinIO | Self-hosted, compliance | Free* | Excellent |
| Spaces | Simple 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