Skip to main content

MessageDriver

Trait MessageDriver 

Source
pub trait MessageDriver: Send + Sync {
Show 15 methods // Required methods fn connector_name(&self) -> &'static str; fn encode(&self, record: &Value) -> Result<OutboundMessage, FaucetError>; fn publish<'life0, 'life1, 'async_trait>( &'life0 self, calls: &'life1 CallSlot, group: Vec<OutboundMessage>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RowOutcome>, FaucetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn config_schema(&self) -> Value { ... } fn dataset_uri(&self) -> String { ... } fn call_context(&self) -> CallContext { ... } fn check<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, calls: &'life1 CallSlot, ctx: &'life2 CheckContext, ) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn batch_atomicity(&self) -> BatchAtomicity { ... } fn group_size(&self) -> usize { ... } fn group_timeout(&self) -> Option<Duration> { ... } fn connect<'life0, 'life1, 'async_trait>( &'life0 self, calls: &'life1 CallSlot, ) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn flush<'life0, 'life1, 'async_trait>( &'life0 self, calls: &'life1 CallSlot, ) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn transactions(&self) -> Option<&dyn MessageTransactions> { ... } fn publish_is_one_call(&self) -> bool { ... } fn page_error( &self, offered: usize, failed: &[(usize, FaucetError)], ) -> Option<FaucetError> { ... }
}
Expand description

A producer’s primitives (RFC 0014). Wrap it in a MessageSinkDriver, then a DriverSink.

Required Methods§

Source

fn connector_name(&self) -> &'static str

The connector’s name.

Source

fn encode(&self, record: &Value) -> Result<OutboundMessage, FaucetError>

The message for record. An error fails that row alone.

Source

fn publish<'life0, 'life1, 'async_trait>( &'life0 self, calls: &'life1 CallSlot, group: Vec<OutboundMessage>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RowOutcome>, FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Publish a group, returning one outcome per message (Ok once the backend confirmed it). An Err is a transport failure of the whole page.

Provided Methods§

Source

fn config_schema(&self) -> Value

The JSON Schema of the connector’s config.

Source

fn dataset_uri(&self) -> String

The destination, for lineage (credential-free).

Source

fn call_context(&self) -> CallContext

The connector’s own call defaults.

Source

fn check<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, calls: &'life1 CallSlot, ctx: &'life2 CheckContext, ) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

A non-mutating preflight probe.

Source

fn batch_atomicity(&self) -> BatchAtomicity

What a failed write leaves behind.

Source

fn group_size(&self) -> usize

Records per publish group; 0 publishes the whole page as one.

Source

fn group_timeout(&self) -> Option<Duration>

How long one group may take. On expiry its unconfirmed rows, and every row after them, fail with a retriable timeout. None: only the run’s call deadline applies.

Source

fn connect<'life0, 'life1, 'async_trait>( &'life0 self, calls: &'life1 CallSlot, ) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open the connection, once; called before the first group of every page and before a flush. Default: nothing to open.

Source

fn flush<'life0, 'life1, 'async_trait>( &'life0 self, calls: &'life1 CallSlot, ) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Make published messages durable (wait for the client’s buffer).

Source

fn transactions(&self) -> Option<&dyn MessageTransactions>

The transaction primitives, for exactly-once.

Source

fn publish_is_one_call(&self) -> bool

Whether the adapter runs each publish and flush as one backend call (op publish / flush, bounded by group_timeout and the run’s call context). Return false for a driver whose publish makes its own calls through the slot — its own op labels, request chunking, retries and bounds; the adapter then awaits it directly. Default: true.

Source

fn page_error( &self, offered: usize, failed: &[(usize, FaucetError)], ) -> Option<FaucetError>

The error a whole-page write (the plain and reported paths) fails with when rows of offered failed, given (index, error) for each in index order. None (the default): the first failed row’s own error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§