TransmissionResult

Struct TransmissionResult 

Source
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: true if ANY rows succeeded, false if ALL rows failed or batch-level error occurred
  • error: Batch-level error (e.g., authentication failure, connection error before processing)
    • None if no batch-level error occurred (even if some rows failed)
  • failed_rows: Per-row failures
    • None if all rows succeeded
    • Some(vec![]) if batch-level error only (no per-row processing occurred)
    • Some(vec![...]) for per-row failures
  • successful_rows: Per-row successes
    • None if all rows failed
    • Some(vec![]) if no rows succeeded
    • Some(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 equals successful_rows.len() if Some)
  • failed_count: Number of rows that failed (always equals failed_rows.len() if Some)

§Edge Cases

  • Empty batch (total_rows == 0): Returns success=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: bool

Whether 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: u32

Number of retry attempts made

§latency_ms: Option<u64>

Transmission latency in milliseconds (if successful)

§batch_size_bytes: usize

Size of transmitted batch in bytes

§failed_rows: Option<Vec<(usize, ZerobusError)>>

Indices of rows that failed, along with their specific errors

  • None if all rows succeeded
  • Some(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 batch
  • error: Specific ZerobusError describing why the row failed
§successful_rows: Option<Vec<usize>>

Indices of rows that were successfully written

  • None if all rows failed
  • Some(vec![]) if no rows succeeded
  • Some(vec![row_idx, ...]) for successful rows

Each value is a 0-based index of the successful row in the original batch.

§total_rows: usize

Total number of rows in the batch

Always equals successful_count + failed_count. For empty batches, this is 0.

§successful_count: usize

Number of rows that succeeded

Always equals successful_rows.len() if successful_rows is Some.

§failed_count: usize

Number of rows that failed

Always equals failed_rows.len() if failed_rows is Some.

Implementations§

Source§

impl TransmissionResult

Source

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.

Source

pub fn has_failed_rows(&self) -> bool

Check if there are any failed rows

Returns true if failed_rows contains any entries.

Source

pub fn has_successful_rows(&self) -> bool

Check if there are any successful rows

Returns true if successful_rows contains any entries.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn get_failed_row_indices_by_error_type<F>( &self, predicate: F, ) -> Vec<usize>
where F: Fn(&ZerobusError) -> bool,

Get indices of failed rows filtered by error type

§Arguments
  • predicate - A closure that returns true for errors that should be included
§Returns

Returns a vector of row indices for failed rows that match the predicate.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> TransmissionResult

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransmissionResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,