Skip to main content

Axon

Trait Axon 

Source
pub trait Axon<T, C>: Send + Sync
where T: Send + Sync + 'static, C: Codec<T> + CodecName + Send + Sync + 'static,
{ // Required methods fn react( &mut self, reactants: Vec<Box<dyn Reactant<T, C> + Send + Sync + 'static>>, ) -> Pin<Box<dyn Future<Output = Result<(), AxonError>> + Send + '_>>; fn transmit( &mut self, data: T, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>; fn transmit_with_trace( &mut self, data: T, trace_context: TraceContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>; fn transmit_erased( &mut self, data: T, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>; fn transmit_erased_with_trace( &mut self, data: T, trace_context: TraceContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>; fn neuron_name(&self) -> String; // Provided methods fn transmit_with_timeout( &mut self, data: T, timeout_duration: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>> { ... } fn transmit_with_trace_with_timeout( &mut self, data: T, trace_context: TraceContext, timeout_duration: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>> { ... } fn transmit_batch( &mut self, data_items: Vec<T>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<()>>, AxonError>> + Send + '_>> { ... } fn transmit_batch_with_trace( &mut self, data_items: Vec<T>, trace_context: TraceContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<()>>, AxonError>> + Send + '_>> { ... } fn is_ready(&self) -> bool { ... } fn status(&self) -> String { ... } }
Expand description

Trait for axon operations with typed neurons and data

Required Methods§

Source

fn react( &mut self, reactants: Vec<Box<dyn Reactant<T, C> + Send + Sync + 'static>>, ) -> Pin<Box<dyn Future<Output = Result<(), AxonError>> + Send + '_>>

React to incoming reactants using the neuron

Source

fn transmit( &mut self, data: T, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>

Transmit data through the neuron and ganglion

Source

fn transmit_with_trace( &mut self, data: T, trace_context: TraceContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>

Transmit data with explicit tracing context.

Source

fn transmit_erased( &mut self, data: T, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>

Transmit data through the neuron and ganglion using type erasure

Source

fn transmit_erased_with_trace( &mut self, data: T, trace_context: TraceContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>

Transmit data using type erasure with explicit tracing context.

Source

fn neuron_name(&self) -> String

Get the neuron name

Provided Methods§

Source

fn transmit_with_timeout( &mut self, data: T, timeout_duration: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>

Transmit data with a timeout

Source

fn transmit_with_trace_with_timeout( &mut self, data: T, trace_context: TraceContext, timeout_duration: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>

Transmit data with a trace and timeout

Source

fn transmit_batch( &mut self, data_items: Vec<T>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<()>>, AxonError>> + Send + '_>>

Transmit multiple data items in batch

Source

fn transmit_batch_with_trace( &mut self, data_items: Vec<T>, trace_context: TraceContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<()>>, AxonError>> + Send + '_>>

Transmit multiple data items in batch with trace

Source

fn is_ready(&self) -> bool

Check if the axon is ready for transmission (convenience method)

Source

fn status(&self) -> String

Get a formatted status string for debugging

Implementors§

Source§

impl<T, C> Axon<T, C> for AxonImpl<T, C>
where T: Send + Sync + 'static, C: Codec<T> + CodecName + Send + Sync + 'static,