Skip to main content

IpcError

Enum IpcError 

Source
#[non_exhaustive]
pub enum IpcError {
Show 27 variants Io { context: &'static str, source: Error, }, Data(DataError), UnexpectedEndOfStream { context: &'static str, available: usize, expected: usize, }, InvalidContinuation { marker: u32, position: usize, }, NegativeMetadataLength { length: i32, position: usize, }, TooLarge { what: &'static str, length: u64, cap: u64, }, MalformedFlatbuffer { context: &'static str, position: usize, }, MissingField { table: &'static str, field: &'static str, }, UnsupportedMetadataVersion { version: i16, }, UnsupportedEndianness { endianness: i16, }, UnsupportedMessageHeader { header: u8, name: &'static str, }, UnexpectedMessage { expected: &'static str, found: &'static str, }, EmptyStream, UnsupportedType { code: u8, name: &'static str, field: String, }, UnsupportedTypeParameters { family: &'static str, field: String, detail: String, }, ChildCountMismatch { field: String, family: &'static str, expected: usize, actual: usize, }, LayoutCountMismatch { what: &'static str, expected: usize, actual: usize, }, BufferOutOfBounds { index: usize, offset: i64, length: i64, body_len: usize, }, BufferTooShort { index: usize, role: &'static str, actual: usize, required: usize, rows: usize, }, InvalidFieldNode { index: usize, length: i64, null_count: i64, }, RowCountMismatch { declared: usize, column: usize, actual: usize, }, UnsupportedCompression { codec: i8, }, UnsupportedDictionary, NotASinglePayload { count: usize, }, NestingTooDeep { depth: usize, limit: usize, }, MissingSchema, SchemaMismatch { index: usize, },
}
Expand description

A failure encoding or decoding an Arrow IPC stream.

#[non_exhaustive]: the append-only evolution rule (blueprint §3.4) applies to error enums too.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Io

The underlying reader or writer failed.

Fields

§context: &'static str

What the layer was doing when the I/O failed.

§source: Error

The originating error.

§

Data(DataError)

An array could not be rebuilt from its decoded buffers.

§

UnexpectedEndOfStream

The stream ended in the middle of a message.

Fields

§context: &'static str

What the decoder was reading.

§available: usize

Bytes still available.

§expected: usize

Bytes the decoder needed.

§

InvalidContinuation

The 4-byte word introducing a message was neither the continuation marker nor a plausible legacy length.

Fields

§marker: u32

The word that was read.

§position: usize

Byte offset of the word within the stream.

§

NegativeMetadataLength

The encapsulated-message header declared a negative metadata length.

Fields

§length: i32

The declared length.

§position: usize

Byte offset of the length prefix.

§

TooLarge

A declared length exceeded the configured cap.

Fields

§what: &'static str

Which length was too large (“metadata”, “body”, “payload”).

§length: u64

The declared length.

§cap: u64

The cap that was exceeded.

§

MalformedFlatbuffer

The flatbuffer metadata is structurally invalid.

Fields

§context: &'static str

What the reader was trying to do.

§position: usize

Byte offset within the metadata block.

§

MissingField

A required flatbuffer field was absent.

Fields

§table: &'static str

The flatbuffer table name, as in Schema.fbs/Message.fbs.

§field: &'static str

The absent field name.

§

UnsupportedMetadataVersion

Message.version named a metadata version this decoder does not read.

Fields

§version: i16

The raw enum value.

§

UnsupportedEndianness

Schema.endianness was big-endian.

Fields

§endianness: i16

The raw enum value.

§

UnsupportedMessageHeader

Message.header_type named a message kind AstRS does not implement.

Fields

§header: u8

The raw union discriminant.

§name: &'static str

A human-readable name for the discriminant.

§

UnexpectedMessage

A message of the wrong kind turned up where another was required.

Fields

§expected: &'static str

The message the decoder needed.

§found: &'static str

The message it found.

§

EmptyStream

The stream carried no schema message.

§

UnsupportedType

Field.type named a type outside the closed P0 set (blueprint §6.1).

Fields

§code: u8

The raw Type union discriminant.

§name: &'static str

