pub trait SchemaInspector: Send + Sync {
// Required methods
fn inspect_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<SchemaSnapshot>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn schema_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_tenants<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<TenantContext>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Schema inspector trait for read-only schema introspection
This trait abstracts the process of reading schema information
from a database. Implementations are database-specific but produce
database-agnostic SchemaSnapshot objects.
§Design Rationale
Separating inspection from execution allows:
- Audit mode to work without write permissions
- Dry-run mode to calculate diffs without locks
- Testing with mock inspectors
- Different inspection strategies (cached, streaming, etc.)
Required Methods§
Sourcefn inspect_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<SchemaSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn inspect_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<SchemaSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn schema_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn schema_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a tenant schema exists
Sourcefn list_tenants<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<TenantContext>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_tenants<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<TenantContext>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all tenant schemas in the database
This is useful for batch operations across all tenants.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".