pub struct SawtoothToTransactHandlerAdapter<H: SawtoothTransactionHandler + Send> { /* private fields */ }
Expand description
Adapts a Sawtooth Transaction Handler to a Transact TransactionHandler.
This adapter allows Sawtooth SDK TransactionHandler implementations to be used with the Transact static execution adapters. Existing Sawtooth transaction families and smart contract engines can then be compiled in to an application using Transact.
For example, the Sawtooth transaction handler for the XO Transaction Family can be adapted as follows:
let execution_adapter = StaticExecutionAdapter::new_adapter(
vec![Box::new(SawtoothToTransactHandlerAdapter::new(
XoTransactionHandler::new(),
))],
context_manager,
);
Implementations§
Trait Implementations§
source§impl<H: SawtoothTransactionHandler + Send> TransactionHandler for SawtoothToTransactHandlerAdapter<H>
impl<H: SawtoothTransactionHandler + Send> TransactionHandler for SawtoothToTransactHandlerAdapter<H>
source§fn family_name(&self) -> &str
fn family_name(&self) -> &str
TransactionHandler that defines the business logic for a new transaction family.
The family_name, family_versions, and namespaces functions are
used by the processor to route processing requests to the handler.
family_name should return the name of the transaction family that this
handler can process, e.g. “intkey”
source§fn family_versions(&self) -> &[String]
fn family_versions(&self) -> &[String]
family_versions should return a list of versions this transaction
family handler can process, e.g. [“1.0”]
source§fn apply(
&self,
transaction_pair: &TransactionPair,
context: &mut dyn TransactionContext
) -> Result<(), ApplyError>
fn apply( &self, transaction_pair: &TransactionPair, context: &mut dyn TransactionContext ) -> Result<(), ApplyError>
Apply is the single method where all the business logic for a
transaction family is defined. The method will be called by the
transaction processor upon receiving a TpProcessRequest that the
handler understands and will pass in the TpProcessRequest and an
initialized instance of the Context type.
Auto Trait Implementations§
impl<H> RefUnwindSafe for SawtoothToTransactHandlerAdapter<H>where
H: RefUnwindSafe,
impl<H> Send for SawtoothToTransactHandlerAdapter<H>
impl<H> Sync for SawtoothToTransactHandlerAdapter<H>where
H: Sync,
impl<H> Unpin for SawtoothToTransactHandlerAdapter<H>where
H: Unpin,
impl<H> UnwindSafe for SawtoothToTransactHandlerAdapter<H>where
H: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
Convert
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
Convert
&self
to an expression for Diesel’s query builder. Read more§impl<T> SafeBorrow<T> for Twhere
T: ?Sized,
impl<T> SafeBorrow<T> for Twhere
T: ?Sized,
§fn borrow_replacement(ptr: &T) -> &T
fn borrow_replacement(ptr: &T) -> &T
Given
ptr
, which was obtained from a prior call to Self::borrow()
,
return a value with the same nominal lifetime which is guaranteed to
survive mutations to Self
. Read more