pub struct BackendFactory;Expand description
Factory for creating storage backends.
Centralizes backend initialization with consistent error handling.
§Example
ⓘ
use subcog::services::{BackendFactory, PathManager};
let paths = PathManager::for_repo("/path/to/repo");
let backends = BackendFactory::create_all(&paths);
if backends.is_complete() {
println!("All backends initialized successfully");
}Implementations§
Source§impl BackendFactory
impl BackendFactory
Sourcepub fn create_all(index_path: &Path, vector_path: &Path) -> BackendSet
pub fn create_all(index_path: &Path, vector_path: &Path) -> BackendSet
Creates all backends using the provided path configuration.
Returns a BackendSet with successfully initialized backends.
Failed backends are logged and set to None.
§Arguments
index_path- Path forSQLiteindex databasevector_path- Path for vector index files
§Returns
A BackendSet containing available backends.
Sourcepub fn create_embedder() -> Option<Arc<dyn Embedder>>
pub fn create_embedder() -> Option<Arc<dyn Embedder>>
Creates the embedder backend.
Currently always returns FastEmbedEmbedder. In the future,
this could be configured to use different embedding models.
Sourcepub fn create_index_backend(
path: &Path,
) -> Option<Arc<dyn IndexBackend + Send + Sync>>
pub fn create_index_backend( path: &Path, ) -> Option<Arc<dyn IndexBackend + Send + Sync>>
Sourcepub fn create_vector_backend(
path: &Path,
) -> Option<Arc<dyn VectorBackend + Send + Sync>>
pub fn create_vector_backend( path: &Path, ) -> Option<Arc<dyn VectorBackend + Send + Sync>>
Sourcepub fn create_with_dimensions(
index_path: &Path,
vector_path: &Path,
dimensions: usize,
) -> BackendSet
pub fn create_with_dimensions( index_path: &Path, vector_path: &Path, dimensions: usize, ) -> BackendSet
Creates backends with custom embedder dimensions.
Useful for testing or when using non-default embedding models.
§Arguments
index_path- Path forSQLiteindex databasevector_path- Path for vector index filesdimensions- Vector embedding dimensions
Auto Trait Implementations§
impl Freeze for BackendFactory
impl RefUnwindSafe for BackendFactory
impl Send for BackendFactory
impl Sync for BackendFactory
impl Unpin for BackendFactory
impl UnwindSafe for BackendFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].