Skip to main content

SqliteBackend

Struct SqliteBackend 

Source
pub struct SqliteBackend { /* private fields */ }
Expand description

SQLite-based storage backend

This implements the StorageBackend trait using SQLite as the underlying database. It wraps the existing Storage struct and delegates to the functions in queries.rs.

Implementations§

Source§

impl SqliteBackend

Source

pub fn new(config: StorageConfig) -> Result<Self>

Create a new SQLite backend with the given configuration

Source

pub fn in_memory() -> Result<Self>

Create an in-memory SQLite backend (useful for testing)

Source

pub fn storage(&self) -> &Storage

Get a reference to the underlying Storage

Source

pub fn storage_mut(&mut self) -> &mut Storage

Get a mutable reference to the underlying Storage

Trait Implementations§

Source§

impl CloudSyncBackend for SqliteBackend

Source§

fn push(&self) -> Result<SyncResult>

Push changes to cloud
Source§

fn pull(&self) -> Result<SyncResult>

Pull changes from cloud
Source§

fn sync_delta(&self, since_version: u64) -> Result<SyncDelta>

Get delta changes since version
Source§

fn sync_state(&self) -> Result<SyncState>

Get current sync state
Source§

fn force_sync(&self) -> Result<SyncResult>

Force a full sync (push then pull)
Source§

impl StorageBackend for SqliteBackend

Source§

fn create_memory(&self, input: CreateMemoryInput) -> Result<Memory>

Create a new memory
Source§

fn get_memory(&self, id: MemoryId) -> Result<Option<Memory>>

Get a memory by ID
Source§

fn update_memory( &self, id: MemoryId, input: UpdateMemoryInput, ) -> Result<Memory>

Update a memory
Source§

fn delete_memory(&self, id: MemoryId) -> Result<()>

Delete a memory (soft delete)
Source§

fn create_memories_batch( &self, inputs: Vec<CreateMemoryInput>, ) -> Result<BatchCreateResult>

Create multiple memories in a single transaction
Source§

fn delete_memories_batch(&self, ids: Vec<MemoryId>) -> Result<BatchDeleteResult>

Delete multiple memories in a single transaction
Source§

fn list_memories(&self, options: ListOptions) -> Result<Vec<Memory>>

List memories with filters
Source§

fn count_memories(&self, options: ListOptions) -> Result<i64>

Count memories matching filters
Source§

fn search_memories( &self, query: &str, options: SearchOptions, ) -> Result<Vec<SearchResult>>

Search memories using hybrid search
Source§

fn create_crossref( &self, from_id: MemoryId, to_id: MemoryId, edge_type: EdgeType, score: f32, ) -> Result<CrossReference>

Create a cross-reference between memories
Source§

fn get_crossrefs(&self, memory_id: MemoryId) -> Result<Vec<CrossReference>>

Get cross-references for a memory
Source§

fn delete_crossref(&self, from_id: MemoryId, to_id: MemoryId) -> Result<()>

Delete a cross-reference
Source§

fn list_tags(&self) -> Result<Vec<(String, i64)>>

List all tags with usage counts
Source§

fn get_memories_by_tag( &self, tag: &str, limit: Option<usize>, ) -> Result<Vec<Memory>>

Get memories with a specific tag
Source§

fn list_workspaces(&self) -> Result<Vec<(String, i64)>>

List all workspaces with memory counts
Source§

fn get_workspace_stats(&self, workspace: &str) -> Result<HashMap<String, i64>>

Get detailed statistics for a workspace
Source§

fn move_to_workspace( &self, ids: Vec<MemoryId>, workspace: &str, ) -> Result<usize>

Move memories to a different workspace
Source§

fn get_stats(&self) -> Result<StorageStats>

Get storage statistics
Source§

fn health_check(&self) -> Result<HealthStatus>

Check storage health
Source§

fn optimize(&self) -> Result<()>

Run optimization (e.g., VACUUM)
Source§

fn backend_name(&self) -> &'static str

Get backend name identifier
Source§

fn schema_version(&self) -> Result<i32>

Get current schema version
Source§

impl TransactionalBackend for SqliteBackend

Source§

fn with_transaction<F, T>(&self, f: F) -> Result<T>
where F: FnOnce(&dyn StorageBackend) -> Result<T>,

Execute a closure within a transaction
Source§

fn savepoint(&self, name: &str) -> Result<()>

create a savepoint
Source§

fn release_savepoint(&self, name: &str) -> Result<()>

release a savepoint
Source§

fn rollback_to_savepoint(&self, name: &str) -> Result<()>

rollback to a savepoint

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more