pub struct LocalSqlite { /* private fields */ }Implementations§
Source§impl LocalSqlite
impl LocalSqlite
pub fn from_db(db: Db) -> Self
pub fn from_db_with_clock(db: Db, clock: Arc<dyn Clock>) -> Self
pub fn last_sync_ms(&self) -> Option<i64>
pub fn insert_local_project( &self, id: &str, file_path: &str, title: &str, now_ms: i64, ) -> Result<(), StoreError>
Sourcepub fn upsert_local_project(
&self,
id: &str,
file_path: &str,
title: &str,
now_ms: i64,
) -> Result<(), StoreError>
pub fn upsert_local_project( &self, id: &str, file_path: &str, title: &str, now_ms: i64, ) -> Result<(), StoreError>
Inserts or refreshes a project indexed from a committed file. Startup and reindex call this for every configured project file, so it must tolerate rows that already exist.
pub fn project_exists(&self, id: &str) -> Result<bool, StoreError>
pub fn project(&self, id: &str) -> Result<Option<ProjectRecord>, StoreError>
pub fn insert_local_ticket( &self, id: &str, project_id: &str, file_path: &str, name: &str, blocked_by: &[String], worktree: &str, target: Option<&str>, model: Option<&str>, effort: Option<&str>, flow: &str, state: TicketState, now_ms: i64, ) -> Result<(), StoreError>
pub fn update_local_ticket( &self, id: &str, name: &str, blocked_by: &[String], worktree: &str, target: Option<&str>, model: Option<&str>, effort: Option<&str>, flow: &str, now_ms: i64, ) -> Result<(), StoreError>
pub fn update_ticket_execution( &self, id: &str, target: Option<&str>, model: Option<&str>, effort: Option<&str>, now_ms: i64, ) -> Result<(), StoreError>
pub fn update_ticket_body( &self, id: &str, body: &str, now_ms: i64, ) -> Result<(), StoreError>
pub fn backfill_ticket_targets( &self, default_target: &str, now_ms: i64, ) -> Result<usize, StoreError>
pub fn ticket(&self, id: &str) -> Result<Option<TicketRecord>, StoreError>
pub fn ticket_by_name( &self, name: &str, ) -> Result<Option<TicketRecord>, StoreError>
pub fn ticket_by_file( &self, file_path: &str, ) -> Result<Option<TicketRecord>, StoreError>
pub fn ticket_by_source_ref( &self, source: &str, source_ref: &str, ) -> Result<Option<TicketRecord>, StoreError>
pub fn tickets(&self) -> Result<Vec<TicketRecord>, StoreError>
pub fn tickets_for_project( &self, project_id: &str, ) -> Result<Vec<TicketRecord>, StoreError>
pub fn ticket_dependencies( &self, ) -> Result<BTreeMap<String, Vec<String>>, StoreError>
pub fn select_ready_ticket( &self, project_id: Option<&str>, trigger_id: &str, now_ms: i64, ) -> Result<Option<String>, StoreError>
pub fn ticket_is_dispatchable( &self, ticket_id: &str, ) -> Result<bool, StoreError>
pub fn unmerged_blockers( &self, ticket_id: &str, ) -> Result<Vec<String>, StoreError>
pub fn readopt_lease( &self, ticket_id: &str, run_id: &str, lease_ms: i64, now_ms: i64, ) -> Result<i64, StoreError>
pub fn renew_lease( &self, ticket_id: &str, run_id: &str, lease_ms: i64, now_ms: i64, ) -> Result<i64, StoreError>
pub fn ticket_ids(&self) -> Result<Vec<String>, StoreError>
pub fn local_ticket_files(&self) -> Result<Vec<LocalTicketFile>, StoreError>
pub fn delete_ticket(&self, id: &str) -> Result<(), StoreError>
pub fn mark_ticket_missing( &self, id: &str, now_ms: i64, ) -> Result<(), StoreError>
pub fn clear_ticket_missing( &self, id: &str, now_ms: i64, ) -> Result<(), StoreError>
pub fn ticket_state(&self, id: &str) -> Result<Option<String>, StoreError>
pub fn set_ticket_hold( &self, id: &str, state: TicketState, now_ms: i64, ) -> Result<String, StoreError>
pub fn ticket_counts(&self) -> Result<TicketCounts, StoreError>
Source§impl LocalSqlite
impl LocalSqlite
Sourcepub fn insert_trigger(
&self,
trigger: &NewTrigger<'_>,
now_ms: i64,
) -> Result<(), StoreError>
pub fn insert_trigger( &self, trigger: &NewTrigger<'_>, now_ms: i64, ) -> Result<(), StoreError>
Seeding primitive: writes one trigger row with a caller-chosen id.
Tests use it to build a fixture queue; production creation is
LocalSqlite::enqueue_trigger, which mints the id and cannot leave a
trigger without its filters.
Sourcepub fn insert_trigger_filter(
&self,
trigger_id: &str,
ticket_id: &str,
) -> Result<(), StoreError>
pub fn insert_trigger_filter( &self, trigger_id: &str, ticket_id: &str, ) -> Result<(), StoreError>
Seeding primitive; see LocalSqlite::insert_trigger.
pub fn queued_triggers(&self) -> Result<Vec<QueuedTrigger>, StoreError>
pub fn dispatchable_triggers( &self, now_ms: i64, ) -> Result<Vec<QueuedTrigger>, StoreError>
Sourcepub fn has_claimable_trigger(
&self,
ticket_id: &str,
now_ms: i64,
) -> Result<bool, StoreError>
pub fn has_claimable_trigger( &self, ticket_id: &str, now_ms: i64, ) -> Result<bool, StoreError>
Whether any queued trigger could select this ticket: the reporting mirror of the claim path’s selection, asked per ticket rather than as “does the queue hold anything at all”.
pub fn next_trigger_eligible_at_ms( &self, now_ms: i64, ) -> Result<Option<i64>, StoreError>
Sourcepub fn complete_merged_ticket_triggers(
&self,
now_ms: i64,
) -> Result<Vec<(String, String)>, StoreError>
pub fn complete_merged_ticket_triggers( &self, now_ms: i64, ) -> Result<Vec<(String, String)>, StoreError>
Retires triggers left queued against a ticket that merged before the
settle path knew to retire them. [complete_for_ticket] only applies
from the next settlement onwards, and a merged ticket never settles
again, so anything already stranded needs this one-off sweep.
Returns the (trigger_id, ticket_id) pairs it completed, so the caller
can report a startup mutation rather than perform it silently. A
database with nothing stranded selects no rows and writes nothing, which
makes repeated runs free.
Trait Implementations§
Source§impl WorkState for LocalSqlite
SQLite satisfies atomic claims with an IMMEDIATE transaction and a
conditional ticket update. The ticket row is authoritative for attempts:
claim consumes one attempt, while release preserves that count as evidence
of the completed try. This backend never records runs, and its local-source
outcome push is idempotent because release already applied the durable
ticket state.
impl WorkState for LocalSqlite
SQLite satisfies atomic claims with an IMMEDIATE transaction and a conditional ticket update. The ticket row is authoritative for attempts: claim consumes one attempt, while release preserves that count as evidence of the completed try. This backend never records runs, and its local-source outcome push is idempotent because release already applied the durable ticket state.
Source§fn claim_strength(&self) -> ClaimStrength
fn claim_strength(&self) -> ClaimStrength
LocalOnly sources.