Skip to main content

Sqlite

Struct Sqlite 

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

Implementations§

Source§

impl Sqlite

Source

pub fn new(path: PathBuf, embedder: Option<Arc<dyn Embedder>>) -> Sqlite

The provider over the database at path (a file, made on first use). With embedder, memories also get vectors and recall also looks for memories near the query in meaning.

Source

pub fn importing(self, files: Arc<Files>) -> Sqlite

Copy in what files holds, once for each scope owner a call reaches (see the module documentation). The files are only read.

Source

pub fn path(&self) -> &Path

Source

pub fn add_row(&self, row: &CollectorRow) -> Result<(), Error>

Keep a collector’s row, with its pane, session, and project.

Source

pub fn rows( &self, collector: &str, since_unix_ms: u64, limit: usize, ) -> Result<Vec<CollectorRow>, Error>

A collector’s rows at or after since_unix_ms, oldest first, at most limit.

Source

pub fn set_summary(&self, session: &str, text: &str) -> Result<Summary, Error>

Keep text as the summary of session, replacing the one there.

Source

pub fn summary(&self, session: &str) -> Result<Option<Summary>, Error>

Source

pub fn relations_at( &self, cx: &Context, id: &str, at_unix_ms: u64, ) -> Result<Vec<(String, String)>, Error>

The relations of a memory as they were at at_unix_ms: (relation, target), from the valid times of its edges, current ones included.

Trait Implementations§

Source§

impl Debug for Sqlite

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Provider for Sqlite

Source§

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

The settings name: files, sqlite, or kosmonaut.
Source§

fn remember(&self, cx: &Context, new: New) -> Result<Memory, Error>

Source§

fn list( &self, cx: &Context, scope: Option<Scope>, kind: Option<Kind>, ) -> Result<Found, Error>

Newest first.
Source§

fn get(&self, cx: &Context, id: &str) -> Result<Memory, Error>

Source§

fn update( &self, cx: &Context, id: &str, change: Change, ) -> Result<Memory, Error>

Source§

fn forget(&self, cx: &Context, id: &str) -> Result<Memory, Error>

Remove a memory; returns what was removed.
Source§

fn put(&self, cx: &Context, m: &Memory) -> Result<Memory, Error>

Keep m as it is, under its id and with its times, replacing a memory with the same id: how memories move between providers (transfer). m.path and m.score are ignored.
Source§

fn recall( &self, cx: &Context, query: &str, scope: Option<Scope>, limit: Option<usize>, ) -> Result<Found, Error>

Memories matching query, best first; at most limit (DEFAULT_LIMIT when None, never more than MAX_LIMIT).

Auto Trait Implementations§

§

impl !Freeze for Sqlite

§

impl !RefUnwindSafe for Sqlite

§

impl !UnwindSafe for Sqlite

§

impl Forget for Sqlite

§

impl Move for Sqlite

§

impl Send for Sqlite
where RawVecInner: Send, Arc<dyn Embedder>: Send, Mutex<Option<Connection>>: Send, Arc<Files>: Send, Mutex<Vec<Problem>>: Send,

§

impl Sync for Sqlite
where RawVecInner: Sync, Arc<dyn Embedder>: Sync, Mutex<Option<Connection>>: Sync, Arc<Files>: Sync, Mutex<Vec<Problem>>: Sync,

§

impl Unpin for Sqlite
where *const u8 is !null: Unpin, Arc<dyn Embedder>: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin, *mut sqlite3: Unpin, Arc<Mutex<*mut sqlite3>>: Unpin, *const Node<Arc<str>, RawStatement> is !null: Unpin, Arc<Files>: Unpin,

§

impl UnsafeUnpin for Sqlite
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const ArcInner<dyn Embedder> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Embedder>>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *mut sqlite3: UnsafeUnpin, *const ArcInner<Mutex<*mut sqlite3>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<*mut sqlite3>>>: UnsafeUnpin, PhantomData<NonNull<Node<Arc<str>, RawStatement>>>: UnsafeUnpin, *const Node<Arc<str>, RawStatement> is !null: UnsafeUnpin, *const ArcInner<Files> is !null: UnsafeUnpin, PhantomData<ArcInner<Files>>: UnsafeUnpin, PhantomData<Problem>: UnsafeUnpin,

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.