Struct hypersync_client::Client
source · 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<Vec<Event>>>>
pub async fn collect_events( self: Arc<Self>, query: Query, config: StreamConfig, ) -> Result<QueryResponse<Vec<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_height(&self) -> Result<u64>
pub async fn get_height(&self) -> Result<u64>
Get the height of the Client instance with retries.
sourcepub async fn health(&self) -> Result<u64>
pub async fn health(&self) -> Result<u64>
Get the height of the Client instance for health checks.
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<Vec<Event>>>>
pub async fn get_events( &self, query: Query, ) -> Result<QueryResponse<Vec<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<Vec<Event>>>>>>
pub async fn stream_events( self: Arc<Self>, query: Query, config: StreamConfig, ) -> Result<Receiver<Result<QueryResponse<Vec<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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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