pub struct VectorSegment {
pub id: u64,
pub state: SegmentState,
pub dimension: usize,
pub metric: DistanceMetric,
pub created_at: u64,
pub updated_at: u64,
/* private fields */
}Expand description
A vector segment containing vectors, metadata, and optional index
Fields§
§id: u64Segment ID
state: SegmentStateCurrent state
dimension: usizeVector dimension
metric: DistanceMetricDistance metric
created_at: u64Creation timestamp
updated_at: u64Last modified timestamp
Implementations§
Source§impl VectorSegment
impl VectorSegment
Sourcepub fn new(id: u64, dimension: usize, metric: DistanceMetric) -> VectorSegment
pub fn new(id: u64, dimension: usize, metric: DistanceMetric) -> VectorSegment
Create a new growing segment
Sourcepub fn insert(
&mut self,
id: u64,
vector: Vec<f32>,
metadata: MetadataEntry,
) -> Result<(), VectorStoreError>
pub fn insert( &mut self, id: u64, vector: Vec<f32>, metadata: MetadataEntry, ) -> Result<(), VectorStoreError>
Insert a vector with metadata
Sourcepub fn get_metadata(&self, id: u64) -> Option<&MetadataEntry>
pub fn get_metadata(&self, id: u64) -> Option<&MetadataEntry>
Get metadata for a vector
Sourcepub fn delete(&mut self, id: u64) -> Result<bool, VectorStoreError>
pub fn delete(&mut self, id: u64) -> Result<bool, VectorStoreError>
Delete a vector (only in growing state)
Sourcepub fn search(
&self,
query: &[f32],
k: usize,
filter: Option<&MetadataFilter>,
) -> Vec<SearchResult>
pub fn search( &self, query: &[f32], k: usize, filter: Option<&MetadataFilter>, ) -> Vec<SearchResult>
Search for k nearest neighbors
Sourcepub fn seal(&mut self, config: &HnswConfig)
pub fn seal(&mut self, config: &HnswConfig)
Seal the segment (build HNSW index)
Trait Implementations§
Source§impl HasBloom for VectorSegment
impl HasBloom for VectorSegment
Source§fn bloom_segment(&self) -> Option<&BloomSegment>
fn bloom_segment(&self) -> Option<&BloomSegment>
Reference to the bloom filter attached to this segment, if any.
Source§fn definitely_absent(&self, key: &[u8]) -> bool
fn definitely_absent(&self, key: &[u8]) -> bool
Fast-path negative check. Returns
true iff the bloom is present and
reports the key as absent.Auto Trait Implementations§
impl !Freeze for VectorSegment
impl RefUnwindSafe for VectorSegment
impl Send for VectorSegment
impl Sync for VectorSegment
impl Unpin for VectorSegment
impl UnsafeUnpin for VectorSegment
impl UnwindSafe for VectorSegment
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> 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>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request