pub trait ProcessTransaction {
    const IS_TRANSACTIONAL: bool;

    // Required method
    fn process<F>(f: F) -> Result<(), XcmError>
       where F: FnOnce() -> Result<(), XcmError>;
}
Expand description

Provides mechanisms for transactional processing of XCM instructions.

This trait defines the behavior required to process XCM instructions in a transactional manner. Implementers of this trait can ensure that XCM instructions are executed atomically, meaning they either fully succeed or fully fail without any partial effects.

Implementers of this trait can also choose to not process XCM instructions transactionally. This is useful for cases where the implementer is not able to provide transactional guarantees. In this case the IS_TRANSACTIONAL constant should be set to false. The () type implements this trait in a non-transactional manner.

Required Associated Constants§

source

const IS_TRANSACTIONAL: bool

Whether or not the implementor of the this trait is actually transactional.

Required Methods§

source

fn process<F>(f: F) -> Result<(), XcmError>
where F: FnOnce() -> Result<(), XcmError>,

Processes an XCM instruction encapsulated within the provided closure. Responsible for processing an XCM instruction transactionally. If the closure returns an error, any changes made during its execution should be rolled back. In the case where the implementer is not able to provide transactional guarantees, the closure should be executed as is.

§Parameters
  • f: A closure that encapsulates the XCM instruction being processed. It will return a Result indicating the success or failure of the instruction.
§Returns
  • A Result indicating the overall success or failure of the transactional process.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ProcessTransaction for ()

source§

const IS_TRANSACTIONAL: bool = false

source§

fn process<F>(f: F) -> Result<(), XcmError>
where F: FnOnce() -> Result<(), XcmError>,

Implementors§