A human-readable name for the discriminant.

§field: String

The field that carried it.

§

UnsupportedTypeParameters

A supported type family carried an unsupported parameter — a 96-bit integer, a microsecond timestamp, a time zone.

Fields

§family: &'static str

The type family (Int, Timestamp, …).

§field: String

The field that carried it.

§detail: String

What exactly is unsupported.

§

ChildCountMismatch

A nested type declared the wrong number of children.

Fields

§field: String

The field name.

§family: &'static str

The type family.

§expected: usize

Children the type requires.

§actual: usize

Children the message declared.

§

LayoutCountMismatch

The record batch declared fewer field nodes or buffers than the schema needs, or left some unconsumed.

Fields

§what: &'static str

"field node(s)" or "buffer(s)".

§expected: usize

What the schema implies.

§actual: usize

What the message declared.

§

BufferOutOfBounds

A Buffer entry pointed outside the message body.

Fields

§index: usize

Index within the buffers vector.

§offset: i64

Declared body-relative offset.

§length: i64

Declared length.

§body_len: usize

Actual body length.

§

BufferTooShort

A buffer was shorter than the field node’s row count requires.

Fields

§index: usize

Index within the buffers vector.

§role: &'static str

"validity", "offsets" or "values".

§actual: usize

Bytes the buffer holds.

§required: usize

Bytes the layout requires.

§rows: usize

Row count from the field node.

§

InvalidFieldNode

A FieldNode declared a negative or absurd length.

Fields

§index: usize

Index within the nodes vector.

§length: i64

Declared length.

§null_count: i64

Declared null count.

§

RowCountMismatch

Columns of a record batch disagreed with RecordBatch.length.

Fields

§declared: usize

RecordBatch.length.

§column: usize

The offending column index.

§actual: usize

The column’s own length.

§

UnsupportedCompression

The body carried a compression codec; AstRS negotiates compression at the route level instead (blueprint §6.4).

Fields

§codec: i8

The raw CompressionType value.

§

UnsupportedDictionary

A dictionary-encoded field or a DictionaryBatch message turned up.

§

NotASinglePayload

decode_payload requires exactly one record batch.

Fields

§count: usize

Batches found in the stream.

§

NestingTooDeep

A type nested deeper than the codec’s recursion limit.

Both codecs recurse, so an unbounded nesting depth is a stack overflow waiting for a hostile stream; the limit is MAX_NESTING_DEPTH.

Fields

§depth: usize

The depth reached.

§limit: usize

The configured limit.

§

MissingSchema

write_ipc_stream was handed no batches, so it has no schema to open the stream with.

§

SchemaMismatch

A batch’s schema differs from the one the stream opened with.

The streaming format has exactly one schema message, so every batch must match it. Use one stream per schema, or cast the batch first.

Fields

§index: usize

Position of the offending batch within the stream.

Implementations§

Source§

impl IpcError

Source

pub fn io(context: &'static str, source: Error) -> Self

Wraps an I/O error with the operation that produced it.

Source

pub const fn malformed(context: &'static str, position: usize) -> Self

Source

pub const fn missing(table: &'static str, field: &'static str) -> Self

Source

pub const fn is_malformed(&self) -> bool

Returns true when the error means “the input bytes are not a valid Arrow IPC stream”, as opposed to an I/O failure or an unsupported but well-formed feature.

Route supervisors use this to decide between retrying a leg and declaring a producer broken.

use astrs_data::ipc::IpcError;

let malformed = IpcError::malformed("reading a vtable", 12);
assert!(malformed.is_malformed());
assert!(!IpcError::UnsupportedDictionary.is_malformed());
Source

pub const fn is_unsupported(&self) -> bool

Returns true when the stream is well-formed Arrow that carries a feature outside the AstRS 0.1.0 set (blueprint §6.1).

use astrs_data::ipc::IpcError;

assert!(IpcError::UnsupportedDictionary.is_unsupported());

Trait Implementations§

Source§

impl Debug for IpcError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for IpcError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for IpcError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<DataError> for IpcError

Source§

fn from(source: DataError) -> Self

Converts to this type from the input type.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.