pub struct ScheduleStore { /* private fields */ }Implementations§
Source§impl ScheduleStore
impl ScheduleStore
pub async fn new(bamboo_home_dir: PathBuf) -> Result<Self>
pub fn index_path(&self) -> &Path
pub async fn list_schedules(&self) -> Vec<ScheduleEntry>
pub async fn get_schedule(&self, id: &str) -> Option<ScheduleEntry>
pub async fn get_run_record(&self, run_id: &str) -> Option<ScheduleRunRecord>
pub async fn list_run_records_for_schedule( &self, schedule_id: &str, ) -> Vec<ScheduleRunRecord>
pub async fn create_schedule( &self, name: String, trigger: ScheduleTrigger, enabled: bool, run_config: ScheduleRunConfig, ) -> Result<ScheduleEntry>
pub async fn create_schedule_with_definition( &self, name: String, enabled: bool, run_config: ScheduleRunConfig, definition: ScheduleDefinitionChanges, ) -> Result<ScheduleEntry>
pub async fn patch_schedule( &self, id: &str, name: Option<String>, enabled: Option<bool>, trigger: Option<ScheduleTrigger>, run_config: Option<ScheduleRunConfig>, ) -> Result<Option<ScheduleEntry>>
pub async fn patch_schedule_with_definition( &self, id: &str, name: Option<String>, enabled: Option<bool>, run_config: Option<ScheduleRunConfig>, definition: ScheduleDefinitionChanges, ) -> Result<Option<ScheduleEntry>>
Sourcepub async fn patch_schedule_with_definition_in_project(
&self,
id: &str,
name: Option<String>,
enabled: Option<bool>,
run_config: Option<ScheduleRunConfig>,
definition: ScheduleDefinitionChanges,
expected_project_id: Option<&ProjectId>,
) -> Result<Option<ScheduleEntry>>
pub async fn patch_schedule_with_definition_in_project( &self, id: &str, name: Option<String>, enabled: Option<bool>, run_config: Option<ScheduleRunConfig>, definition: ScheduleDefinitionChanges, expected_project_id: Option<&ProjectId>, ) -> Result<Option<ScheduleEntry>>
Patch only when the schedule still belongs to expected_project_id at
the instant the write lock is held. A scope mismatch is intentionally
indistinguishable from a missing schedule.
pub async fn delete_schedule(&self, id: &str) -> Result<bool>
Sourcepub async fn delete_schedule_in_project(
&self,
id: &str,
expected_project_id: Option<&ProjectId>,
) -> Result<bool>
pub async fn delete_schedule_in_project( &self, id: &str, expected_project_id: Option<&ProjectId>, ) -> Result<bool>
Delete only when the schedule still belongs to expected_project_id
while the write lock is held.
Sourcepub async fn claim_due_runs(
&self,
now: DateTime<Utc>,
) -> Result<Vec<ClaimedScheduleRun>>
pub async fn claim_due_runs( &self, now: DateTime<Utc>, ) -> Result<Vec<ClaimedScheduleRun>>
Claim all due schedules and advance their next_run_at.
Returns a list of run descriptors to execute out-of-band.
Important: only writes to disk when at least one schedule is actually due. The ticker calls this every few seconds, so avoiding unnecessary writes is critical for disk health and crash-safety.
pub async fn claim_due_runs_with_engine( &self, now: DateTime<Utc>, engine: &dyn TriggerEngine, ) -> Result<Vec<ClaimedScheduleRun>>
pub async fn mark_run_started( &self, schedule_id: &str, run_id: &str, ) -> Result<()>
pub async fn bind_run_session( &self, schedule_id: &str, run_id: &str, session_id: &str, ) -> Result<()>
pub async fn mark_run_terminal( &self, schedule_id: &str, run_id: &str, status: ScheduleRunStatus, outcome_reason: Option<String>, ) -> Result<()>
pub async fn mark_run_dequeued_without_start( &self, schedule_id: &str, run_id: &str, outcome_reason: Option<String>, ) -> Result<()>
Sourcepub async fn create_run_now(
&self,
id: &str,
) -> Result<Option<ClaimedScheduleRun>>
pub async fn create_run_now( &self, id: &str, ) -> Result<Option<ClaimedScheduleRun>>
Create a run descriptor immediately (does not change the schedule cadence).
Sourcepub async fn create_run_now_in_project(
&self,
id: &str,
expected_project_id: Option<&ProjectId>,
) -> Result<Option<ClaimedScheduleRun>>
pub async fn create_run_now_in_project( &self, id: &str, expected_project_id: Option<&ProjectId>, ) -> Result<Option<ClaimedScheduleRun>>
Claim a run only when the schedule still belongs to
expected_project_id while the write lock is held.
Sourcepub async fn create_run_now_if_config(
&self,
id: &str,
expected_run_config: &ScheduleRunConfig,
) -> Result<Option<ClaimedScheduleRun>>
pub async fn create_run_now_if_config( &self, id: &str, expected_run_config: &ScheduleRunConfig, ) -> Result<Option<ClaimedScheduleRun>>
Claim a run only when the complete run configuration that was validated by the caller is still current while the write lock is held. This keeps a concurrent schedule PATCH from swapping in an unvalidated workspace, Project, model, or auto-execute configuration between validation and run creation.