Skip to main content

Store

Struct Store 

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

SQLite-backed durable state for vibesurfer.

Implementations§

Source§

impl Store

Source

pub fn record_action(&mut self, ins: &ActionInsert) -> Result<i64>

Insert one row into actions. Returns the autoincrement id.

Source

pub fn lookup_idempotent( &self, page_id: &str, before_token: &str, args_hash: &str, now_secs: i64, ttl_secs: i64, ) -> Result<Option<Action>>

Look up the most recent successful action whose (page_id, before_token, args_hash) triple matches and whose started_at is within ttl_secs of now_secs. The caller supplies now_secs for testability; production calls super::epoch_secs.

Source

pub fn list_actions(&self, filter: &ActionFilter) -> Result<Vec<Action>>

Source§

impl Store

Source

pub fn add_annotation( &mut self, id: &str, target: &AnnotationTarget, key: &str, value: Option<&str>, ) -> Result<Annotation>

Source

pub fn list_annotations( &self, target: &AnnotationTarget, ) -> Result<Vec<Annotation>>

Source§

impl Store

Source

pub fn save_auth( &mut self, name: &str, key: &MasterKey, plaintext: &[u8], ) -> Result<()>

Encrypt plaintext under key and store under name. Replaces any existing blob with the same name.

Source

pub fn load_auth(&mut self, name: &str, key: &MasterKey) -> Result<Vec<u8>>

Decrypt the named blob. Stamps last_used_at on success.

Source

pub fn list_auth(&self) -> Result<Vec<AuthBlobMeta>>

Source

pub fn delete_auth(&mut self, name: &str) -> Result<()>

Source§

impl Store

Source

pub fn create_mark( &mut self, id: &str, session_id: &str, page_id: &str, name: &str, dom_path: &str, role: Option<&str>, content_excerpt: Option<&str>, ) -> Result<Mark>

Source

pub fn get_mark(&self, session_id: &str, name: &str) -> Result<Option<Mark>>

Source

pub fn list_marks(&self, session_id: &str) -> Result<Vec<Mark>>

Source

pub fn delete_mark(&mut self, session_id: &str, name: &str) -> Result<()>

Source§

impl Store

Source

pub fn create_page( &mut self, id: &str, session_id: &str, url: &str, ) -> Result<Page>

Source

pub fn close_page(&mut self, id: &str) -> Result<()>

Source

pub fn update_page_token( &mut self, id: &str, token: &str, dom_hash: &str, title: Option<&str>, ) -> Result<()>

Source

pub fn get_page(&self, id: &str) -> Result<Option<Page>>

Source

pub fn list_pages(&self, session_id: &str) -> Result<Vec<Page>>

Source§

impl Store

Source

pub fn record_ref(&mut self, sr: &StoredRef) -> Result<()>

Source

pub fn retire_ref( &mut self, session_id: &str, page_id: &str, r: u32, ) -> Result<()>

Source

pub fn list_refs( &self, session_id: &str, page_id: &str, ) -> Result<Vec<StoredRef>>

Source§

impl Store

Source

pub fn create_session( &mut self, id: &str, policy_id: Option<&str>, ) -> Result<Session>

Insert a new session row and return it.

Source

pub fn close_session(&mut self, id: &str) -> Result<Session>

Mark a session closed (and stamp closed_at). Returns the row.

Source

pub fn get_session(&self, id: &str) -> Result<Option<Session>>

Source

pub fn list_sessions(&self) -> Result<Vec<Session>>

Source§

impl Store

Source

pub fn upsert_skill(&mut self, entry: &SkillEntry) -> Result<()>

Source

pub fn get_skill(&self, name: &str) -> Result<Option<SkillEntry>>

Source

pub fn list_skills(&self) -> Result<Vec<SkillEntry>>

Source§

impl Store

Source

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

Open the store at path, applying any not-yet-applied migrations and configuring WAL mode and foreign keys.

Source

pub fn open_in_memory() -> Result<Self>

Open an in-memory store (tests only — dropped when the handle goes out of scope).

Source

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

Open path read-only, without running migrations. Use for vs_log queries that should never block on a write lock.

Source

pub fn conn(&self) -> &Connection

Borrow the underlying connection. Per-table submodules use this instead of self.conn to keep the field private.

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl Send for Store

§

impl !Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl !UnwindSafe for Store

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 = 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.