1use serde::Deserialize;
2use serde::Serialize;
3use ursula_shard::BucketStreamId;
4
5use crate::model::ColdChunkRef;
6use crate::model::ExternalPayloadRef;
7use crate::model::ProducerRequest;
8
9#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
10pub enum StreamCommand {
11 CreateBucket {
12 bucket_id: String,
13 },
14 DeleteBucket {
15 bucket_id: String,
16 },
17 CreateStream {
18 stream_id: BucketStreamId,
19 content_type: String,
20 initial_payload: Vec<u8>,
21 close_after: bool,
22 stream_seq: Option<String>,
23 producer: Option<ProducerRequest>,
24 stream_ttl_seconds: Option<u64>,
25 stream_expires_at_ms: Option<u64>,
26 forked_from: Option<BucketStreamId>,
27 fork_offset: Option<u64>,
28 now_ms: u64,
29 },
30 CreateExternal {
31 stream_id: BucketStreamId,
32 content_type: String,
33 initial_payload: ExternalPayloadRef,
34 close_after: bool,
35 stream_seq: Option<String>,
36 producer: Option<ProducerRequest>,
37 stream_ttl_seconds: Option<u64>,
38 stream_expires_at_ms: Option<u64>,
39 forked_from: Option<BucketStreamId>,
40 fork_offset: Option<u64>,
41 now_ms: u64,
42 },
43 Append {
44 stream_id: BucketStreamId,
45 content_type: Option<String>,
46 payload: Vec<u8>,
47 close_after: bool,
48 stream_seq: Option<String>,
49 producer: Option<ProducerRequest>,
50 now_ms: u64,
51 },
52 AppendExternal {
53 stream_id: BucketStreamId,
54 content_type: Option<String>,
55 payload: ExternalPayloadRef,
56 close_after: bool,
57 stream_seq: Option<String>,
58 producer: Option<ProducerRequest>,
59 now_ms: u64,
60 },
61 AppendBatch {
62 stream_id: BucketStreamId,
63 content_type: Option<String>,
64 payloads: Vec<Vec<u8>>,
65 producer: Option<ProducerRequest>,
66 now_ms: u64,
67 },
68 PublishSnapshot {
69 stream_id: BucketStreamId,
70 snapshot_offset: u64,
71 content_type: String,
72 payload: Vec<u8>,
73 now_ms: u64,
74 },
75 TouchStreamAccess {
76 stream_id: BucketStreamId,
77 now_ms: u64,
78 renew_ttl: bool,
79 },
80 AddForkRef {
81 stream_id: BucketStreamId,
82 now_ms: u64,
83 },
84 ReleaseForkRef {
85 stream_id: BucketStreamId,
86 },
87 FlushCold {
88 stream_id: BucketStreamId,
89 chunk: ColdChunkRef,
90 },
91 Close {
92 stream_id: BucketStreamId,
93 stream_seq: Option<String>,
94 producer: Option<ProducerRequest>,
95 now_ms: u64,
96 },
97 DeleteStream {
98 stream_id: BucketStreamId,
99 },
100 AckColdGc {
104 up_to_seq: u64,
105 },
106}