bpm_engine_storage/
history.rs1use async_trait::async_trait;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct HistoryEvent {
8 pub id: String,
9 pub instance_id: String,
10 pub event_type: String,
11 pub payload: serde_json::Value,
12 pub occurred_at: String,
13}
14
15#[async_trait]
16pub trait HistoryRepo: Send + Sync {
17 async fn append(
19 &self,
20 instance_id: &str,
21 event_type: &str,
22 payload: &serde_json::Value,
23 occurred_at: &str,
24 ) -> anyhow::Result<String>;
25
26 async fn list_by_instance(
29 &self,
30 instance_id: &str,
31 token_id_filter: Option<&str>,
32 event_type_filter: Option<&str>,
33 ) -> anyhow::Result<Vec<HistoryEvent>>;
34}