Struct transact::sawtooth::SawtoothToTransactHandlerAdapter [−][src]
pub struct SawtoothToTransactHandlerAdapter<H: SawtoothTransactionHandler + Send> { /* fields omitted */ }
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
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” Read more
family_versions should return a list of versions this transaction family handler can process, e.g. [“1.0”] Read more
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. Read more
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
Mutably borrows from an owned value. Read more
Convert self
to an expression for Diesel’s query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self
to an expression for Diesel’s query builder. Read more
impl<T> SafeBorrow<T> for T where
T: ?Sized,
impl<T> SafeBorrow<T> for T where
T: ?Sized,
pub fn borrow_replacement(ptr: &T) -> &T
pub 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