pub trait SnapshotStore: Send + Sync {
// Required methods
fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
snapshot: &'life2 SchemaSnapshot,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_latest<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<Option<SchemaSnapshot>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_by_hash<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
version_hash: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SchemaSnapshot>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<SchemaSnapshot>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn compare<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
hash_a: &'life2 str,
hash_b: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<SchemaDiff>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}Expand description
Trait for storing and retrieving schema snapshots
Implementations can store snapshots in:
- File system
- Database
- Version control
- In-memory (for testing)
Required Methods§
Sourcefn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
snapshot: &'life2 SchemaSnapshot,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
snapshot: &'life2 SchemaSnapshot,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a snapshot for a tenant
Sourcefn get_latest<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<Option<SchemaSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_latest<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<Option<SchemaSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve the latest snapshot for a tenant
Sourcefn get_by_hash<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
version_hash: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SchemaSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_by_hash<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
version_hash: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SchemaSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieve a specific snapshot by version hash
Sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<SchemaSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<SchemaSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all snapshots for a tenant (ordered by creation time, newest first)
Sourcefn compare<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
hash_a: &'life2 str,
hash_b: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<SchemaDiff>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn compare<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
hash_a: &'life2 str,
hash_b: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<SchemaDiff>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Compare two snapshots and return their version hashes
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".