Skip to main content

bpm_engine_storage/
timer_store.rs

1use async_trait::async_trait;
2
3#[derive(Debug, Clone)]
4pub struct TimerRecord {
5    pub id: String,
6    pub token_id: String,
7    pub instance_id: String,
8    pub due_at: String,
9    pub status: String,
10    pub created_at: String,
11}
12
13#[async_trait]
14pub trait TimerStore: Send + Sync {
15    async fn get_by_id(&self, id: &str) -> anyhow::Result<Option<TimerRecord>>;
16    async fn mark_fired(&self, id: &str) -> anyhow::Result<()>;
17    async fn insert(&self, record: &TimerRecord) -> anyhow::Result<()>;
18    async fn list_due(&self, now_iso: &str, limit: u32) -> anyhow::Result<Vec<TimerRecord>>;
19}