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§
Sourcefn connector_name(&self) -> &'static str
fn connector_name(&self) -> &'static str
The connector’s name.
Sourcefn encode(&self, record: &Value) -> Result<OutboundMessage, FaucetError>
fn encode(&self, record: &Value) -> Result<OutboundMessage, FaucetError>
The message for record. An error fails that row alone.
Sourcefn 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,
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§
Sourcefn config_schema(&self) -> Value
fn config_schema(&self) -> Value
The JSON Schema of the connector’s config.
Sourcefn dataset_uri(&self) -> String
fn dataset_uri(&self) -> String
The destination, for lineage (credential-free).
Sourcefn call_context(&self) -> CallContext
fn call_context(&self) -> CallContext
The connector’s own call defaults.
Sourcefn 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 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.
Sourcefn batch_atomicity(&self) -> BatchAtomicity
fn batch_atomicity(&self) -> BatchAtomicity
What a failed write leaves behind.
Sourcefn group_size(&self) -> usize
fn group_size(&self) -> usize
Records per publish group; 0 publishes the whole page as one.
Sourcefn group_timeout(&self) -> Option<Duration>
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.
Sourcefn 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 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.
Sourcefn 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 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).
Sourcefn transactions(&self) -> Option<&dyn MessageTransactions>
fn transactions(&self) -> Option<&dyn MessageTransactions>
The transaction primitives, for exactly-once.
Sourcefn publish_is_one_call(&self) -> bool
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.
Sourcefn page_error(
&self,
offered: usize,
failed: &[(usize, FaucetError)],
) -> Option<FaucetError>
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".