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 (messages to be communicated to other workers).
Implementations§
Source§impl<T> ValidatorWorkerClient<T>where
T: GrpcService<Body>,
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<Body>,
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<Body>, Response = Response<<T as GrpcService<Body>>::ResponseBody>>,
<T as Service<Request<Body>>>::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.
pub async fn handle_confirmed_certificate( &mut self, request: impl IntoRequest<HandleConfirmedCertificateRequest>, ) -> Result<Response<ChainInfoResult>, Status>
pub async fn handle_validated_certificate( &mut self, request: impl IntoRequest<HandleValidatedCertificateRequest>, ) -> Result<Response<ChainInfoResult>, Status>
pub async fn handle_timeout_certificate( &mut self, request: impl IntoRequest<HandleTimeoutCertificateRequest>, ) -> Result<Response<ChainInfoResult>, Status>
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 download_pending_blob(
&mut self,
request: impl IntoRequest<PendingBlobRequest>,
) -> Result<Response<PendingBlobResult>, Status>
pub async fn download_pending_blob( &mut self, request: impl IntoRequest<PendingBlobRequest>, ) -> Result<Response<PendingBlobResult>, Status>
Download a blob that belongs to a pending block on the given chain.
Sourcepub async fn handle_pending_blob(
&mut self,
request: impl IntoRequest<HandlePendingBlobRequest>,
) -> Result<Response<ChainInfoResult>, Status>
pub async fn handle_pending_blob( &mut self, request: impl IntoRequest<HandlePendingBlobRequest>, ) -> Result<Response<ChainInfoResult>, Status>
Handle a blob that belongs to a pending block on the given 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.
Sourcepub async fn previous_event_blocks(
&mut self,
request: impl IntoRequest<PreviousEventBlocksRequest>,
) -> Result<Response<PreviousEventBlocksResponse>, Status>
pub async fn previous_event_blocks( &mut self, request: impl IntoRequest<PreviousEventBlocksRequest>, ) -> Result<Response<PreviousEventBlocksResponse>, Status>
Returns the previous event blocks for a chain’s streams.
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>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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> UnsafeUnpin for ValidatorWorkerClient<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ValidatorWorkerClient<T>where
T: UnwindSafe,
Blanket Implementations§
impl<_INNER> AutoTraits for _INNER
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Requestimpl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSync for Twhere
T: Sync,
impl<T> Post for Twhere
T: Send + 'static,
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.