Skip to main content

next_file_index

Function next_file_index 

Source
pub(crate) fn next_file_index(
    parquet_root: &Path,
    asset: u32,
    channel: u8,
    date: NaiveDate,
) -> usize
Expand description

Scans a channel/day directory to find the next available Parquet file index.

Every entry whose name starts with part-<number> counts, including .inprogress and quarantined files, so a new file never reuses their index. The directory is created if it does not exist.

§Arguments

  • parquet_root - Root output directory.
  • asset - Asset number for the asset<NNN> directory.
  • channel - LabJack channel for the ch<NN> directory.
  • date - UTC date for the date directory.

§Returns

One more than the highest existing part index, or 1 for an empty directory.

§Panics

Panics if the directory cannot be created or read.