Skip to main content

GrpcClientSync

Struct GrpcClientSync 

Source
pub struct GrpcClientSync { /* private fields */ }
Expand description

Synchronous wrapper around GrpcClient.

This provides a blocking API by creating a Tokio runtime internally. For better performance in async contexts, use GrpcClient directly.

§Example

use hyperdb_api_core::client::grpc::{GrpcClientSync, GrpcConfig};

let config = GrpcConfig::new("http://localhost:7484")
    .database("test.hyper");

let mut client = GrpcClientSync::connect(config)?;
let result = client.execute_query("SELECT * FROM users")?;
let arrow_bytes = result.arrow_data();

Implementations§

Source§

impl GrpcClientSync

Source

pub fn connect(config: GrpcConfig) -> Result<GrpcClientSync, Error>

Connects to a Hyper server via gRPC (blocking).

§Errors
  • Returns ErrorKind::Other if a current-thread Tokio runtime cannot be built.
  • Propagates any error from GrpcClient::connect (invalid endpoint, TLS configuration failure, or transport setup failure).
Source

pub fn execute_query(&mut self, sql: &str) -> Result<GrpcQueryResult, Error>

Executes a SQL query (blocking).

§Errors

Blocking wrapper around GrpcClient::execute_query; see that method for the concrete failure modes.

Source

pub fn execute_query_to_arrow(&mut self, sql: &str) -> Result<Bytes, Error>

Executes a query and returns Arrow IPC bytes (blocking).

§Errors

Same failure modes as Self::execute_query.

Source

pub fn execute_query_stream( &mut self, sql: &str, ) -> Result<GrpcChunkStreamSync, Error>

Executes a query and returns a blocking streaming chunk producer.

See GrpcClient::execute_query_stream for the streaming semantics and memory behavior. The returned GrpcChunkStreamSync lets you pull chunks one at a time without buffering the entire result.

§Errors

Same failure modes as GrpcClient::execute_query_stream.

Source

pub fn execute_query_with_params( &mut self, sql: &str, params: QueryParameters, style: ParameterStyle, ) -> Result<GrpcQueryResult, Error>

Executes a parameterized SQL query (blocking).

§Example
use hyperdb_api_core::client::grpc::{GrpcClientSync, GrpcConfig, QueryParameters, ParameterStyle};

let params = QueryParameters::json_positional(&[&42i64])?;
let result = client.execute_query_with_params(
    "SELECT * FROM users WHERE id = $1",
    params,
    ParameterStyle::DollarNumbered,
)?;
§Errors

Blocking wrapper around GrpcClient::execute_query_with_params; see that method for the concrete failure modes.

Source

pub fn execute_query_with_params_to_arrow( &mut self, sql: &str, params: QueryParameters, style: ParameterStyle, ) -> Result<Bytes, Error>

Executes a parameterized query and returns Arrow IPC bytes (blocking).

§Errors

Same failure modes as Self::execute_query_with_params.

Source

pub fn cancel_query(&mut self, query_id: &str) -> Result<(), Error>

Cancels an in-flight gRPC query by its query_id (blocking).

Blocking wrapper around GrpcClient::cancel_query. See that method’s documentation for when a query_id is available (ASYNC-mode queries), best-effort cancel semantics, and the full “Relation to the Cancellable trait” discussion.

§Fallible by design

The Result<()> return is intentional and mirrors the async GrpcClient::cancel_query. Explicit callers get to observe transport-level failures (network errors, channel closed, auth expired) so they can record metrics, retry, or surface “cancel failed” UX. This is not an impl Cancellable for GrpcClientSync — it cannot be, because Cancellable::cancel(&self) takes no arguments and has no way to pass the query_id. See the Cancellable trait docs for the infallible-wrapper pattern used by Drop-path consumers.

§Example
use hyperdb_api_core::client::grpc::{GrpcClientSync, GrpcConfig};

client.cancel_query(query_id)?;
§Errors

Same failure modes as GrpcClient::cancel_query — transport-level errors bubble up; a cancel for an already-completed query returns Ok(()) by design.

Source

pub fn config(&self) -> &GrpcConfig

Returns the client configuration.

Source

pub fn close(self) -> Result<(), Error>

Closes the connection (blocking).

§Errors

Currently infallible — always returns Ok(()). The Result return type is preserved for API symmetry with async callers.

Trait Implementations§

Source§

impl Debug for GrpcClientSync

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more