pub struct ProfileStore { /* private fields */ }Expand description
Implementations§
Source§impl ProfileStore
impl ProfileStore
Sourcepub fn new(storage_path: PathBuf, hnsw_config: HnswServiceConfig) -> Self
pub fn new(storage_path: PathBuf, hnsw_config: HnswServiceConfig) -> Self
Create a new profile store rooted at storage_path.
Does not scan the directory; call [load_existing] for that.
Sourcepub fn set_chain_manager(&mut self, cm: Arc<ChainManager>)
pub fn set_chain_manager(&mut self, cm: Arc<ChainManager>)
Set the chain manager for exochain event logging.
Sourcepub fn set_governance_engine(&mut self, engine: Arc<GovernanceEngine>)
pub fn set_governance_engine(&mut self, engine: Arc<GovernanceEngine>)
Set the governance engine for gating destructive operations.
Sourcepub fn load_existing(&self) -> ProfileResult<usize>
pub fn load_existing(&self) -> ProfileResult<usize>
Scan storage_path and load existing profiles from disk.
If no profiles exist, creates a “default” profile automatically.
Sourcepub fn create_profile(&self, id: &str, name: &str) -> ProfileResult<ProfileMeta>
pub fn create_profile(&self, id: &str, name: &str) -> ProfileResult<ProfileMeta>
Create a new profile with the given ID and display name.
Sourcepub fn delete_profile(&self, id: &str) -> ProfileResult<()>
pub fn delete_profile(&self, id: &str) -> ProfileResult<()>
Delete a profile by ID. Cannot delete the currently active profile.
Sourcepub fn list_profiles(&self) -> Vec<ProfileMeta>
pub fn list_profiles(&self) -> Vec<ProfileMeta>
List all profiles (metadata only).
Sourcepub fn switch_profile(&self, id: &str) -> ProfileResult<()>
pub fn switch_profile(&self, id: &str) -> ProfileResult<()>
Switch the active profile. Subsequent vector operations target the new profile.
Sourcepub fn active_profile_id(&self) -> String
pub fn active_profile_id(&self) -> String
Get the currently active profile ID.
Sourcepub fn get_profile_backend(
&self,
id: &str,
) -> Option<Ref<'_, String, ProfileEntry>>
pub fn get_profile_backend( &self, id: &str, ) -> Option<Ref<'_, String, ProfileEntry>>
Get a reference to a specific profile’s vector backend.
Returns None if the profile does not exist.
Sourcepub fn active_backend(&self) -> Option<Ref<'_, String, ProfileEntry>>
pub fn active_backend(&self) -> Option<Ref<'_, String, ProfileEntry>>
Get a reference to the active profile’s vector backend.
Sourcepub fn insert(
&self,
id: u64,
key: &str,
vector: &[f32],
metadata: Value,
) -> VectorResult<()>
pub fn insert( &self, id: u64, key: &str, vector: &[f32], metadata: Value, ) -> VectorResult<()>
Insert a vector into the active profile’s backend.
Sourcepub fn search(&self, query: &[f32], k: usize) -> Vec<SearchResult>
pub fn search(&self, query: &[f32], k: usize) -> Vec<SearchResult>
Search the active profile’s backend.
Sourcepub fn persist_meta(&self, id: &str) -> ProfileResult<()>
pub fn persist_meta(&self, id: &str) -> ProfileResult<()>
Persist the metadata for a given profile to disk.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ProfileStore
impl !RefUnwindSafe for ProfileStore
impl !UnwindSafe for ProfileStore
impl Send for ProfileStore
impl Sync for ProfileStore
impl Unpin for ProfileStore
impl UnsafeUnpin for ProfileStore
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> 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