Struct smoldot_full_node::Client
source · pub struct Client { /* private fields */ }
Expand description
Running client. As long as this object is alive, the client reads/writes the database and has a JSON-RPC server open.
Implementations§
source§impl Client
impl Client
sourcepub fn json_rpc_server_addr(&self) -> Option<SocketAddr>
pub fn json_rpc_server_addr(&self) -> Option<SocketAddr>
Returns the address the JSON-RPC server is listening on.
Returns None
if and only if ChainConfig::json_rpc_listen
was None
in Config::chain
.
sourcepub fn relay_chain_json_rpc_server_addr(&self) -> Option<SocketAddr>
pub fn relay_chain_json_rpc_server_addr(&self) -> Option<SocketAddr>
Returns the address the relay chain JSON-RPC server is listening on.
Returns None
if and only if Config::relay_chain
was None
or if
ChainConfig::json_rpc_listen
was None
in Config::relay_chain
.
sourcepub async fn network_known_best(&self) -> Option<u64>
pub async fn network_known_best(&self) -> Option<u64>
Returns the best block according to the networking.
sourcepub async fn num_network_connections(&self) -> u64
pub async fn num_network_connections(&self) -> u64
Returns the current total number of network connections of the client.
pub async fn sync_state(&self) -> SyncState
pub async fn relay_chain_sync_state(&self) -> Option<SyncState>
sourcepub fn send_json_rpc_request(&self, request: String)
pub fn send_json_rpc_request(&self, request: String)
Adds a JSON-RPC request to the queue of requests of the virtual endpoint of the chain.
The virtual endpoint doesn’t have any limit.
sourcepub async fn next_json_rpc_response(&self) -> String
pub async fn next_json_rpc_response(&self) -> String
Returns the new JSON-RPC response or notification for requests sent using
Client::send_json_rpc_request
.
If this function is called multiple times simultaneously, only one invocation will receive each response. Which one is unspecified.
sourcepub fn relay_chain_send_json_rpc_request(
&self,
request: String
) -> Result<(), RelayChainSendJsonRpcRequestError>
pub fn relay_chain_send_json_rpc_request( &self, request: String ) -> Result<(), RelayChainSendJsonRpcRequestError>
Adds a JSON-RPC request to the queue of requests of the virtual endpoint of the relay chain.
The virtual endpoint doesn’t have any limit.
sourcepub async fn relay_chain_next_json_rpc_response(&self) -> String
pub async fn relay_chain_next_json_rpc_response(&self) -> String
Returns the new JSON-RPC response or notification for requests sent using
Client::relay_chain_send_json_rpc_request
.
If this function is called multiple times simultaneously, only one invocation will receive each response. Which one is unspecified.
If Config::relay_chain
was None
, this function waits indefinitely.
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more