pub struct TransmissionResult {
pub success: bool,
pub error: Option<ZerobusError>,
pub attempts: u32,
pub latency_ms: Option<u64>,
pub batch_size_bytes: usize,
pub failed_rows: Option<Vec<(usize, ZerobusError)>>,
pub successful_rows: Option<Vec<usize>>,
pub total_rows: usize,
pub successful_count: usize,
pub failed_count: usize,
}Expand description
Result of a data transmission operation
This struct provides comprehensive information about the result of sending a batch to Zerobus, including per-row success/failure tracking and error details.
§Per-Row Error Tracking
The struct supports per-row error tracking, allowing identification of which specific rows succeeded or failed during batch transmission. This enables:
- Partial batch success: Some rows can succeed while others fail
- Quarantine workflows: Extract and quarantine only failed rows
- Error analysis: Group errors by type, analyze patterns, track statistics
§Field Semantics
success:trueif ANY rows succeeded,falseif ALL rows failed or batch-level error occurrederror: Batch-level error (e.g., authentication failure, connection error before processing)Noneif no batch-level error occurred (even if some rows failed)
failed_rows: Per-row failuresNoneif all rows succeededSome(vec![])if batch-level error only (no per-row processing occurred)Some(vec![...])for per-row failures
successful_rows: Per-row successesNoneif all rows failedSome(vec![])if no rows succeededSome(vec![...])for successful rows
total_rows: Total number of rows in the batch (0 for empty batches)successful_count: Number of rows that succeeded (always equalssuccessful_rows.len()ifSome)failed_count: Number of rows that failed (always equalsfailed_rows.len()ifSome)
§Edge Cases
- Empty batch (
total_rows == 0): Returnssuccess=true,successful_count=0,failed_count=0 - Batch-level errors: Authentication/connection errors before processing return
error=Some(...),failed_rows=None - All rows failed: Returns
success=false,failed_rows=Some([...]),successful_rows=None - All rows succeeded: Returns
success=true,failed_rows=None,successful_rows=Some([...])
§Examples
use arrow_zerobus_sdk_wrapper::{ZerobusWrapper, WrapperConfiguration};
use arrow::record_batch::RecordBatch;
let result = wrapper.send_batch(batch.clone()).await?;
// Check for partial success
if result.is_partial_success() {
// Extract failed rows for quarantine
if let Some(failed_batch) = result.extract_failed_batch(&batch) {
// Quarantine failed_batch
}
// Extract successful rows for writing
if let Some(successful_batch) = result.extract_successful_batch(&batch) {
// Write successful_batch to main table
}
}
// Analyze error patterns
let stats = result.get_error_statistics();
println!("Success rate: {:.1}%", stats.success_rate * 100.0);
Fields§
§success: boolWhether transmission succeeded
true if ANY rows succeeded, false if ALL rows failed or batch-level error occurred.
error: Option<ZerobusError>Error information if transmission failed at batch level
Batch-level errors occur before per-row processing (e.g., authentication failure,
connection error). If Some, indicates no per-row processing occurred.
attempts: u32Number of retry attempts made
latency_ms: Option<u64>Transmission latency in milliseconds (if successful)
batch_size_bytes: usizeSize of transmitted batch in bytes
failed_rows: Option<Vec<(usize, ZerobusError)>>Indices of rows that failed, along with their specific errors
Noneif all rows succeededSome(vec![])if batch-level error only (no per-row processing occurred)Some(vec![(row_idx, error), ...])for per-row failures
Each tuple contains:
row_idx: 0-based index of the failed row in the original batcherror: SpecificZerobusErrordescribing why the row failed
successful_rows: Option<Vec<usize>>Indices of rows that were successfully written
Noneif all rows failedSome(vec![])if no rows succeededSome(vec![row_idx, ...])for successful rows
Each value is a 0-based index of the successful row in the original batch.
total_rows: usizeTotal number of rows in the batch
Always equals successful_count + failed_count.
For empty batches, this is 0.
successful_count: usizeNumber of rows that succeeded
Always equals successful_rows.len() if successful_rows is Some.
failed_count: usizeNumber of rows that failed
Always equals failed_rows.len() if failed_rows is Some.
Implementations§
Source§impl TransmissionResult
impl TransmissionResult
Sourcepub fn is_partial_success(&self) -> bool
pub fn is_partial_success(&self) -> bool
Check if this result represents a partial success (some rows succeeded, some failed)
Returns true if there are both successful and failed rows.
Sourcepub fn has_failed_rows(&self) -> bool
pub fn has_failed_rows(&self) -> bool
Check if there are any failed rows
Returns true if failed_rows contains any entries.
Sourcepub fn has_successful_rows(&self) -> bool
pub fn has_successful_rows(&self) -> bool
Check if there are any successful rows
Returns true if successful_rows contains any entries.
Sourcepub fn get_failed_row_indices(&self) -> Vec<usize>
pub fn get_failed_row_indices(&self) -> Vec<usize>
Get indices of failed rows
Returns a vector of row indices that failed, or empty vector if none failed.
Sourcepub fn get_successful_row_indices(&self) -> Vec<usize>
pub fn get_successful_row_indices(&self) -> Vec<usize>
Get indices of successful rows
Returns a vector of row indices that succeeded, or empty vector if none succeeded.
Sourcepub fn extract_failed_batch(
&self,
original_batch: &RecordBatch,
) -> Option<RecordBatch>
pub fn extract_failed_batch( &self, original_batch: &RecordBatch, ) -> Option<RecordBatch>
Extract a RecordBatch containing only the failed rows from the original batch
§Arguments
original_batch- The original RecordBatch that was sent
§Returns
Returns Some(RecordBatch) containing only the failed rows, or None if there are no failed rows.
Rows are extracted in the order they appear in failed_rows.
Sourcepub fn extract_successful_batch(
&self,
original_batch: &RecordBatch,
) -> Option<RecordBatch>
pub fn extract_successful_batch( &self, original_batch: &RecordBatch, ) -> Option<RecordBatch>
Extract a RecordBatch containing only the successful rows from the original batch
§Arguments
original_batch- The original RecordBatch that was sent
§Returns
Returns Some(RecordBatch) containing only the successful rows, or None if there are no successful rows.
Rows are extracted in the order they appear in successful_rows.
Sourcepub fn get_failed_row_indices_by_error_type<F>(
&self,
predicate: F,
) -> Vec<usize>
pub fn get_failed_row_indices_by_error_type<F>( &self, predicate: F, ) -> Vec<usize>
Sourcepub fn group_errors_by_type(&self) -> HashMap<String, Vec<usize>>
pub fn group_errors_by_type(&self) -> HashMap<String, Vec<usize>>
Group failed rows by error type
§Returns
Returns a HashMap where keys are error type names (e.g., “ConversionError”) and values are vectors of row indices that failed with that error type.
Sourcepub fn get_error_statistics(&self) -> ErrorStatistics
pub fn get_error_statistics(&self) -> ErrorStatistics
Get error statistics for this transmission result
§Returns
Returns an ErrorStatistics struct containing comprehensive error analysis
including success/failure rates and error type counts.
Sourcepub fn get_error_messages(&self) -> Vec<String>
pub fn get_error_messages(&self) -> Vec<String>
Get all error messages from failed rows
§Returns
Returns a vector of error message strings for all failed rows.
Trait Implementations§
Source§impl Clone for TransmissionResult
impl Clone for TransmissionResult
Source§fn clone(&self) -> TransmissionResult
fn clone(&self) -> TransmissionResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TransmissionResult
impl RefUnwindSafe for TransmissionResult
impl Send for TransmissionResult
impl Sync for TransmissionResult
impl Unpin for TransmissionResult
impl UnwindSafe for TransmissionResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request