TransactionPipe

Struct TransactionPipe 

Source
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, implementing InstructionDecoderCollection.
  • U: The output type for the matched data, if schema-matching, implementing DeserializeOwned.

§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 (return true) will be processed. If this collection is empty, all updates are processed.

Implementations§

Source§

impl<T: InstructionDecoderCollection, U> TransactionPipe<T, U>

Source

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,

Source§

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,

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V