pub struct IndexMetadata {
pub version: u32,
pub segments: Vec<String>,
pub vector_fields: HashMap<u32, FieldVectorMeta>,
pub total_vectors: usize,
}Expand description
Unified index metadata - replaces segments.json
Fields§
§version: u32Version for compatibility
segments: Vec<String>List of committed segment IDs (hex strings)
vector_fields: HashMap<u32, FieldVectorMeta>Per-field vector index metadata
total_vectors: usizeTotal vectors across all segments (updated on commit)
Implementations§
Source§impl IndexMetadata
impl IndexMetadata
Sourcepub fn from_segments(segments: Vec<String>) -> Self
pub fn from_segments(segments: Vec<String>) -> Self
Create from existing segments list (migration from old format)
Sourcepub fn is_field_built(&self, field_id: u32) -> bool
pub fn is_field_built(&self, field_id: u32) -> bool
Check if a field has been built
Sourcepub fn get_field_meta(&self, field_id: u32) -> Option<&FieldVectorMeta>
pub fn get_field_meta(&self, field_id: u32) -> Option<&FieldVectorMeta>
Get field metadata
Sourcepub fn init_field(&mut self, field_id: u32, index_type: VectorIndexType)
pub fn init_field(&mut self, field_id: u32, index_type: VectorIndexType)
Initialize field metadata (called when field is first seen)
Sourcepub fn mark_field_built(
&mut self,
field_id: u32,
vector_count: usize,
num_clusters: usize,
centroids_file: String,
codebook_file: Option<String>,
)
pub fn mark_field_built( &mut self, field_id: u32, vector_count: usize, num_clusters: usize, centroids_file: String, codebook_file: Option<String>, )
Mark field as built with trained structures
Sourcepub fn should_build_field(&self, field_id: u32, threshold: usize) -> bool
pub fn should_build_field(&self, field_id: u32, threshold: usize) -> bool
Check if field should be built based on threshold
Sourcepub fn add_segment(&mut self, segment_id: String)
pub fn add_segment(&mut self, segment_id: String)
Add a segment
Sourcepub fn remove_segments(&mut self, to_remove: &[String])
pub fn remove_segments(&mut self, to_remove: &[String])
Remove segments
Sourcepub async fn load<D: Directory>(dir: &D) -> Result<Self>
pub async fn load<D: Directory>(dir: &D) -> Result<Self>
Load from directory (with migration from old segments.json)
Sourcepub async fn load_trained_structures<D: Directory>(
&self,
dir: &D,
) -> (FxHashMap<u32, Arc<CoarseCentroids>>, FxHashMap<u32, Arc<PQCodebook>>)
pub async fn load_trained_structures<D: Directory>( &self, dir: &D, ) -> (FxHashMap<u32, Arc<CoarseCentroids>>, FxHashMap<u32, Arc<PQCodebook>>)
Load trained centroids and codebooks from index-level files
Returns (centroids_map, codebooks_map) for fields that are Built
Trait Implementations§
Source§impl Clone for IndexMetadata
impl Clone for IndexMetadata
Source§fn clone(&self) -> IndexMetadata
fn clone(&self) -> IndexMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IndexMetadata
impl Debug for IndexMetadata
Source§impl Default for IndexMetadata
impl Default for IndexMetadata
Source§impl<'de> Deserialize<'de> for IndexMetadata
impl<'de> Deserialize<'de> for IndexMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for IndexMetadata
impl RefUnwindSafe for IndexMetadata
impl Send for IndexMetadata
impl Sync for IndexMetadata
impl Unpin for IndexMetadata
impl UnwindSafe for IndexMetadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.