1use serde::{Deserialize, Serialize};
2use uuid::Uuid;
3
4type Payload = Vec<u8>;
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct CommandMessage<C> {
9 pub id: Uuid,
10 pub command: C,
11 pub payload: Option<Payload>,
12}
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct ResponseMessage<C> {
17 pub id: Uuid,
18 pub command: C,
19 pub payload: Option<Payload>,
20 pub success: bool,
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct Instruction<A, C> {
26 pub id: Uuid,
27 pub action: A,
28 pub compensate: C,
29 pub response_data_key: u32,
30 pub response_instert_key: u32,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct Saga<A, C> {
36 pub id: Uuid,
37 pub initial_payload: Option<Payload>,
38 pub instructions: Vec<Instruction<A, C>>,
39}