Skip to main content

flight_common/
config.rs

1//! Configuration for Flight SQL components.
2
3use serde::{Deserialize, Serialize};
4
5/// Apache Arrow Flight SQL server configuration.
6///
7/// Configures the gRPC endpoint for Flight SQL service.
8#[derive(Debug, Clone, Deserialize, Serialize)]
9pub struct FlightServerConfig {
10    /// gRPC endpoint address (e.g., "0.0.0.0:32010").
11    #[serde(default = "default_grpc_addr")]
12    pub endpoint: String,
13}
14
15/// Apache Arrow Flight SQL client configuration.
16///
17/// Configures the target endpoint for Flight SQL queries.
18#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, kinetic_doc_derive::FieldDoc)]
19pub struct FlightClientConfig {
20    /// Target Flight SQL endpoint URL (e.g., "http://localhost:32010").
21    #[doc_field(required, example = "http://localhost:32010")]
22    pub endpoint: String,
23    /// Destination table name for insertions.
24    #[doc_field(example = "events")]
25    pub table_name: Option<String>,
26    /// SQL commands to execute upon connecting (e.g., SET proxy = 'my-proxy').
27    #[doc_field(example = "[\"SET proxy = 'my-proxy'\"]")]
28    pub setup_commands: Option<Vec<String>>,
29}
30
31fn default_grpc_addr() -> String {
32    "0.0.0.0:32010".to_string()
33}