pub struct FileSourceConfig {Show 23 fields
pub path: String,
pub format: FileSourceFormat,
pub compression: CompressionConfig,
pub recursive: bool,
pub concurrency: usize,
pub batch_size: usize,
pub incremental: Option<IncrementalSpec>,
pub stable_for_secs: Option<u64>,
pub strict: bool,
pub max_object_bytes: u64,
pub max_decoded_bytes: Option<u64>,
pub max_files: Option<usize>,
pub headers: BTreeMap<String, String>,
pub http_retries: u32,
pub http_connect_timeout_secs: u64,
pub http_read_timeout_secs: u64,
pub csv: CsvOptions,
pub excel: ExcelOptions,
pub xml: XmlOptions,
pub avro: AvroOptions,
pub orc: OrcOptions,
pub parquet: ParquetReadOptions,
pub encryption: Option<EncryptionSpec>,
}Expand description
Configuration for the local (and http(s)://) file source.
Experimental (PRINCIPLES.md §3): this block’s shape may change in a minor release; any change is called out in the changelog.
Fields§
§path: StringA file, a directory, a glob (data/**/*.jsonl), or one http:// /
https:// URL. A directory lists its regular files (descending into
subdirectories with recursive: true); every listing is sorted by path.
format: FileSourceFormatFile format, auto (by extension, per file) by default. Under auto
a file with no recognised extension is skipped with a warning, or
refused when strict: true. JSON Lines, Avro, ORC and Parquet stream;
JSON arrays, CSV, XML and Excel are read whole per file.
compression: CompressionConfigCompression codec. auto (default) resolves per file from its suffix
(.gz, .zst).
recursive: boolDescend into subdirectories when path is a directory.
concurrency: usizeFiles opened ahead of the one being decoded (ordered prefetch). 0
reads serially.
batch_size: usizeRecords per emitted page. 0 emits one page per file.
incremental: Option<IncrementalSpec>Read only files that are new since the previous run. Needs a
pipeline state: block; the bookmark is kept under file:<path>.
stable_for_secs: Option<u64>Skip files modified less than this many seconds ago — files still being written. They are read by a later run once they settle.
strict: boolRefuse (instead of skipping with a warning) a file whose extension
names no format under format: auto.
max_object_bytes: u64Largest file, once decompressed, that a format read whole (JSON array, XML, Excel, compressed or remote Avro/ORC/Parquet, encrypted files) may reach; a larger one fails with an error instead of exhausting memory. Default 2 GiB.
max_decoded_bytes: Option<u64>Most bytes one object may decode to in memory where a format can
expand past its input: an Avro file’s records (per batch where the file
streams), an Excel workbook’s parts and shared strings. A file past it
fails with an error instead of exhausting memory. Default 64 ×
max_object_bytes, at most 16 GiB.
max_files: Option<usize>Read at most this many files (after sorting and filtering).
headers: BTreeMap<String, String>Request headers for an http(s):// path (e.g. Authorization).
http_retries: u32Retries for a failed HTTP request (connection error, 429, 5xx), with
exponential backoff that honours Retry-After.
http_connect_timeout_secs: u64Seconds to wait for an HTTP connection to open. A timeout is retried.
http_read_timeout_secs: u64Seconds an HTTP response may go without sending a byte — waiting for the headers or mid-body. A timeout before the body starts is retried; one mid-body fails the file.
csv: CsvOptionsCSV dialect, used for CSV files.
excel: ExcelOptionsWorksheet selection, used for Excel files.
xml: XmlOptionsRecord framing, used for XML files.
avro: AvroOptionsReader schema, used for Avro files.
orc: OrcOptionsColumn projection, used for ORC files.
parquet: ParquetReadOptionsColumn projection, used for Parquet files.
encryption: Option<EncryptionSpec>encryption only.Decrypt files sealed by the file or jsonl sink’s encryption block
(AES-256-GCM). An encrypted file is read into memory whole: JSON Lines
and raw text written line by line are then opened one line at a time,
every other file as one sealed body. A file that is not sealed fails
the read.
Implementations§
Source§impl FileSourceConfig
impl FileSourceConfig
Sourcepub fn format(self, format: FileSourceFormat) -> Self
pub fn format(self, format: FileSourceFormat) -> Self
Set the format.
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Set the records per page.
Sourcepub fn incremental(self, by: IncrementalBy) -> Self
pub fn incremental(self, by: IncrementalBy) -> Self
Turn on incremental mode.
Sourcepub fn parquet_columns<I, S>(self, columns: I) -> Self
pub fn parquet_columns<I, S>(self, columns: I) -> Self
Project Parquet files to columns.
Sourcepub fn encryption_set(&self) -> bool
pub fn encryption_set(&self) -> bool
Whether an encryption block is set.
Sourcepub fn format_options(&self) -> FormatOptions
pub fn format_options(&self) -> FormatOptions
The per-format option blocks. CSV is strict about ragged rows unless
csv.flexible says otherwise.
Sourcepub fn validate(&self) -> Result<(), FaucetError>
pub fn validate(&self) -> Result<(), FaucetError>
Load-time checks: batch size bounds, a non-empty path, a parseable Avro reader schema, and header names/values HTTP can carry.
Trait Implementations§
Source§impl Clone for FileSourceConfig
impl Clone for FileSourceConfig
Source§impl Debug for FileSourceConfig
impl Debug for FileSourceConfig
Source§impl<'de> Deserialize<'de> for FileSourceConfig
impl<'de> Deserialize<'de> for FileSourceConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for FileSourceConfig
impl JsonSchema for FileSourceConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more