Struct sp_runtime::offchain::LimitedExternalities
source · pub struct LimitedExternalities<T> { /* private fields */ }
Expand description
An *Externalities
implementation with limited capabilities.
Implementations§
source§impl<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§
source§impl<T> DbExternalities for LimitedExternalities<T>where
T: DbExternalities,
impl<T> DbExternalities for LimitedExternalities<T>where T: DbExternalities,
source§fn local_storage_set(&mut self, kind: StorageKind, key: &[u8], value: &[u8])
fn local_storage_set(&mut self, kind: StorageKind, key: &[u8], value: &[u8])
Sets a value in the local storage. Read more
source§fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8])
fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8])
Removes a value in the local storage. Read more
source§fn local_storage_compare_and_set(
&mut self,
kind: StorageKind,
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool
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
source§fn local_storage_get(
&mut self,
kind: StorageKind,
key: &[u8]
) -> Option<Vec<u8, Global>>
fn local_storage_get( &mut self, kind: StorageKind, key: &[u8] ) -> Option<Vec<u8, Global>>
Gets a value from the local storage. Read more
source§impl<T> Externalities for LimitedExternalities<T>where
T: Externalities,
impl<T> Externalities for LimitedExternalities<T>where T: Externalities,
source§fn is_validator(&self) -> bool
fn is_validator(&self) -> bool
Returns if the local node is a potential validator. Read more
source§fn network_state(&self) -> Result<OpaqueNetworkState, ()>
fn network_state(&self) -> Result<OpaqueNetworkState, ()>
Returns information about the local node’s network state.
source§fn sleep_until(&mut self, deadline: Timestamp)
fn sleep_until(&mut self, deadline: Timestamp)
Pause the execution until
deadline
is reached.source§fn http_request_start(
&mut self,
method: &str,
uri: &str,
meta: &[u8]
) -> Result<HttpRequestId, ()>
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
source§fn http_request_add_header(
&mut self,
request_id: HttpRequestId,
name: &str,
value: &str
) -> Result<(), ()>
fn http_request_add_header( &mut self, request_id: HttpRequestId, name: &str, value: &str ) -> Result<(), ()>
Append header to the request. Read more
source§fn http_request_write_body(
&mut self,
request_id: HttpRequestId,
chunk: &[u8],
deadline: Option<Timestamp>
) -> Result<(), HttpError>
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
source§fn http_response_wait(
&mut self,
ids: &[HttpRequestId],
deadline: Option<Timestamp>
) -> Vec<HttpRequestStatus, Global>
fn http_response_wait( &mut self, ids: &[HttpRequestId], deadline: Option<Timestamp> ) -> Vec<HttpRequestStatus, Global>
Block and wait for the responses for given requests. Read more
source§fn http_response_headers(
&mut self,
request_id: HttpRequestId
) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
fn http_response_headers( &mut self, request_id: HttpRequestId ) -> Vec<(Vec<u8, Global>, Vec<u8, Global>), Global>
Read all response headers. Read more
source§fn http_response_read_body(
&mut self,
request_id: HttpRequestId,
buffer: &mut [u8],
deadline: Option<Timestamp>
) -> Result<usize, HttpError>
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§
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>,
Consume self to return an equivalent value of
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
The counterpart to
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
Consume self to return an equivalent value of
T
.