Skip to main content

ForgeStore

Struct ForgeStore 

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

ForgeStore — SQLite-backed storage for all Forge state.

The connection is wrapped in a Mutex for thread-safety.

Implementations§

Source§

impl ForgeStore

Source

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

Open (or create) a Forge database at the given path.

Invariant I1: Calls invariants::refuse_to_open_db() as the very first action. If the file exists and is not a valid Forge DB, returns ForgeError::RefuseToOpenDb.

Source

pub fn with_transaction<F, T>(&self, f: F) -> ForgeResult<T>
where F: FnOnce(&Connection) -> ForgeResult<T>,

Execute a closure with transactional semantics.

Source

pub fn with_transaction_conn<F, T>(&self, f: F) -> ForgeResult<T>
where F: for<'tx> FnOnce(&Transaction<'tx>) -> ForgeResult<T>,

Execute a closure with a write transaction handle for consumers that can execute transaction-owned CEA adapters without opening a nested tx.

Source

pub fn with_conn<F, T>(&self, f: F) -> ForgeResult<T>
where F: FnOnce(&Connection) -> ForgeResult<T>,

Execute a closure with the shared write-locked SQLite connection.

Source

pub fn path(&self) -> &Path

Get the database path.

Source

pub fn insert_candidate( &self, candidate_id: &str, spec_json: &str, parents_json: &str, status: &str, ) -> ForgeResult<()>

Source

pub fn get_candidate_spec(&self, candidate_id: &str) -> ForgeResult<String>

Source

pub fn update_candidate_status( &self, candidate_id: &str, status: &str, ) -> ForgeResult<()>

Source

pub fn insert_task( &self, task_id: &str, suite_name: &str, fixture_ref: &str, prompt: &str, constraints_json: &str, weights_json: &str, ) -> ForgeResult<()>

Source

pub fn insert_eval_run( &self, eval_id: &str, candidate_id: &str, task_id: &str, backend: &str, seed: i64, mindstate_hash: &str, patch_hash: &str, structural_sig: &str, scores_json: &str, violations_json: &str, logs_ref: &str, cea_run_hash: Option<&str>, ) -> ForgeResult<()>

Source

pub fn get_eval_runs_for_candidate( &self, candidate_id: &str, ) -> ForgeResult<Vec<EvalRunRow>>

Source

pub fn upsert_archive_cell( &self, cell_key: &str, candidate_id: &str, score_summary_json: &str, cea_fingerprint: Option<&str>, ) -> ForgeResult<()>

Source

pub fn get_archive_cell( &self, cell_key: &str, ) -> ForgeResult<Option<ArchiveCellRow>>

Source

pub fn insert_promotion( &self, version_id: &str, candidate_id: &str, frozen_spec_json: &str, bounds_json: &str, invariants_json: &str, checksum: &str, cea_fingerprint_json: Option<&str>, ) -> ForgeResult<()>

Source

pub fn get_latest_promotion(&self) -> ForgeResult<Option<PromotionRow>>

Source

pub fn count_promotions(&self) -> ForgeResult<usize>

Source

pub fn insert_answer_trace( &self, trace_id: &str, question_sig: &str, version_id: &str, strategy_tags_json: &str, patch_hash: &str, structural_sig: &str, score_json: &str, ) -> ForgeResult<()>

Source

pub fn get_recent_traces_for_question( &self, question_sig: &str, limit: usize, ) -> ForgeResult<Vec<AnswerTraceRow>>

Source

pub fn upsert_cea_node( &self, node_id: &str, node_kind: &str, sig_json: &str, ) -> ForgeResult<()>

Source

pub fn upsert_cea_edge( &self, edge_id: &str, cause_node_id: &str, effect_node_id: &str, weight_delta: f64, version_id: &str, ) -> ForgeResult<bool>

Source

pub fn check_cea_run_log(&self, run_hash: &str) -> ForgeResult<bool>

Source

pub fn insert_cea_run_log( &self, run_hash: &str, eval_id: &str, edges_added: i64, edges_updated: i64, ) -> ForgeResult<()>

Source

pub fn get_cea_edges_for_cause( &self, cause_node_id: &str, ) -> ForgeResult<Vec<CeaEdgeRow>>

Source

pub fn get_all_cea_nodes_and_edges( &self, version_id: Option<&str>, ) -> ForgeResult<(Vec<CeaNodeRow>, Vec<CeaEdgeRow>)>

Get all CEA nodes and edges, optionally filtered by version_id.

Source

pub fn get_cea_node_sig(&self, node_id: &str) -> ForgeResult<Option<String>>

Source

pub fn insert_evidence_bundle( &self, bundle_id: &str, candidate_id: &str, eval_id: &str, version_id: &str, trace_id: &str, scores_json: &str, hypotheses_json: &str, verification_plan_json: Option<&str>, diff_json: Option<&str>, assessment_json: Option<&str>, warnings_json: &str, ) -> ForgeResult<()>

Source

pub fn get_evidence_bundle( &self, bundle_id: &str, ) -> ForgeResult<Option<EvidenceBundleRow>>

Source

pub fn get_latest_evidence_bundle_for_candidate( &self, candidate_id: &str, ) -> ForgeResult<Option<EvidenceBundleRow>>

Source

pub fn count_evidence_bundles_for_candidate( &self, candidate_id: &str, ) -> ForgeResult<usize>

Source

pub fn count_evidence_bundles(&self) -> ForgeResult<usize>

Source

pub fn list_recent_evidence_bundle_ids( &self, limit: usize, ) -> ForgeResult<Vec<String>>

Source

pub fn insert_experiment_run( &self, run_id: &str, candidate_id: &str, task_id: &str, trace_id: &str, mode: &str, baseline_json: &str, patched_json: &str, diff_json: &str, baseline_descriptor_json: &str, trials_json: &str, ) -> ForgeResult<()>

Source

pub fn insert_export_receipt( &self, export_key: &str, bundle_id: &str, rendering_version: u32, namespace: &str, write_through_ok: Option<bool>, ) -> ForgeResult<bool>

Source

pub fn has_export_receipt(&self, export_key: &str) -> ForgeResult<bool>

Source

pub fn insert_run_failure( &self, failure_id: &str, run_id: &str, class: &str, message: &str, phase: &str, retriable: bool, retry_count: u32, ) -> ForgeResult<()>

Source

pub fn get_failures_for_run( &self, run_id: &str, ) -> ForgeResult<Vec<RunFailureRow>>

Source

pub fn insert_verification_plan( &self, plan_id: &str, bundle_id: &str, target_hypotheses_json: &str, steps_json: &str, policy_json: Option<&str>, ) -> ForgeResult<()>

Source

pub fn insert_tool_receipt(&self, row: &ToolReceiptRow) -> ForgeResult<bool>

Source

pub fn get_tool_receipt( &self, receipt_id: &str, ) -> ForgeResult<Option<ToolReceiptRow>>

Trait Implementations§

Source§

impl Debug for ForgeStore

Source§

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

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

impl Drop for ForgeStore

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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