pub struct Client { /* private fields */ }
Expand description
Internal client to handle http requests and retries.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(cfg: ClientConfig) -> Result<Self>
pub fn new(cfg: ClientConfig) -> Result<Self>
Creates a new client with the given configuration.
Sourcepub async fn collect(
self: Arc<Self>,
query: Query,
config: StreamConfig,
) -> Result<QueryResponse>
pub async fn collect( self: Arc<Self>, query: Query, config: StreamConfig, ) -> Result<QueryResponse>
Retrieves blocks, transactions, traces, and logs through a stream using the provided query and stream configuration.
§Implementation
Runs multiple queries simultaneously based on config.concurrency.
Each query runs until it reaches query.to, server height, any max_num_* query param, or execution timed out by server.
Sourcepub async fn collect_events(
self: Arc<Self>,
query: Query,
config: StreamConfig,
) -> Result<QueryResponse<Vec<Event>>>
pub async fn collect_events( self: Arc<Self>, query: Query, config: StreamConfig, ) -> Result<QueryResponse<Vec<Event>>>
Retrieves events through a stream using the provided query and stream configuration.
Sourcepub async fn collect_arrow(
self: Arc<Self>,
query: Query,
config: StreamConfig,
) -> Result<ArrowResponse>
pub async fn collect_arrow( self: Arc<Self>, query: Query, config: StreamConfig, ) -> Result<ArrowResponse>
Retrieves blocks, transactions, traces, and logs in Arrow format through a stream using the provided query and stream configuration.
Sourcepub async fn collect_parquet(
self: Arc<Self>,
path: &str,
query: Query,
config: StreamConfig,
) -> Result<()>
pub async fn collect_parquet( self: Arc<Self>, path: &str, query: Query, config: StreamConfig, ) -> Result<()>
Writes parquet file getting data through a stream using the provided path, query, and stream configuration.
Sourcepub async fn get_chain_id(&self) -> Result<u64>
pub async fn get_chain_id(&self) -> Result<u64>
Get the chain_id from the server with retries.
Sourcepub async fn get_height(&self) -> Result<u64>
pub async fn get_height(&self) -> Result<u64>
Get the height of from server with retries.
Sourcepub async fn health_check(
&self,
http_req_timeout: Option<Duration>,
) -> Result<u64>
pub async fn health_check( &self, http_req_timeout: Option<Duration>, ) -> Result<u64>
Get the height of the Client instance for health checks.
Doesn’t do any retries and the http_req_timeout
parameter will override the http timeout config set when creating the client.
Sourcepub async fn get(&self, query: &Query) -> Result<QueryResponse>
pub async fn get(&self, query: &Query) -> Result<QueryResponse>
Executes query with retries and returns the response.
Sourcepub async fn get_events(
&self,
query: Query,
) -> Result<QueryResponse<Vec<Event>>>
pub async fn get_events( &self, query: Query, ) -> Result<QueryResponse<Vec<Event>>>
Add block, transaction and log fields selection to the query, executes it with retries and returns the response.
Sourcepub async fn get_arrow(&self, query: &Query) -> Result<ArrowResponse>
pub async fn get_arrow(&self, query: &Query) -> Result<ArrowResponse>
Executes query with retries and returns the response in Arrow format.
Sourcepub async fn stream(
self: Arc<Self>,
query: Query,
config: StreamConfig,
) -> Result<Receiver<Result<QueryResponse>>>
pub async fn stream( self: Arc<Self>, query: Query, config: StreamConfig, ) -> Result<Receiver<Result<QueryResponse>>>
Spawns task to execute query and return data via a channel.
Sourcepub async fn stream_events(
self: Arc<Self>,
query: Query,
config: StreamConfig,
) -> Result<Receiver<Result<QueryResponse<Vec<Event>>>>>
pub async fn stream_events( self: Arc<Self>, query: Query, config: StreamConfig, ) -> Result<Receiver<Result<QueryResponse<Vec<Event>>>>>
Add block, transaction and log fields selection to the query and spawns task to execute it, returning data via a channel.
Sourcepub async fn stream_arrow(
self: Arc<Self>,
query: Query,
config: StreamConfig,
) -> Result<Receiver<Result<ArrowResponse>>>
pub async fn stream_arrow( self: Arc<Self>, query: Query, config: StreamConfig, ) -> Result<Receiver<Result<ArrowResponse>>>
Spawns task to execute query and return data via a channel in Arrow format.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more