Skip to main content

Store

Struct Store 

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

SQLite-backed store for checkpoint blobs and the canonical session head.

The struct name and every public method match lash_sqlite_store::Store exactly so consumers swap backends with a path rename. Internally it holds a single cloneable [SqliteConnection] (a tokio-rusqlite handle to one database thread) rather than the prior store’s tokio::sync::Mutex<rusqlite::Connection>.

Implementations§

Source§

impl Store

Source

pub async fn put_blob(&self, content: &[u8]) -> BlobRef

Source

pub async fn put_artifact_blob( &self, descriptor: BlobArtifactDescriptor, content: &[u8], ) -> BlobRef

Source

pub async fn get_blob(&self, blob_ref: &BlobRef) -> Option<Vec<u8>>

Source

pub async fn put_typed_blob<T: Serialize>(&self, value: &T) -> BlobRef

Source

pub async fn put_typed_artifact_blob<T: Serialize>( &self, descriptor: BlobArtifactDescriptor, value: &T, ) -> BlobRef

Source

pub async fn get_typed_blob<T: DeserializeOwned>( &self, blob_ref: &BlobRef, ) -> Option<T>

Source

pub async fn put_checkpoint( &self, checkpoint: &HydratedSessionCheckpoint, ) -> StoredSessionCheckpoint

Source

pub async fn get_checkpoint( &self, blob_ref: &BlobRef, ) -> Option<HydratedSessionCheckpoint>

Source

pub async fn append_usage_deltas(&self, entries: &[TokenLedgerEntry])

Source

pub async fn load_usage_deltas(&self) -> Vec<TokenLedgerEntry>

Source§

impl Store

Source

pub async fn replace_session_graph(&self, graph: &SessionGraph)

Source

pub async fn append_session_graph_nodes(&self, nodes: &[SessionNodeRecord])

Source

pub async fn load_session_graph(&self) -> SessionGraph

Source

pub async fn gc_unreachable(&self) -> GcReport

Source§

impl Store

Source

pub async fn open(path: &Path) -> Result<Self>

Source

pub async fn open_with_options( path: &Path, options: StoreOptions, ) -> Result<Self>

Source

pub async fn open_readonly(path: &Path) -> Result<Self>

Open the local database read-only. Used by export/resume call sites that must never mutate the source.

Source

pub async fn load_picker_info(&self) -> Option<SessionPickerInfo>

Source

pub async fn memory() -> Result<Self>

Source

pub async fn memory_with_options(options: StoreOptions) -> Result<Self>

Source

pub async fn save_session_head_meta(&self, meta: SessionHeadMeta)

Source

pub async fn load_session_head_meta(&self) -> Option<SessionHeadMeta>

Source

pub async fn save_session_head(&self, head: SessionHead)

Source

pub async fn load_session_head(&self) -> Option<SessionHead>

Source

pub async fn head_copy_from_store(&self, source: &Store)

Source

pub async fn save_session_meta(&self, meta: SessionMeta)

Source

pub async fn load_session_meta(&self) -> Option<SessionMeta>

Trait Implementations§

Source§

impl AttachmentManifest for Store

Source§

fn record_intent(&self, intent: AttachmentIntent) -> Result<(), StoreError>

Source§

fn commit_refs( &self, session_id: &str, attachment_ids: &[AttachmentId], ) -> Result<(), StoreError>

Mark a set of attachment ids as committed (i.e. now referenced by a durable session-graph commit). Backends that store commits and manifest in the same database stamp this inside the commit transaction; the trait-level method is the out-of-band entry point for hosts that want to commit an id outside the normal turn-commit flow.
Source§

fn list_uncommitted( &self, older_than_epoch_ms: u64, ) -> Result<Vec<AttachmentManifestEntry>, StoreError>

Return manifest entries whose intent has aged past older_than_epoch_ms without ever being committed. Hosts run this periodically to find orphans left by crashes between record_intent and the next turn commit.
Source§

fn forget(&self, attachment_id: &AttachmentId) -> Result<(), StoreError>

Remove a manifest row entirely. Called by the GC coordinator after the corresponding bytes have been removed from the backing AttachmentStore.
Source§

impl LashlangArtifactStore for Store

Source§

fn durability_tier(&self) -> DurabilityTier

Durability tier this artifact store provides; defaults to DurabilityTier::Inline.
Source§

fn put_module_artifact<'life0, 'life1, 'async_trait>( &'life0 self, artifact: &'life1 ModuleArtifact, ) -> Pin<Box<dyn Future<Output = Result<(), ArtifactStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_module_artifact<'life0, 'life1, 'async_trait>( &'life0 self, module_ref: &'life1 ModuleRef, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<ModuleArtifact>>, ArtifactStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl RuntimePersistence for Store

Source§

fn durability_tier(&self) -> DurabilityTier

Durability tier this session store provides; defaults to [DurabilityTier::Inline].
Source§

fn load_session<'life0, 'async_trait>( &'life0 self, scope: SessionReadScope, ) -> Pin<Box<dyn Future<Output = Result<Option<PersistedSessionRead>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn load_node<'life0, 'life1, 'async_trait>( &'life0 self, node_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<SessionNodeRecord>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn commit_runtime_state<'life0, 'async_trait>( &'life0 self, commit: RuntimeCommit, ) -> Pin<Box<dyn Future<Output = Result<RuntimeCommitResult, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn enqueue_queued_work<'life0, 'async_trait>( &'life0 self, batch: QueuedWorkBatchDraft, ) -> Pin<Box<dyn Future<Output = Result<QueuedWorkBatch, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn claim_ready_queued_work<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: &'life1 str, owner_id: &'life2 str, boundary: QueuedWorkClaimBoundary, lease_ttl_ms: u64, max_batches: usize, ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkClaim>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn renew_queued_work_claim<'life0, 'life1, 'async_trait>( &'life0 self, claim: &'life1 QueuedWorkClaim, lease_ttl_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<QueuedWorkClaim, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn abandon_queued_work_claim<'life0, 'life1, 'async_trait>( &'life0 self, claim: &'life1 QueuedWorkClaim, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn cancel_queued_work_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: &'life1 str, batch_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove an unclaimed queued-work batch from durable ingress. Read more
Source§

fn list_queued_work<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn list_pending_queued_work<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List queued-work batches that are still pending presentation/editing. Read more
Source§

fn save_session_meta<'life0, 'async_trait>( &'life0 self, meta: SessionMeta, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn load_session_meta<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<SessionMeta>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn tombstone_nodes<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn vacuum<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<VacuumReport, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn gc_unreachable<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<GcReport, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn claim_ready_queued_work_by_batch_ids<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, session_id: &'life1 str, owner_id: &'life2 str, boundary: QueuedWorkClaimBoundary, lease_ttl_ms: u64, batch_ids: &'life3 [String], ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkClaim>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Claim a specific ready batch set selected from the durable queue. Read more

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