pub struct BatchSegmentWriter { /* private fields */ }Expand description
High-performance batch segment writer
Implementations§
Source§impl BatchSegmentWriter
impl BatchSegmentWriter
Sourcepub fn new(config: BatchConfig) -> Self
pub fn new(config: BatchConfig) -> Self
Create a new batch writer
Sourcepub fn add(
&mut self,
key: VectorKey,
vector: &[f32],
) -> Result<u32, BatchWriteError>
pub fn add( &mut self, key: VectorKey, vector: &[f32], ) -> Result<u32, BatchWriteError>
Add a single vector
Sourcepub fn add_batch(
&mut self,
keys: &[VectorKey],
vectors: &[Vec<f32>],
) -> Result<Vec<u32>, BatchWriteError>
pub fn add_batch( &mut self, keys: &[VectorKey], vectors: &[Vec<f32>], ) -> Result<Vec<u32>, BatchWriteError>
Add a batch of vectors with keys
Sourcepub fn add_batch_contiguous(
&mut self,
flat_data: &[f32],
keys: &[VectorKey],
) -> Result<Vec<u32>, BatchWriteError>
pub fn add_batch_contiguous( &mut self, flat_data: &[f32], keys: &[VectorKey], ) -> Result<Vec<u32>, BatchWriteError>
Add batch from contiguous flat data (optimized path)
flat_data is [v0_0, v0_1, …, v0_d, v1_0, …]
Sourcepub fn stats(&self) -> &BatchWriteStats
pub fn stats(&self) -> &BatchWriteStats
Get statistics
Sourcepub fn get_by_index(&self, index: u32) -> Option<&[f32]>
pub fn get_by_index(&self, index: u32) -> Option<&[f32]>
Get vector by index
Sourcepub fn build(self) -> Result<BuiltSegment, BatchWriteError>
pub fn build(self) -> Result<BuiltSegment, BatchWriteError>
Build and finalize
Auto Trait Implementations§
impl Freeze for BatchSegmentWriter
impl RefUnwindSafe for BatchSegmentWriter
impl Send for BatchSegmentWriter
impl Sync for BatchSegmentWriter
impl Unpin for BatchSegmentWriter
impl UnsafeUnpin for BatchSegmentWriter
impl UnwindSafe for BatchSegmentWriter
Blanket Implementations§
impl<T> Allocation for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more