pub struct RemoteExternalities<B: BlockT> {
pub inner_ext: TestExternalities<HashingFor<B>>,
pub block_hash: B::Hash,
}
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.
block_hash: B::Hash
The block hash it 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, Global>>, H, LocalTrieCache<H>>>
pub fn ext( &mut self ) -> Ext<'_, H, TrieBackend<MemoryDB<H, PrefixedKey<H>, Vec<u8, Global>>, H, LocalTrieCache<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)where
I: IntoIterator<Item = (Vec<u8, Global>, Vec<u8, Global>)>,
pub fn batch_insert<I>(&mut self, kvs: I)where I: IntoIterator<Item = (Vec<u8, Global>, Vec<u8, Global>)>,
Batch insert key/values into backend
sourcepub fn insert_child(
&mut self,
c: ChildInfo,
k: Vec<u8, Global>,
v: Vec<u8, Global>
)
pub fn insert_child( &mut self, c: ChildInfo, k: Vec<u8, Global>, v: Vec<u8, Global> )
Insert key/value into backend.
This only supports inserting keys in child tries.
sourcepub fn register_extension<E>(&mut self, ext: E)where
E: Any + Extension,
pub fn register_extension<E>(&mut self, ext: E)where E: Any + Extension,
Registers the given extension for this instance.
sourcepub fn as_backend(
&self
) -> TrieBackend<MemoryDB<H, PrefixedKey<H>, Vec<u8, Global>>, H, LocalTrieCache<H>>
pub fn as_backend( &self ) -> TrieBackend<MemoryDB<H, PrefixedKey<H>, Vec<u8, Global>>, H, LocalTrieCache<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
.
Trait Implementations§
source§impl<B: BlockT> Deref for RemoteExternalities<B>
impl<B: BlockT> Deref for RemoteExternalities<B>
Auto Trait Implementations§
impl<B> !RefUnwindSafe for RemoteExternalities<B>
impl<B> Send for RemoteExternalities<B>
impl<B> !Sync for RemoteExternalities<B>
impl<B> Unpin for RemoteExternalities<B>where <B as Block>::Hash: Unpin, <<B as Block>::Header as Header>::Hashing: Unpin,
impl<B> !UnwindSafe for RemoteExternalities<B>
Blanket Implementations§
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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§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 Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.