feldera_types/transport/postgres.rs
1use serde::{Deserialize, Serialize};
2use utoipa::ToSchema;
3
4/// Postgres input connector configuration.
5#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
6pub struct PostgresReaderConfig {
7 /// Postgres URI.
8 /// See: <https://docs.rs/tokio-postgres/0.7.12/tokio_postgres/config/struct.Config.html>
9 pub uri: String,
10
11 /// Query that specifies what data to fetch from postgres.
12 pub query: String,
13}
14
15/// Postgres output connector configuration.
16#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
17pub struct PostgresWriterConfig {
18 /// Postgres URI.
19 /// See: <https://docs.rs/tokio-postgres/0.7.12/tokio_postgres/config/struct.Config.html>
20 pub uri: String,
21
22 /// The table to write the output to.
23 pub table: String,
24
25 /// The CA certificate in PEM format.
26 pub ssl_ca_pem: Option<String>,
27
28 /// The client certificate in PEM format.
29 pub ssl_client_pem: Option<String>,
30
31 /// The client certificate key in PEM format.
32 pub ssl_client_key: Option<String>,
33
34 /// True to enable hostname verification when using TLS. True by default.
35 pub verify_hostname: Option<bool>,
36
37 /// The maximum number of records in a single buffer.
38 pub max_records_in_buffer: Option<usize>,
39
40 /// The maximum buffer size in for a single operation.
41 /// Note that the buffers of `INSERT`, `UPDATE` and `DELETE` queries are
42 /// separate.
43 /// Default: 1 MiB
44 #[schema(default = default_max_buffer_size)]
45 #[serde(default = "default_max_buffer_size")]
46 pub max_buffer_size_bytes: usize,
47}
48
49fn default_max_buffer_size() -> usize {
50 usize::pow(2, 20)
51}