spate_avro/lib.rs
1//! Avro deserialization for the Spate framework.
2//!
3//! Decodes bare Avro datums as carried by Kafka messages — Confluent wire
4//! format (magic byte + schema id + datum), Avro single-object encoding,
5//! or raw datums with a fixed schema — into either dynamically-typed
6//! [`AvroValue`] records or your own serde types
7//! ([`AvroSerdeDeserializer`]).
8//!
9//! # Never block the pipeline thread
10//!
11//! Registry schemas are fetched by an asynchronous task on the I/O
12//! runtime and cached per process. A payload whose schema is not cached
13//! yet reports "not ready": the operator chain holds the batch (the
14//! source is paused by backpressure if needed) and replays the payload
15//! once the fetch lands — records are never dropped or duplicated, and
16//! the CPU-pinned pipeline threads never perform I/O. Ids the registry
17//! cannot serve are negatively cached (with a TTL) and handled by the
18//! deserializer's `ErrorPolicy` like any other poison payload.
19//!
20//! # Schema evolution
21//!
22//! Writer schemas come from the payload (registry id or fingerprint) or
23//! configuration; an optional `reader_schema` pins the shape records are
24//! resolved into, using Avro's schema-resolution rules (field reordering,
25//! defaults, promotions, aliases). Registry schemas using references are
26//! not supported yet and are surfaced as unavailable.
27
28mod cache;
29mod config;
30mod deser;
31mod registry;
32mod wire;
33
34pub use config::{
35 AvroConfigError, AvroDeserializerBuilder, AvroMode, AvroSettings, RegistrySection, SchemaSource,
36};
37pub use deser::{AvroSerdeDeserializer, AvroValue, AvroValueDeserializer};
38pub use wire::{parse_confluent, parse_single_object};