pub trait StorageBackend: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn requires_network(&self) -> bool;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn supports_air_gapped(&self) -> bool { ... }
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Base trait for all storage backends
This trait provides metadata about the backend’s capabilities, enabling runtime mode validation (e.g., air-gapped mode rejection of network-requiring backends).
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Human-readable name of this backend (e.g., “sqlite”, “postgres”, “qdrant”)
Sourcefn requires_network(&self) -> bool
fn requires_network(&self) -> bool
Does this backend require network access?
Returns true for backends like Postgres, Redis, remote Qdrant.
Returns false for SQLite, filesystem, embedded Qdrant.
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Health check - verify the backend is operational
Should return Ok(()) if the backend is ready to accept operations.
Should return an error if the backend is unavailable or misconfigured.
Provided Methods§
Sourcefn supports_air_gapped(&self) -> bool
fn supports_air_gapped(&self) -> bool
Can this backend operate in air-gapped mode?
Default implementation returns !requires_network().
Sourcefn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Graceful shutdown
Called when the runtime is shutting down. Implementations should flush any pending writes and close connections.