feldera_types/transport/
http.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value as JsonValue;
3use utoipa::ToSchema;
4
5/// Configuration for reading data via HTTP.
6///
7/// HTTP input adapters cannot be usefully configured as part of pipeline
8/// configuration.  Instead, instantiate them through the REST API as
9/// `/pipelines/{pipeline_name}/ingress/{table_name}`.
10#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, ToSchema)]
11pub struct HttpInputConfig {
12    /// Autogenerated name.
13    pub name: String,
14}
15
16/// A set of updates to a SQL table or view.
17///
18/// The `sequence_number` field stores the offset of the chunk relative to the
19/// start of the stream and can be used to implement reliable delivery.
20/// The payload is stored in the `bin_data`, `text_data`, or `json_data` field
21/// depending on the data format used.
22#[derive(Deserialize, ToSchema)]
23pub struct Chunk {
24    pub sequence_number: u64,
25
26    // Exactly one of the following fields must be set.
27    // This should be an enum inlined with `#[serde(flatten)]`, but `utoipa`
28    // struggles to generate a schema for that.
29    /// Base64 encoded binary payload, e.g., bincode.
30    pub bin_data: Option<Vec<u8>>,
31
32    /// Text payload, e.g., CSV.
33    pub text_data: Option<String>,
34
35    /// JSON payload.
36    #[schema(value_type = Option<Object>)]
37    pub json_data: Option<JsonValue>,
38}
39
40// This file indicates the port used by the server
41pub const SERVER_PORT_FILE: &str = "port";