feldera_types/transport/s2.rs
1use serde::{Deserialize, Serialize};
2use utoipa::ToSchema;
3
4/// Where to start reading from the S2 stream.
5#[derive(Debug, Clone, Default, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
6pub enum S2StartFrom {
7 /// Start from a specific sequence number.
8 SeqNum(u64),
9 /// Start from a specific timestamp (milliseconds since epoch).
10 Timestamp(u64),
11 /// Start from N records before the tail.
12 TailOffset(u64),
13 /// Start from the beginning (sequence number 0).
14 #[default]
15 Beginning,
16 /// Start from the tail (new records only).
17 Tail,
18}
19
20/// Configuration for reading from an S2 stream.
21#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
22pub struct S2InputConfig {
23 /// S2 basin name.
24 pub basin: String,
25 /// S2 stream name.
26 pub stream: String,
27 /// S2 authentication token.
28 pub auth_token: String,
29 /// Custom S2 endpoint URL (e.g., "http://localhost:8080").
30 /// If not set, uses the default S2 cloud endpoint.
31 #[serde(default, skip_serializing_if = "Option::is_none")]
32 pub endpoint: Option<String>,
33 /// Where to start reading when no checkpoint exists.
34 #[serde(default)]
35 pub start_from: S2StartFrom,
36}
37
38/// Configuration for writing to an S2 stream.
39#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
40pub struct S2OutputConfig {
41 /// S2 basin name.
42 pub basin: String,
43 /// S2 stream name.
44 pub stream: String,
45 /// S2 authentication token.
46 pub auth_token: String,
47 /// Custom S2 endpoint URL (e.g., "http://localhost:8080").
48 /// If not set, uses the default S2 cloud endpoint.
49 #[serde(default, skip_serializing_if = "Option::is_none")]
50 pub endpoint: Option<String>,
51}