Initial Tessera backup vault (M0–M2)
Scaffold Rust workspace, React canvas, vault engine, hub API, providers, agent wormhole path, and Docker compose per SPEC.
This commit is contained in:
31
crates/tessera-providers/src/lib.rs
Normal file
31
crates/tessera-providers/src/lib.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
mod filesystem;
|
||||
mod postgres;
|
||||
|
||||
pub use filesystem::*;
|
||||
pub use postgres::*;
|
||||
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use serde_json::Value;
|
||||
use tessera_core::config::ProviderKind;
|
||||
|
||||
#[async_trait]
|
||||
pub trait BackupProvider: Send + Sync {
|
||||
fn kind(&self) -> ProviderKind;
|
||||
async fn capture(&self) -> Result<CaptureResult>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CaptureResult {
|
||||
pub payload: Vec<u8>,
|
||||
pub labels: Vec<String>,
|
||||
pub restore_hints: Value,
|
||||
}
|
||||
|
||||
pub fn provider_from_config(kind: &ProviderKind, config: &Value) -> Result<Box<dyn BackupProvider>> {
|
||||
match kind {
|
||||
ProviderKind::Filesystem => Ok(Box::new(FilesystemProvider::from_config(config)?)),
|
||||
ProviderKind::Postgres => Ok(Box::new(PostgresProvider::from_config(config)?)),
|
||||
ProviderKind::Command => anyhow::bail!("command provider not implemented in v1"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user