Skip to main content

ursula_stream/
command.rs

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