pub struct CollectionManager {
pub config: VectorConfig,
pub store: Arc<VectorStore>,
pub indexes: Arc<RwLock<HashMap<String, IndexSelector>>>,
pub mmap_files: Arc<RwLock<HashMap<String, MmapVectorFile>>>,
}Expand description
Coordinates collection metadata, vector files, and in-memory indexes.
Fields§
§config: VectorConfigRuntime configuration shared by all collections.
store: Arc<VectorStore>Persistent metadata store.
indexes: Arc<RwLock<HashMap<String, IndexSelector>>>In-memory index implementations keyed by collection name.
mmap_files: Arc<RwLock<HashMap<String, MmapVectorFile>>>Memory-mapped vector files keyed by collection name.
Implementations§
Source§impl CollectionManager
impl CollectionManager
Sourcepub async fn new(
config: VectorConfig,
store: Arc<VectorStore>,
) -> VectorResult<Self>
pub async fn new( config: VectorConfig, store: Arc<VectorStore>, ) -> VectorResult<Self>
Build a manager and restore all persisted collections.
Sourcepub async fn create_collection(
&self,
workspace_id: &str,
name: &str,
dimensions: usize,
distance: DistanceMetric,
) -> VectorResult<Collection>
pub async fn create_collection( &self, workspace_id: &str, name: &str, dimensions: usize, distance: DistanceMetric, ) -> VectorResult<Collection>
Create a new collection and initialize its index and vector file.
Sourcepub async fn get_collection(
&self,
workspace_id: &str,
name: &str,
) -> VectorResult<Collection>
pub async fn get_collection( &self, workspace_id: &str, name: &str, ) -> VectorResult<Collection>
Fetch a collection definition by name.
Sourcepub async fn delete_collection(
&self,
workspace_id: &str,
name: &str,
) -> VectorResult<()>
pub async fn delete_collection( &self, workspace_id: &str, name: &str, ) -> VectorResult<()>
Delete a collection and all of its persisted state.
Sourcepub async fn list_collections(
&self,
workspace_id: &str,
) -> VectorResult<Vec<Collection>>
pub async fn list_collections( &self, workspace_id: &str, ) -> VectorResult<Vec<Collection>>
List all persisted collections.
Sourcepub async fn insert_vector(
&self,
workspace_id: &str,
record: VectorRecord,
) -> VectorResult<Uuid>
pub async fn insert_vector( &self, workspace_id: &str, record: VectorRecord, ) -> VectorResult<Uuid>
Insert a single vector record into its collection.
Sourcepub async fn insert_batch(
&self,
workspace_id: &str,
records: Vec<VectorRecord>,
) -> VectorResult<Vec<Uuid>>
pub async fn insert_batch( &self, workspace_id: &str, records: Vec<VectorRecord>, ) -> VectorResult<Vec<Uuid>>
Insert multiple vector records atomically.
Sourcepub async fn delete_vector(
&self,
workspace_id: &str,
collection: &str,
id: Uuid,
) -> VectorResult<bool>
pub async fn delete_vector( &self, workspace_id: &str, collection: &str, id: Uuid, ) -> VectorResult<bool>
Delete a vector from a collection by UUID.
Sourcepub async fn get_vector(
&self,
workspace_id: &str,
collection: &str,
id: Uuid,
) -> VectorResult<VectorRecord>
pub async fn get_vector( &self, workspace_id: &str, collection: &str, id: Uuid, ) -> VectorResult<VectorRecord>
Load a full vector record, including its raw vector from the mmap file.
Sourcepub async fn persist_indexes(&self) -> VectorResult<()>
pub async fn persist_indexes(&self) -> VectorResult<()>
Persist all loaded indexes to disk.
Sourcepub async fn read_vector_by_internal_id(
&self,
workspace_id: &str,
collection: &str,
internal_id: usize,
) -> VectorResult<Vec<f32>>
pub async fn read_vector_by_internal_id( &self, workspace_id: &str, collection: &str, internal_id: usize, ) -> VectorResult<Vec<f32>>
Read a raw vector by collection and internal id.
Sourcepub async fn loaded_index_count(&self) -> usize
pub async fn loaded_index_count(&self) -> usize
Return the number of loaded indexes.
Sourcepub async fn loaded_mmap_count(&self) -> usize
pub async fn loaded_mmap_count(&self) -> usize
Return the number of loaded mmap vector files.
Auto Trait Implementations§
impl Freeze for CollectionManager
impl !RefUnwindSafe for CollectionManager
impl Send for CollectionManager
impl Sync for CollectionManager
impl Unpin for CollectionManager
impl UnsafeUnpin for CollectionManager
impl !UnwindSafe for CollectionManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request