azoth_core/traits/
event.rs1use crate::error::Result;
2use crate::traits::projection::ProjectionTxn;
3use crate::types::EventId;
4
5#[derive(Debug, Clone)]
9pub struct DecodedEvent {
10 pub id: EventId,
11 pub event_type: String,
12 pub payload: Vec<u8>,
13}
14
15pub trait EventDecoder: Send + Sync {
17 fn decode(&self, id: EventId, bytes: &[u8]) -> Result<DecodedEvent>;
19}
20
21pub trait EventApplier<T: ProjectionTxn>: Send + Sync {
26 fn apply(&self, txn: &mut T, event: &DecodedEvent) -> Result<()>;
28}