pub struct RuntimeStore { /* private fields */ }Expand description
SQLite-backed durable runtime state.
Implementations§
Source§impl RuntimeStore
impl RuntimeStore
pub fn open_default() -> Result<RuntimeStore, Error>
pub fn open(path: impl AsRef<Path>) -> Result<RuntimeStore, Error>
pub fn path(&self) -> &Path
pub fn sessions(&self) -> SessionsRepo<'_>
pub fn messages(&self) -> MessagesRepo<'_>
pub fn tasks(&self) -> TasksRepo<'_>
pub fn tool_runs(&self) -> ToolRunsRepo<'_>
pub fn approvals(&self) -> ApprovalsRepo<'_>
pub fn processes(&self) -> ProcessesRepo<'_>
pub fn checkpoints(&self) -> CheckpointsRepo<'_>
pub fn compactions(&self) -> CompactionsRepo<'_>
pub fn plugins(&self) -> PluginsRepo<'_>
pub fn provider_probes(&self) -> ProviderProbesRepo<'_>
pub fn pairing_tokens(&self) -> PairingTokensRepo<'_>
pub fn outcomes(&self) -> OutcomesRepo<'_>
Sourcepub fn reconcile_after_restart(&self) -> Result<(usize, usize), Error>
pub fn reconcile_after_restart(&self) -> Result<(usize, usize), Error>
Recover state stranded by a previous daemon’s crash/stop (#120, #118).
A Running task’s worker died with the daemon, so it can never finish —
mark it failed with an event. An approval left in the transient
approving claim state (a replay that crashed mid-effect, #118) is reset
to undecided so it reappears as pending and stays re-runnable. Call once
on daemon startup, before serving. Returns (tasks_reset, claims_released).
F18 (RC-E): only daemon-owned running tasks are reset. The store is
shared with interactive mermaid CLI runs; their tasks are created with a
NULL owner_kind and are LEFT RUNNING here, so a live CLI session isn’t
wrongly flipped to failed (with a spurious “interrupted” event) just
because the daemon restarted. The daemon tags the tasks it runs in-process
via NewTask::daemon_owned.
Sourcepub fn gc(
&self,
retention_days: i64,
outcomes_retention_days: i64,
) -> Result<u64, Error>
pub fn gc( &self, retention_days: i64, outcomes_retention_days: i64, ) -> Result<u64, Error>
Best-effort retention GC (#130, F22/RC-F): prune archived
approvals/checkpoints, the events of long-finished tasks, terminal tasks,
and the high-churn / old rows of the remaining tables, all older than
retention_days. The append-only outcomes reward table — the
self-improving-loop training corpus — is pruned on its own, longer
outcomes_retention_days window so a large training history survives the
shorter task/session window. Deletes only archived, finished, or
terminal-and-old rows — active data is never touched (a running task,
a still-open tool run, a live process, or a recently-updated session all
survive). Returns the number of rows removed.
Auto Trait Implementations§
impl !Freeze for RuntimeStore
impl !RefUnwindSafe for RuntimeStore
impl !Sync for RuntimeStore
impl !UnwindSafe for RuntimeStore
impl Send for RuntimeStore
impl Unpin for RuntimeStore
impl UnsafeUnpin for RuntimeStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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