pub struct ValidatorWorkerClient<T> { /* private fields */ }
Expand description
Interface provided by each physical shard (aka “worker”) of a validator or a local node.
- All commands return either the current chain info or an error.
- Repeating commands produces no changes and returns no error.
- Some handlers may return cross-chain requests, that is, messages to be communicated to other workers of the same validator.
Implementations§
Source§impl<T> ValidatorWorkerClient<T>where
T: GrpcService<BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<T> ValidatorWorkerClient<T>where
T: GrpcService<BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
pub fn new(inner: T) -> Self
pub fn with_origin(inner: T, origin: Uri) -> Self
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ValidatorWorkerClient<InterceptedService<T, F>>where
F: Interceptor,
T::ResponseBody: Default,
T: Service<Request<BoxBody>, Response = Response<<T as GrpcService<BoxBody>>::ResponseBody>>,
<T as Service<Request<BoxBody>>>::Error: Into<StdError> + Send + Sync,
Sourcepub fn send_compressed(self, encoding: CompressionEncoding) -> Self
pub fn send_compressed(self, encoding: CompressionEncoding) -> Self
Compress requests with the given encoding.
This requires the server to support it otherwise it might respond with an error.
Sourcepub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
Enable decompressing responses.
Sourcepub fn max_decoding_message_size(self, limit: usize) -> Self
pub fn max_decoding_message_size(self, limit: usize) -> Self
Limits the maximum size of a decoded message.
Default: 4MB
Sourcepub fn max_encoding_message_size(self, limit: usize) -> Self
pub fn max_encoding_message_size(self, limit: usize) -> Self
Limits the maximum size of an encoded message.
Default: usize::MAX
Sourcepub async fn handle_block_proposal(
&mut self,
request: impl IntoRequest<BlockProposal>,
) -> Result<Response<ChainInfoResult>, Status>
pub async fn handle_block_proposal( &mut self, request: impl IntoRequest<BlockProposal>, ) -> Result<Response<ChainInfoResult>, Status>
Propose a new block.
Sourcepub async fn handle_lite_certificate(
&mut self,
request: impl IntoRequest<LiteCertificate>,
) -> Result<Response<ChainInfoResult>, Status>
pub async fn handle_lite_certificate( &mut self, request: impl IntoRequest<LiteCertificate>, ) -> Result<Response<ChainInfoResult>, Status>
Process a certificate without value.
Sourcepub async fn handle_certificate(
&mut self,
request: impl IntoRequest<HandleCertificateRequest>,
) -> Result<Response<ChainInfoResult>, Status>
pub async fn handle_certificate( &mut self, request: impl IntoRequest<HandleCertificateRequest>, ) -> Result<Response<ChainInfoResult>, Status>
Process a certificate.
Sourcepub async fn handle_chain_info_query(
&mut self,
request: impl IntoRequest<ChainInfoQuery>,
) -> Result<Response<ChainInfoResult>, Status>
pub async fn handle_chain_info_query( &mut self, request: impl IntoRequest<ChainInfoQuery>, ) -> Result<Response<ChainInfoResult>, Status>
Handle information queries for this chain.
Sourcepub async fn handle_cross_chain_request(
&mut self,
request: impl IntoRequest<CrossChainRequest>,
) -> Result<Response<()>, Status>
pub async fn handle_cross_chain_request( &mut self, request: impl IntoRequest<CrossChainRequest>, ) -> Result<Response<()>, Status>
Handle a (trusted!) cross-chain request.
Trait Implementations§
Source§impl<T: Clone> Clone for ValidatorWorkerClient<T>
impl<T: Clone> Clone for ValidatorWorkerClient<T>
Source§fn clone(&self) -> ValidatorWorkerClient<T>
fn clone(&self) -> ValidatorWorkerClient<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<T> !Freeze for ValidatorWorkerClient<T>
impl<T> RefUnwindSafe for ValidatorWorkerClient<T>where
T: RefUnwindSafe,
impl<T> Send for ValidatorWorkerClient<T>where
T: Send,
impl<T> Sync for ValidatorWorkerClient<T>where
T: Sync,
impl<T> Unpin for ValidatorWorkerClient<T>where
T: Unpin,
impl<T> UnwindSafe for ValidatorWorkerClient<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
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>
Converts
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>
Converts
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<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
Source§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length
bytes from memory from the provided location
.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes
to memory at the provided location
.