pub struct CompressedEmbeddingStore {
pub dimension: usize,
pub bits: u8,
pub quant_type: QuantType,
pub rotation_seed: u64,
pub qjl_seed: Option<u64>,
pub entries: Vec<CompressedEntry>,
}Expand description
Compressed embedding store using TurboQuant.
Fields§
§dimension: usize§bits: u8§quant_type: QuantType§rotation_seed: u64§qjl_seed: Option<u64>§entries: Vec<CompressedEntry>Implementations§
Source§impl CompressedEmbeddingStore
impl CompressedEmbeddingStore
Sourcepub fn new(
dimension: usize,
bits: u8,
quant_type: QuantType,
rotation_seed: u64,
qjl_seed: Option<u64>,
) -> Self
pub fn new( dimension: usize, bits: u8, quant_type: QuantType, rotation_seed: u64, qjl_seed: Option<u64>, ) -> Self
Create a new empty store.
Sourcepub fn load(path: &Path) -> Result<Self, QuantError>
pub fn load(path: &Path) -> Result<Self, QuantError>
Load from a binary file.
Sourcepub fn get(&self, file: &str) -> Option<&CompressedEntry>
pub fn get(&self, file: &str) -> Option<&CompressedEntry>
Find an entry by filename.
Sourcepub fn upsert(&mut self, entry: CompressedEntry)
pub fn upsert(&mut self, entry: CompressedEntry)
Insert or update an entry.
Sourcepub fn uncompressed_size(&self) -> usize
pub fn uncompressed_size(&self) -> usize
Equivalent uncompressed size (f32 embeddings) for comparison.
Sourcepub fn compression_ratio(&self) -> f32
pub fn compression_ratio(&self) -> f32
Compression ratio (uncompressed / compressed).
Trait Implementations§
Source§impl Clone for CompressedEmbeddingStore
impl Clone for CompressedEmbeddingStore
Source§fn clone(&self) -> CompressedEmbeddingStore
fn clone(&self) -> CompressedEmbeddingStore
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 moreAuto Trait Implementations§
impl Freeze for CompressedEmbeddingStore
impl RefUnwindSafe for CompressedEmbeddingStore
impl Send for CompressedEmbeddingStore
impl Sync for CompressedEmbeddingStore
impl Unpin for CompressedEmbeddingStore
impl UnsafeUnpin for CompressedEmbeddingStore
impl UnwindSafe for CompressedEmbeddingStore
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