feldera_types/transport/http.rs
1use serde::{Deserialize, Serialize};
2use serde_json::Value as JsonValue;
3use utoipa::ToSchema;
4
5/// Configuration for data output via HTTP.
6///
7/// HTTP output adapters cannot be usefully configured as part of pipeline
8/// configuration. Instead, instantiate them through the REST API as
9/// `/pipelines/{pipeline_name}/egress`.
10#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize, ToSchema)]
11#[serde(default)]
12pub struct HttpOutputConfig {
13 /// Apply backpressure on the pipeline when the HTTP client cannot receive
14 /// data fast enough.
15 ///
16 /// When this flag is set to false (the default), the HTTP connector drops data
17 /// chunks if the client is not keeping up with its output. This prevents
18 /// a slow HTTP client from slowing down the entire pipeline.
19 ///
20 /// When the flag is set to true, the connector waits for the client to receive
21 /// each chunk and blocks the pipeline if the client cannot keep up.
22 pub backpressure: bool,
23}
24
25/// Configuration for data input via HTTP.
26///
27/// HTTP input adapters cannot be usefully configured as part of pipeline
28/// configuration. Instead, instantiate them through the REST API as
29/// `/pipelines/{pipeline_name}/ingress/{table_name}`.
30#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, ToSchema)]
31pub struct HttpInputConfig {
32 /// Autogenerated name.
33 pub name: String,
34}
35
36/// A set of updates to a SQL table or view.
37///
38/// The `sequence_number` field stores the offset of the chunk relative to the
39/// start of the stream and can be used to implement reliable delivery.
40/// The payload is stored in the `bin_data`, `text_data`, or `json_data` field
41/// depending on the data format used.
42#[derive(Deserialize, ToSchema)]
43pub struct Chunk {
44 pub sequence_number: u64,
45
46 // Exactly one of the following fields must be set.
47 // This should be an enum inlined with `#[serde(flatten)]`, but `utoipa`
48 // struggles to generate a schema for that.
49 /// Base64 encoded binary payload, e.g., bincode.
50 pub bin_data: Option<Vec<u8>>,
51
52 /// Text payload, e.g., CSV.
53 pub text_data: Option<String>,
54
55 /// JSON payload.
56 #[schema(value_type = Option<Object>)]
57 pub json_data: Option<JsonValue>,
58}
59
60// This file indicates the port used by the server
61pub const SERVER_PORT_FILE: &str = "port";