Skip to main content

serve_export_request

Function serve_export_request 

Source
pub(crate) async fn serve_export_request<S: ExportSink + Send>(
    parquet_root: &Path,
    sink: &mut S,
    req: &ExportRequest,
) -> Result<()>
Expand description

Validates a request and streams its CSV response through an export sink.

Sorts and deduplicates the channels, checks the range and format, sends the meta frame, then streams every channel with CsvStreamer and finishes with summary and complete. Unlike process_nats_request, validation failures are returned as errors for the caller to report.

§Arguments

  • parquet_root - Root of the Parquet archive.
  • sink - Transport that receives the frames.
  • req - Export request; cloned before normalization.

§Errors

Returns an error if no channels are requested, if start or end is not RFC 3339, if end is before start, if the format is not CSV, if a channel’s day directory cannot be listed, or if the sink fails to send.