Skip to main content

FileSourceConfig

Struct FileSourceConfig 

Source
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: String

A 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: FileSourceFormat

File 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: CompressionConfig

Compression codec. auto (default) resolves per file from its suffix (.gz, .zst).

§recursive: bool

Descend into subdirectories when path is a directory.

§concurrency: usize

Files opened ahead of the one being decoded (ordered prefetch). 0 reads serially.

§batch_size: usize

Records 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: bool

Refuse (instead of skipping with a warning) a file whose extension names no format under format: auto.

§max_object_bytes: u64

Largest 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: u32

Retries for a failed HTTP request (connection error, 429, 5xx), with exponential backoff that honours Retry-After.

§http_connect_timeout_secs: u64

Seconds to wait for an HTTP connection to open. A timeout is retried.

§http_read_timeout_secs: u64

Seconds 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: CsvOptions

CSV dialect, used for CSV files.

§excel: ExcelOptions

Worksheet selection, used for Excel files.

§xml: XmlOptions

Record framing, used for XML files.

§avro: AvroOptions

Reader schema, used for Avro files.

§orc: OrcOptions

Column projection, used for ORC files.

§parquet: ParquetReadOptions

Column projection, used for Parquet files.

§encryption: Option<EncryptionSpec>
Available on crate feature 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

Source

pub fn new(path: impl Into<String>) -> Self

A config reading path with every default.

Source

pub fn format(self, format: FileSourceFormat) -> Self

Set the format.

Source

pub fn recursive(self, recursive: bool) -> Self

Descend into subdirectories.

Source

pub fn with_batch_size(self, batch_size: usize) -> Self

Set the records per page.

Source

pub fn incremental(self, by: IncrementalBy) -> Self

Turn on incremental mode.

Source

pub fn is_http(&self) -> bool

Whether path is an http(s):// URL.

Source

pub fn parquet_columns<I, S>(self, columns: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Project Parquet files to columns.

Source

pub fn encryption_set(&self) -> bool

Whether an encryption block is set.

Source

pub fn format_options(&self) -> FormatOptions

The per-format option blocks. CSV is strict about ragged rows unless csv.flexible says otherwise.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileSourceConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FileSourceConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for FileSourceConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for FileSourceConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more