1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use std::collections::HashMap;
pub const OP_DELIVER_EVENT: &str = "DeliverEvent";
pub const OP_WRITE_EVENT: &str = "WriteEvent";
pub const OP_QUERY_STREAM: &str = "QueryStream";
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
pub struct Event {
pub event_id: String,
pub stream: String,
pub values: HashMap<String, String>,
}
#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct WriteResponse {
pub event_id: String,
}
#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct StreamQuery {
pub stream_id: String,
pub range: Option<TimeRange>,
pub count: u64,
}
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
pub struct StreamResults {
pub events: Vec<Event>,
}
#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct TimeRange {
pub min_time: u64,
pub max_time: u64,
}