pub struct RemoteExternalities<B: BlockT> {
pub inner_ext: TestExternalities<HashingFor<B>>,
pub header: B::Header,
}
Expand description
An externalities that acts exactly the same as sp_io::TestExternalities
but has a few extra
bits and pieces to it, and can be loaded remotely.
Fields§
§inner_ext: TestExternalities<HashingFor<B>>
The inner externalities.
header: B::Header
The block header which we created this externality env.
Methods from Deref<Target = TestExternalities<HashingFor<B>>>§
Sourcepub fn ext(
&mut self,
) -> Ext<'_, H, TrieBackend<MemoryDB<H, PrefixedKey<H>, Vec<u8>>, H>>
pub fn ext( &mut self, ) -> Ext<'_, H, TrieBackend<MemoryDB<H, PrefixedKey<H>, Vec<u8>>, H>>
Get externalities implementation.
Sourcepub fn overlayed_changes(&self) -> &OverlayedChanges<H>
pub fn overlayed_changes(&self) -> &OverlayedChanges<H>
Returns the overlayed changes.
Sourcepub fn persist_offchain_overlay(&mut self)
pub fn persist_offchain_overlay(&mut self)
Move offchain changes from overlay to the persistent store.
Sourcepub fn offchain_db(&self) -> TestPersistentOffchainDB
pub fn offchain_db(&self) -> TestPersistentOffchainDB
A shared reference type around the offchain worker storage.
Sourcepub fn batch_insert<I>(&mut self, kvs: I)
pub fn batch_insert<I>(&mut self, kvs: I)
Batch insert key/values into backend
Sourcepub fn insert_child(&mut self, c: ChildInfo, k: Vec<u8>, v: Vec<u8>)
pub fn insert_child(&mut self, c: ChildInfo, k: Vec<u8>, v: Vec<u8>)
Insert key/value into backend.
This only supports inserting keys in child tries.
Sourcepub fn register_extension<E>(&mut self, ext: E)
pub fn register_extension<E>(&mut self, ext: E)
Registers the given extension for this instance.
Sourcepub fn as_backend(
&mut self,
) -> TrieBackend<MemoryDB<H, PrefixedKey<H>, Vec<u8>>, H>
pub fn as_backend( &mut self, ) -> TrieBackend<MemoryDB<H, PrefixedKey<H>, Vec<u8>>, H>
Return a new backend with all pending changes.
In contrast to commit_all
this will not panic if there are open
transactions.
Sourcepub fn commit_all(&mut self) -> Result<(), String>
pub fn commit_all(&mut self) -> Result<(), String>
Commit all pending changes to the underlying backend.
§Panic
This will panic if there are still open transactions.
Sourcepub fn execute_with<R>(&mut self, execute: impl FnOnce() -> R) -> R
pub fn execute_with<R>(&mut self, execute: impl FnOnce() -> R) -> R
Execute the given closure while self
is set as externalities.
Returns the result of the given closure.
Sourcepub fn execute_and_prove<R>(
&mut self,
execute: impl FnOnce() -> R,
) -> (R, StorageProof)
pub fn execute_and_prove<R>( &mut self, execute: impl FnOnce() -> R, ) -> (R, StorageProof)
Execute the given closure while self
, with proving_backend
as backend, is set as
externalities.
This implementation will wipe the proof recorded in between calls. Consecutive calls will get their own proof from scratch.
Sourcepub fn execute_with_safe<R>(
&mut self,
f: impl FnOnce() -> R + UnwindSafe,
) -> Result<R, String>
pub fn execute_with_safe<R>( &mut self, f: impl FnOnce() -> R + UnwindSafe, ) -> Result<R, String>
Execute the given closure while self
is set as externalities.
Returns the result of the given closure, if no panics occurred.
Otherwise, returns Err
.
Sourcepub fn eq(&mut self, other: &mut TestExternalities<H>) -> bool
pub fn eq(&mut self, other: &mut TestExternalities<H>) -> bool
This doesn’t test if they are in the same state, only if they contains the same data at this state
Trait Implementations§
Source§impl<B: BlockT> Deref for RemoteExternalities<B>
impl<B: BlockT> Deref for RemoteExternalities<B>
Auto Trait Implementations§
impl<B> !Freeze for RemoteExternalities<B>
impl<B> !RefUnwindSafe for RemoteExternalities<B>
impl<B> Send for RemoteExternalities<B>
impl<B> !Sync for RemoteExternalities<B>
impl<B> Unpin for RemoteExternalities<B>
impl<B> !UnwindSafe for RemoteExternalities<B>
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
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.