pub struct VectorDirectory { /* private fields */ }Expand description
A node’s stores for the projects it owns, each an HNSW index created on
first use. Without with_persistence the
indexes are memory-only and a restart empties them; with it, each store
keeps a capped, append-only log under the given directory (one file per
project) and is rebuilt from it on first use after a restart. The index
map is shared between views, so two views with different
allow-lists (local cogs, remote forwarders) reach the same store for a
project they both allow.
Implementations§
Source§impl VectorDirectory
impl VectorDirectory
Sourcepub fn new(projects: impl IntoIterator<Item = String>, fallback: bool) -> Self
pub fn new(projects: impl IntoIterator<Item = String>, fallback: bool) -> Self
Directory owning projects, and the controller fallback if fallback.
Sourcepub fn with_persistence(self, dir: PathBuf) -> Self
pub fn with_persistence(self, dir: PathBuf) -> Self
Keep each store’s vectors in <dir>/<project id>.vec (the controller
fallback in <dir>/_controller.vec), each capped at
DEFAULT_MAX_LOG_BYTES.
Call before taking views.
Sourcepub fn with_persistence_capped(self, dir: PathBuf, max_log_bytes: u64) -> Self
pub fn with_persistence_capped(self, dir: PathBuf, max_log_bytes: u64) -> Self
with_persistence with an explicit cap per file.
Sourcepub fn view(
&self,
projects: impl IntoIterator<Item = String>,
fallback: bool,
) -> Self
pub fn view( &self, projects: impl IntoIterator<Item = String>, fallback: bool, ) -> Self
A view over the same stores allowing only projects (and the
fallback if fallback).
Trait Implementations§
Source§impl Clone for VectorDirectory
impl Clone for VectorDirectory
Source§impl StoreDirectory for VectorDirectory
impl StoreDirectory for VectorDirectory
Auto Trait Implementations§
impl Freeze for VectorDirectory
impl RefUnwindSafe for VectorDirectory
impl Send for VectorDirectory
impl Sync for VectorDirectory
impl Unpin for VectorDirectory
impl UnsafeUnpin for VectorDirectory
impl UnwindSafe for VectorDirectory
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
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> ⓘ
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> ⓘ
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