pub struct DiskStorage { /* private fields */ }Expand description
Standard disk storage with buffered I/O
Implementations§
Source§impl DiskStorage
impl DiskStorage
Sourcepub fn new<P: AsRef<Path>>(
base_path: P,
dimension: usize,
) -> DiskAnnResult<Self>
pub fn new<P: AsRef<Path>>( base_path: P, dimension: usize, ) -> DiskAnnResult<Self>
Create new disk storage at given path
Sourcepub fn with_cache_limit(self, limit: usize) -> Self
pub fn with_cache_limit(self, limit: usize) -> Self
Set cache limit (number of vectors to keep in memory)
Sourcepub fn vector_file_path(&self) -> &Option<PathBuf>
pub fn vector_file_path(&self) -> &Option<PathBuf>
Get vector file path
Sourcepub fn graph_file_path(&self) -> &Option<PathBuf>
pub fn graph_file_path(&self) -> &Option<PathBuf>
Get graph file path
Trait Implementations§
Source§impl Clone for DiskStorage
impl Clone for DiskStorage
Source§impl Debug for DiskStorage
impl Debug for DiskStorage
Source§impl StorageBackend for DiskStorage
impl StorageBackend for DiskStorage
Source§fn write_vector(
&mut self,
vector_id: &VectorId,
vector: &[f32],
) -> DiskAnnResult<()>
fn write_vector( &mut self, vector_id: &VectorId, vector: &[f32], ) -> DiskAnnResult<()>
Write a vector to storage
Source§fn read_vector(&self, vector_id: &VectorId) -> DiskAnnResult<Vec<f32>>
fn read_vector(&self, vector_id: &VectorId) -> DiskAnnResult<Vec<f32>>
Read a vector from storage
Source§fn write_graph(&mut self, graph: &VamanaGraph) -> DiskAnnResult<()>
fn write_graph(&mut self, graph: &VamanaGraph) -> DiskAnnResult<()>
Write graph structure
Source§fn read_graph(&self) -> DiskAnnResult<VamanaGraph>
fn read_graph(&self) -> DiskAnnResult<VamanaGraph>
Read graph structure
Source§fn write_metadata(&mut self, metadata: &StorageMetadata) -> DiskAnnResult<()>
fn write_metadata(&mut self, metadata: &StorageMetadata) -> DiskAnnResult<()>
Write metadata
Source§fn read_metadata(&self) -> DiskAnnResult<StorageMetadata>
fn read_metadata(&self) -> DiskAnnResult<StorageMetadata>
Read metadata
Source§fn clear(&mut self) -> DiskAnnResult<()>
fn clear(&mut self) -> DiskAnnResult<()>
Delete all data
Source§fn flush(&mut self) -> DiskAnnResult<()>
fn flush(&mut self) -> DiskAnnResult<()>
Flush any pending writes
Source§fn size(&self) -> DiskAnnResult<u64>
fn size(&self) -> DiskAnnResult<u64>
Get storage size in bytes
Auto Trait Implementations§
impl Freeze for DiskStorage
impl RefUnwindSafe for DiskStorage
impl Send for DiskStorage
impl Sync for DiskStorage
impl Unpin for DiskStorage
impl UnwindSafe for DiskStorage
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> 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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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.