pub struct State { /* private fields */ }Expand description
A handle to the run’s SQLite state.
Implementations§
Source§impl State
impl State
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open (creating if needed) the state database at path, ensuring schema.
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
Open an in-memory database (for tests).
Sourcepub fn ensure_node(&self, node_id: &str) -> Result<()>
pub fn ensure_node(&self, node_id: &str) -> Result<()>
Ensure a node row exists, without disturbing an existing one (so resume preserves prior status). Call once per node when a plan is loaded.
pub fn set_status(&self, node_id: &str, status: NodeStatus) -> Result<()>
pub fn set_worker(&self, node_id: &str, worker: &str) -> Result<()>
pub fn status(&self, node_id: &str) -> Result<NodeStatus>
Sourcepub fn worker(&self, node_id: &str) -> Result<Option<String>>
pub fn worker(&self, node_id: &str) -> Result<Option<String>>
The worker last assigned to a node, if any.
Sourcepub fn incr_iteration(&self, node_id: &str) -> Result<u32>
pub fn incr_iteration(&self, node_id: &str) -> Result<u32>
Increment a node’s iteration counter and return the new value.
pub fn iterations(&self, node_id: &str) -> Result<u32>
Sourcepub fn record_usage(
&self,
node_id: &str,
worker: &str,
usage: &Usage,
) -> Result<()>
pub fn record_usage( &self, node_id: &str, worker: &str, usage: &Usage, ) -> Result<()>
Record token/time usage for a node invocation.
Sourcepub fn total_iterations(&self) -> Result<u32>
pub fn total_iterations(&self) -> Result<u32>
Total iterations recorded across all nodes (the run-level loop count).
Sourcepub fn total_usage(&self) -> Result<Usage>
pub fn total_usage(&self) -> Result<Usage>
Aggregate token usage across the run.
Sourcepub fn usage_rows(&self) -> Result<Vec<UsageRow>>
pub fn usage_rows(&self) -> Result<Vec<UsageRow>>
Per-invocation usage rows for trajectory inspection (rinne logs).
Sourcepub fn set_meta(&self, key: &str, value: &str) -> Result<()>
pub fn set_meta(&self, key: &str, value: &str) -> Result<()>
Store/read a run-level scalar (e.g. the start timestamp).
pub fn meta(&self, key: &str) -> Result<Option<String>>
Auto Trait Implementations§
impl !Freeze for State
impl !RefUnwindSafe for State
impl !Sync for State
impl !UnwindSafe for State
impl Send for State
impl Unpin for State
impl UnsafeUnpin for State
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
Mutably borrows from an owned value. Read more