| Crates.io | batch-mode-batch-triple |
| lib.rs | batch-mode-batch-triple |
| version | 0.2.2 |
| created_at | 2025-02-27 05:45:47.633556+00 |
| updated_at | 2025-07-13 10:37:35.744165+00 |
| description | Manages batch file triples (input, output, error, metadata) in batch processing systems, including file validation, error handling, and file movement. |
| homepage | |
| repository | https://github.com/klebs6/klebs-general |
| max_upload_size | |
| id | 1571337 |
| size | 162,316 |
The batch-mode-batch-triple crate provides the BatchFileTriple structure and associated methods for managing and processing batch files within a batch processing system. It integrates with the rest of the batch-mode ecosystem to handle batch file states, perform error handling, validate file consistency, and move batch files to a "done" directory upon completion.
You can create a new BatchFileTriple with a set of requests and specify a workspace for file management.
use batch_mode_batch_triple::BatchFileTriple;
use batch_mode_batch_workspace_interface::BatchWorkspaceInterface;
use std::sync::Arc;
let workspace: Arc<dyn BatchWorkspaceInterface> = // obtain workspace
let batch_triple = BatchFileTriple::new_with_requests(&requests, workspace)?;
Use the ensure_input_matches_output_and_error method to validate that input, output, and error files have matching request IDs.
batch_triple.ensure_input_matches_output_and_error().await?;
Log errors in the batch processing workflow with the log_errors method.
batch_triple.log_errors(&error_data).await?;
Retry failed requests using the retry_failed_requests method:
batch_triple.retry_failed_requests(&error_data).await?;
After processing a batch, you can move the batch files to a "done" directory.
batch_triple.move_input_and_output_to_done().await?;
Ensure that the input file matches the output file:
batch_triple.ensure_input_matches_output().await?;
Ensure that the input file matches the error file:
batch_triple.ensure_input_matches_error().await?;
The crate uses custom error types for managing batch file processing errors:
BatchErrorProcessingError: Errors encountered while processing batch error files.BatchValidationError: Errors related to validation, such as mismatched request IDs.FileMoveError: Errors encountered when moving files to the "done" directory.This crate is licensed under the MIT License. See LICENSE for details.