pub trait DroneStore {
Show 15 methods
// Required methods
fn drone_list(&self) -> Result<Vec<DroneDefinition>, StoreError>;
fn drone_get(&self, id: &str) -> Result<Option<DroneDefinition>, StoreError>;
fn drone_upsert(&self, wf: &DroneDefinition) -> Result<(), StoreError>;
fn drone_delete(&self, id: &str) -> Result<bool, StoreError>;
fn drone_once_claim(
&self,
drone_id: &str,
key: &str,
now_ms: i64,
) -> Result<bool, StoreError>;
fn drone_run_insert(&self, run: &DroneRun) -> Result<(), StoreError>;
fn drone_run_update(&self, run: &DroneRun) -> Result<usize, StoreError>;
fn drone_runs_for(
&self,
drone_id: &str,
limit: i64,
) -> Result<Vec<DroneRun>, StoreError>;
fn drone_run_get(
&self,
run_id: &str,
) -> Result<Option<DroneRun>, StoreError>;
fn drone_runs_delete_for(&self, drone_id: &str) -> Result<usize, StoreError>;
fn drone_run_delete(&self, run_id: &str) -> Result<usize, StoreError>;
fn drone_runs_mark_interrupted(
&self,
status: &str,
now_ms: i64,
except: &[String],
) -> Result<usize, StoreError>;
fn drone_runs_running(&self) -> Result<Vec<DroneRun>, StoreError>;
fn drone_checkpoint_put(
&self,
run_id: &str,
step: u32,
kind: &str,
body: &[u8],
now_ms: i64,
) -> Result<(), StoreError>;
fn drone_checkpoints_for(
&self,
run_id: &str,
) -> Result<Vec<CheckpointRow>, StoreError>;
}Required Methods§
fn drone_list(&self) -> Result<Vec<DroneDefinition>, StoreError>
fn drone_get(&self, id: &str) -> Result<Option<DroneDefinition>, StoreError>
fn drone_upsert(&self, wf: &DroneDefinition) -> Result<(), StoreError>
fn drone_delete(&self, id: &str) -> Result<bool, StoreError>
Sourcefn drone_once_claim(
&self,
drone_id: &str,
key: &str,
now_ms: i64,
) -> Result<bool, StoreError>
fn drone_once_claim( &self, drone_id: &str, key: &str, now_ms: i64, ) -> Result<bool, StoreError>
A Once block’s claim of key for drone_id: true for the first caller, false for every later one. The keys
of a drone are forgotten when the drone is deleted.
fn drone_run_insert(&self, run: &DroneRun) -> Result<(), StoreError>
Sourcefn drone_run_update(&self, run: &DroneRun) -> Result<usize, StoreError>
fn drone_run_update(&self, run: &DroneRun) -> Result<usize, StoreError>
Update an existing run row in place. Returns rows affected
(0 if no row matched run.id). Used to flip a placeholder
running row into its terminal state once the drain task
completes, so the row exists from the moment the RPC returns.
fn drone_runs_for( &self, drone_id: &str, limit: i64, ) -> Result<Vec<DroneRun>, StoreError>
Sourcefn drone_run_get(&self, run_id: &str) -> Result<Option<DroneRun>, StoreError>
fn drone_run_get(&self, run_id: &str) -> Result<Option<DroneRun>, StoreError>
One run by its id, whatever its age.
Sourcefn drone_runs_delete_for(&self, drone_id: &str) -> Result<usize, StoreError>
fn drone_runs_delete_for(&self, drone_id: &str) -> Result<usize, StoreError>
Delete every run of drone_id from this store. Runs live in the
version’s objects.db and definitions in the shared store, so no FK
cascades a definition’s delete to its runs (m0038); the delete handler
calls this instead. Returns rows deleted.
Sourcefn drone_run_delete(&self, run_id: &str) -> Result<usize, StoreError>
fn drone_run_delete(&self, run_id: &str) -> Result<usize, StoreError>
Delete one run by its id. Returns rows deleted.
Sourcefn drone_runs_mark_interrupted(
&self,
status: &str,
now_ms: i64,
except: &[String],
) -> Result<usize, StoreError>
fn drone_runs_mark_interrupted( &self, status: &str, now_ms: i64, except: &[String], ) -> Result<usize, StoreError>
After a restart, give every run still running the status status
and end it at now_ms: its drain task died with the old process.
The runs in except are the ones that are being taken up again from
their checkpoints, and stay as they are. Returns rows changed.
Sourcefn drone_runs_running(&self) -> Result<Vec<DroneRun>, StoreError>
fn drone_runs_running(&self) -> Result<Vec<DroneRun>, StoreError>
The runs still running or waiting for attention, oldest first: after a
restart, the ones the old process left (their checkpoints say whether
they can go on).
Sourcefn drone_checkpoint_put(
&self,
run_id: &str,
step: u32,
kind: &str,
body: &[u8],
now_ms: i64,
) -> Result<(), StoreError>
fn drone_checkpoint_put( &self, run_id: &str, step: u32, kind: &str, body: &[u8], now_ms: i64, ) -> Result<(), StoreError>
Keep checkpoint step of run_id (kind is full or diff). Writing a step that
is already there is an error: a checkpoint is never rewritten.
Sourcefn drone_checkpoints_for(
&self,
run_id: &str,
) -> Result<Vec<CheckpointRow>, StoreError>
fn drone_checkpoints_for( &self, run_id: &str, ) -> Result<Vec<CheckpointRow>, StoreError>
The checkpoints of run_id, oldest step first.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".