pub struct TransactionPipe<T: InstructionDecoderCollection, U> { /* private fields */ }
Expand description
A pipe for processing transactions based on a defined schema and processor.
The TransactionPipe
parses a transaction’s instructions, optionally checks
them against the schema, and runs the processor if the instructions match
the schema. It provides methods for parsing nested instructions and matching
transaction data to the schema.
§Generics
T
: The instruction type, implementingInstructionDecoderCollection
.U
: The output type for the matched data, if schema-matching, implementingDeserializeOwned
.
§Fields
schema
: The schema against which to match transaction instructions.processor
: The processor that will handle matched transaction data.filters
: A collection of filters that determine which transaction updates should be processed. Each filter in this collection is applied to incoming transaction updates, and only updates that pass all filters (returntrue
) will be processed. If this collection is empty, all updates are processed.
Implementations§
Source§impl<T: InstructionDecoderCollection, U> TransactionPipe<T, U>
impl<T: InstructionDecoderCollection, U> TransactionPipe<T, U>
Sourcepub fn new(
schema: Option<TransactionSchema<T>>,
processor: impl Processor<InputType = TransactionProcessorInputType<T, U>> + Send + Sync + 'static,
filters: Vec<Box<dyn Filter + Send + Sync + 'static>>,
) -> Self
pub fn new( schema: Option<TransactionSchema<T>>, processor: impl Processor<InputType = TransactionProcessorInputType<T, U>> + Send + Sync + 'static, filters: Vec<Box<dyn Filter + Send + Sync + 'static>>, ) -> Self
Creates a new TransactionPipe
with the specified schema and processor.
§Parameters
schema
: The schema against which to match transaction instructions.processor
: The processor that will handle matched transaction data.filters
: A collection of filters for selective processing of transaction updates. Filters can be used to selectively process transactions based on criteria such as datasource ID, transaction type, or other custom logic.
§Returns
A TransactionPipe
instance configured with the specified schema and
processor.
Trait Implementations§
Source§impl<T, U> TransactionPipes<'_> for TransactionPipe<T, U>where
T: InstructionDecoderCollection + Sync + 'static,
U: DeserializeOwned + Send + Sync + 'static,
impl<T, U> TransactionPipes<'_> for TransactionPipe<T, U>where
T: InstructionDecoderCollection + Sync + 'static,
U: DeserializeOwned + Send + Sync + 'static,
fn run<'life0, 'life1, 'async_trait>(
&'life0 mut self,
transaction_metadata: Arc<TransactionMetadata>,
instructions: &'life1 [NestedInstruction],
metrics: Arc<MetricsCollection>,
) -> Pin<Box<dyn Future<Output = CarbonResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn filters(&self) -> &Vec<Box<dyn Filter + Send + Sync + 'static>>
Auto Trait Implementations§
impl<T, U> Freeze for TransactionPipe<T, U>
impl<T, U> !RefUnwindSafe for TransactionPipe<T, U>
impl<T, U> Send for TransactionPipe<T, U>
impl<T, U> Sync for TransactionPipe<T, U>
impl<T, U> Unpin for TransactionPipe<T, U>
impl<T, U> !UnwindSafe for TransactionPipe<T, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more