Skip to main content

feldera_types/transport/
file.rs

1use crate::size::{ConfigSize, LegacySizeUnit};
2use serde::{Deserialize, Serialize};
3use utoipa::ToSchema;
4
5crate::size_setting!(size_buffer_size, "buffer_size", LegacySizeUnit::Bytes);
6
7/// Configuration for reading data from a file with `FileInputTransport`
8#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
9pub struct FileInputConfig {
10    /// File path.
11    ///
12    /// This may be a file name or a `file://` URL with an absolute path.
13    pub path: String,
14
15    /// Read buffer size, such as `"64Ki"`.
16    ///
17    /// Default: when this parameter is not specified, a platform-specific
18    /// default is used.
19    ///
20    /// Before release 0.367.0 this setting was `buffer_size_bytes`, a number
21    /// of bytes. That name is deprecated but still read.
22    #[serde(
23        default,
24        alias = "buffer_size_bytes",
25        deserialize_with = "size_buffer_size",
26        skip_serializing_if = "Option::is_none"
27    )]
28    #[schema(value_type = Option<String>)]
29    pub buffer_size: Option<ConfigSize>,
30
31    /// Enable file following.
32    ///
33    /// When `false`, the endpoint outputs an `InputConsumer::eoi`
34    /// message and stops upon reaching the end of file.  When `true`, the
35    /// endpoint will keep watching the file and outputting any new content
36    /// appended to it.
37    #[serde(default)]
38    pub follow: bool,
39}
40
41/// Configuration for writing data to a file with `FileOutputTransport`.
42#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
43pub struct FileOutputConfig {
44    /// File path.
45    pub path: String,
46}