Skip to main content

validate_batch_size

Function validate_batch_size 

Source
pub fn validate_batch_size(batch_size: usize) -> Result<usize, FaucetError>
Expand description

Validate a batch_size value against the global constraints.

batch_size = 0 is the opt-out-of-batching sentinel: sources and sinks should treat it as “emit / accept the entire result set in one page.” This is useful for small lookup tables or for sinks (e.g. SQL COPY, BigQuery load jobs) that prefer one large request to many small ones. Any non-zero value above MAX_BATCH_SIZE is rejected to prevent accidental unbounded buffering through a typo.

Returns the unchanged value on success. Returns FaucetError::Config only for values strictly greater than MAX_BATCH_SIZE.