Skip to main content

SqliteStorage

Struct SqliteStorage 

Source
pub struct SqliteStorage { /* private fields */ }

Implementations§

Source§

impl SqliteStorage

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Source

pub fn open_in_memory() -> Result<Self>

Source

pub fn open_workspace(workspace: impl AsRef<Path>) -> Result<Self>

Open the default SQLite database inside a workspace directory. Keeps the concrete filename (semq.db) encapsulated in the storage crate so callers don’t assume SQLite implementation details.

Trait Implementations§

Source§

impl Storage for SqliteStorage

Source§

fn init(&self, vector_dimension: usize) -> Result<()>

Initialize all storage tables. Pass 0 to skip creating the vector table when no embedder is available yet.
Source§

fn get_document(&self, doc_id: &str) -> Result<Option<Document>>

Source§

fn list_documents(&self) -> Result<Vec<Document>>

Source§

fn get_document_paths( &self, doc_ids: &[String], ) -> Result<HashMap<String, String>>

Source§

fn get_existing_chunk_ids(&self, chunk_ids: &[String]) -> Result<Vec<String>>

Which of the given chunk ids are already stored. Used by the indexer to skip re-embedding shared chunks (identical text hashed to the same id).
Source§

fn get_chunks(&self, chunk_ids: &[String]) -> Result<Vec<Chunk>>

Source§

fn search_vectors( &self, embedding: &[f32], top_k: usize, ) -> Result<Vec<(String, f32)>>

Source§

fn search_text(&self, query: &str, top_k: usize) -> Result<Vec<(String, f32)>>

Source§

fn get_model_version(&self, role: ModelRole) -> Result<Option<ModelSpec>>

Source§

fn list_collections(&self) -> Result<Vec<Collection>>

Source§

fn count_chunks(&self) -> Result<usize>

Source§

fn set_model_version_atomic( &self, role: ModelRole, version: &ModelSpec, ) -> Result<()>

Source§

fn get_meta(&self, key: &str) -> Result<Option<String>>

Source§

fn set_meta_atomic(&self, key: &str, value: &str) -> Result<()>

Source§

fn begin_tx(&self) -> Result<Box<dyn StorageTx + '_>>

Begin a write transaction covering documents / chunks / vec_chunks / fts_chunks / model_versions. Operations on the returned StorageTx are atomic: they either all commit via StorageTx::commit or all roll back when the transaction is dropped without committing.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.