Struct sp_runtime::offchain::LimitedExternalities
source · [−]pub struct LimitedExternalities<T> { /* private fields */ }
Expand description
An OffchainExternalities
implementation with limited capabilities.
Implementations
sourceimpl<T> LimitedExternalities<T>
impl<T> LimitedExternalities<T>
sourcepub fn new(
capabilities: Capabilities,
externalities: T
) -> LimitedExternalities<T>
pub fn new(
capabilities: Capabilities,
externalities: T
) -> LimitedExternalities<T>
Create new externalities limited to given capabilities
.
Trait Implementations
sourceimpl<T> Externalities for LimitedExternalities<T> where
T: Externalities,
impl<T> Externalities for LimitedExternalities<T> where
T: Externalities,
sourcepub fn is_validator(&self) -> bool
pub fn is_validator(&self) -> bool
Returns if the local node is a potential validator. Read more
sourcepub fn network_state(&self) -> Result<OpaqueNetworkState, ()>
pub fn network_state(&self) -> Result<OpaqueNetworkState, ()>
Returns information about the local node’s network state.
sourcepub fn sleep_until(&mut self, deadline: Timestamp)
pub fn sleep_until(&mut self, deadline: Timestamp)
Pause the execution until deadline
is reached.
sourcepub fn local_storage_set(&mut self, kind: StorageKind, key: &[u8], value: &[u8])
pub fn local_storage_set(&mut self, kind: StorageKind, key: &[u8], value: &[u8])
Sets a value in the local storage. Read more
sourcepub fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8])
pub fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8])
Removes a value in the local storage. Read more
sourcepub fn local_storage_compare_and_set(
&mut self,
kind: StorageKind,
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool
pub fn local_storage_compare_and_set(
&mut self,
kind: StorageKind,
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool
Sets a value in the local storage if it matches current value. Read more
sourcepub fn local_storage_get(
&mut self,
kind: StorageKind,
key: &[u8]
) -> Option<Vec<u8, Global>>
pub fn local_storage_get(
&mut self,
kind: StorageKind,
key: &[u8]
) -> Option<Vec<u8, Global>>
Gets a value from the local storage. Read more
sourcepub fn http_request_start(
&mut self,
method: &str,
uri: &str,
meta: &[u8]
) -> Result<HttpRequestId, ()>
pub fn http_request_start(
&mut self,
method: &str,
uri: &str,
meta: &[u8]
) -> Result<HttpRequestId, ()>
Initiates a http request given HTTP verb and the URL. Read more
sourcepub fn http_request_add_header(
&mut self,
request_id: HttpRequestId,
name: &str,
value: &str
) -> Result<(), ()>
pub fn http_request_add_header(
&mut self,
request_id: HttpRequestId,
name: &str,
value: &str
) -> Result<(), ()>
Append header to the request. Read more
sourcepub fn http_request_write_body(
&mut self,
request_id: HttpRequestId,
chunk: &[u8],
deadline: Option<Timestamp>
) -> Result<(), HttpError>
pub fn http_request_write_body(
&mut self,
request_id: HttpRequestId,
chunk: &[u8],
deadline: Option<Timestamp>
) -> Result<(), HttpError>
Write a chunk of request body. Read more
sourcepub fn http_response_wait(
&mut self,
ids: &[HttpRequestId],
deadline: Option<Timestamp>
) -> Vec<HttpRequestStatus, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn http_response_wait(
&mut self,
ids: &[HttpRequestId],
deadline: Option<Timestamp>
) -> Vec<HttpRequestStatus, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Block and wait for the responses for given requests. Read more
sourcepub fn http_response_headers(
&mut self,
request_id: HttpRequestId
) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn http_response_headers(
&mut self,
request_id: HttpRequestId
) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Read all response headers. Read more
sourcepub fn http_response_read_body(
&mut self,
request_id: HttpRequestId,
buffer: &mut [u8],
deadline: Option<Timestamp>
) -> Result<usize, HttpError>
pub fn http_response_read_body(
&mut self,
request_id: HttpRequestId,
buffer: &mut [u8],
deadline: Option<Timestamp>
) -> Result<usize, HttpError>
Read a chunk of body response to given buffer. Read more
Set the authorized nodes from runtime. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for LimitedExternalities<T> where
T: RefUnwindSafe,
impl<T> Send for LimitedExternalities<T> where
T: Send,
impl<T> Sync for LimitedExternalities<T> where
T: Sync,
impl<T> Unpin for LimitedExternalities<T> where
T: Unpin,
impl<T> UnwindSafe for LimitedExternalities<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedConversion for T
impl<T> CheckedConversion for T
sourcefn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
sourcefn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
sourcefn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
sourcefn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcepub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
sourceimpl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
sourcepub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.