Expand description
§Databricks Zerobus Ingest SDK
A high-performance Rust client for streaming data ingestion into Databricks Delta tables.
§Quick Start
ⓘ
use databricks_zerobus_ingest_sdk::{ZerobusSdk, JsonValue};
let sdk = ZerobusSdk::builder()
.endpoint(zerobus_endpoint)
.unity_catalog_url(uc_endpoint)
.build()?;
let mut stream = sdk
.stream_builder()
.table("catalog.schema.table")
.oauth(client_id, client_secret)
.json()
.build()
.await?;
// Idiomatic flow: ingest in a loop, then flush() once to confirm the batch.
for my_record in records {
stream.ingest_record_offset(JsonValue(my_record)).await?;
}
stream.flush().await?; // Returns once every queued record is acknowledged.
stream.close().await?;See the examples/ directory for complete working examples.
Modules§
- schema
- Convert a Unity Catalog table schema into a protobuf
DescriptorProto. - stream_
options - Shared configuration options for stream creation and operation.
- zeroparser
- Zero-copy, single-pass protobuf parser driven by a
prost_types::DescriptorProto.
Structs§
- Arrow
Schema - Describes the meta-data of an ordered sequence of relative types.
- Arrow
Stream Configuration Options - Configuration options for Arrow Flight stream creation and operation.
- Avro
Bytes - Wrapper for a pre-encoded Avro binary datum (Beta).
- Avro
Record - Wrapper for an Avro record the stream encodes against its writer schema (Beta).
- Batch
Records - Records of one encoding held by an
EncodedBatch. - Batch
Records Into Iter - Owning iterator over
BatchRecords. - Batch
Stats - Byte-size and count stats for an encoded batch.
- Callback
Handler Harness - Test-only harness driving the real callback handler task and teardown
without a gRPC connection. Wires up the same
spawn_callback_handler_task+ channel asZerobusStream::new_stream, and itsteardown()runs the productionZerobusStream::shutdown_callback_task, so tests exercise the ack callback lifetime contract against real code. - Channel
Exporter - A
StatsExporterthat forwards events to a bounded channel, dropping (and counting) events when the channel is full or closed so telemetry never blocks ingestion. Drain the paired receiver fromchannel_exporter. - Default
Token Factory - Default OAuth 2.0 token factory for Unity Catalog authentication.
- Dynamic
Message DynamicMessageprovides encoding, decoding and reflection of a protobuf message.- Dynamic
Record - A protobuf record built field-by-field against a runtime
MessageDescriptor, thenencoded to wire bytes and ingested. - Federated
Token Provider - A headers provider that federates an external IdP token into a Zerobus-scoped Databricks token via the RFC 8693 token-exchange grant.
- Field
- Describes a single column in a
Schema. - Grpc
Status - A gRPC status that the Zerobus server or the SDK reports for a failed stream.
- IdpToken
Supplier - A source of external IdP tokens, paired with a stable cache identity.
- Json
String - Wrapper for pre-serialized JSON strings.
- Json
Value - Wrapper for JSON-serializable objects with automatic serialization.
- Message
Descriptor - A protobuf message definition.
- Message
Id - Opaque identifier returned by ingest methods on gRPC and Arrow mux streams. Encodes the sub-stream index and sub-stream offset in a single i64.
- Multiplexed
Arrow Stream - Distributes whole Arrow batches round-robin across Arrow Flight streams.
- Multiplexed
Stream - Distributes ingestion round-robin across a fixed set of
ZerobusStreams. - Multiplexed
Stream Builder - Terminal builder for a
MultiplexedStreamor an Arrow Flight mux. - NoAuth
Headers Provider - A headers provider that returns no headers.
- NoTls
Config - No-op TLS configuration for testing with plaintext
http://endpoints. - OAuth
Headers Provider - The default headers provider that uses OAuth 2.0 with Unity Catalog.
- Offset
IdGenerator - Generates monotonically increasing offset IDs for ingested records.
- Persistent
Stream - A durable, recoverable ingestion stream (Eos).
- Persistent
Stream Builder - A fluent builder for creating or resuming persistent (Eos) streams.
- Proto
Bytes - Wrapper for pre-serialized protobuf bytes.
- Proto
Message - Wrapper for protobuf messages with automatic serialization.
- Proxy
Connector - A proxy connector for Zerobus gRPC transport channels, including Arrow Flight.
- Record
Batch - A two-dimensional batch of column-oriented data with a defined schema.
- Secure
TlsConfig - Secure TLS configuration using system CA certificates.
- Stream
Builder - A fluent builder for creating Zerobus ingestion streams.
- Stream
Configuration Options - Configuration options for stream creation, recovery of broken streams and flushing.
- TlsSettings
- Describes the TLS setup of a gRPC channel.
- Zerobus
Arrow Stream - An Arrow Flight stream for ingesting Arrow RecordBatches into a Delta table.
- Zerobus
Sdk - The main interface for interacting with the Zerobus API.
- Zerobus
SdkBuilder - Builder for creating a
ZerobusSdkinstance with fluent configuration. - Zerobus
Stream - Represents an active ingestion stream to a Databricks Delta table.
Enums§
- Arrow
Compression - Compression for Arrow Flight payloads.
- Arrow
Dictionary Handling - How an Arrow Flight stream sends dictionary-encoded columns.
- Avro
Value - A valid Avro value.
- Data
Type - Datatypes supported by this implementation of Apache Arrow.
- Encoded
Batch - Encoded
Batch Iter - Encoded
Record - Grpc
Code - A gRPC status code.
- Reconnect
Reason - Why a stream reconnected.
- Record
Type - Record encoding of a JSON, Protocol Buffers, or Avro stream.
- Schema
Validation Cause - A machine-readable cause of a schema-validation rejection, reported by the
server in the gRPC
ErrorInfometadata (as stable string tokens) and decoded here into typed variants. - Stream
Stat - A telemetry event emitted by a stream. Owned and
Clone, so an event can be forwarded across a channel directly (seeChannelExporter). NotCopyorEq—Reconnectedcarries aZerobusError, which is neither. - Stream
Type - The type of the stream connection created with the server.
- Time
Unit - An absolute length of time in seconds, milliseconds, microseconds or nanoseconds.
- Value
- A dynamically-typed protobuf value.
- Zerobus
Error - Represents all possible errors that can occur when using Zerobus.
Constants§
- DEFAULT_
SDK_ IDENTIFIER - Default identifier the SDK sends as the HTTP
user-agentheader on every request. UseZerobusSdkBuilder::application_nameto append an application suffix.
Traits§
- AckCallback
- Callback trait for receiving acknowledgment notifications.
- Headers
Provider - A trait for providing custom headers for gRPC requests.
- Into
Dynamic Value - Converts a Rust type into a protobuf
ValueforDynamicRecord::set. - Stats
Exporter - Sink for stream telemetry. Register with
.stats_exporter(...)on the builder. - TlsConfig
- Trait for TLS configuration strategies.
Functions§
- channel_
exporter - Creates a
ChannelExporterwith a bounded buffer ofcapacityevents and returns it with the receiver to drain concurrently.NonZeroUsizeprevents a zero-capacity channel. The receiver ends after all exporter clones, including those owned by streams and their IO tasks, are dropped and queued events are drained. - message_
descriptor - Resolve a
MessageDescriptorfrom aprost_types::DescriptorProto, to pass toStreamBuilder::dynamic_proto. - missing_
required_ fields - Full paths of any proto2
requiredfields absent frommessage, descending into nested messages, list elements, and map values. Empty if none are missing.prost-reflectfollows proto3 semantics and does not enforce this on encode, so callers check it before sending records the server would reject.
Type Aliases§
- Avro
Encoded Record - A type alias for an Avro-encoded record.
- Connector
Factory - Signature for caller-supplied proxy selection. Given the target host,
return a configured connector or
Nonefor a direct connection. - IdpToken
Callback - An async callback that yields the current external IdP token (for example an Entra ID / OIDC JWT).
- Json
Encoded Record - A type alias for a JSON-encoded record.
- Offset
Id - Offset ID type representing a logical (or physical) position in the stream.
- Proto
Encoded Record - A type alias for a protobuf-encoded record.
- Zerobus
Result