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
impl GrpcClientSync
Sourcepub fn connect(config: GrpcConfig) -> Result<Self>
pub fn connect(config: GrpcConfig) -> Result<Self>
Connects to a Hyper server via gRPC (blocking).
§Errors
- Returns
ErrorKind::Otherif a current-thread Tokio runtime cannot be built. - Propagates any error from
GrpcClient::connect(invalid endpoint, TLS configuration failure, or transport setup failure).
Sourcepub fn execute_query(&mut self, sql: &str) -> Result<GrpcQueryResult>
pub fn execute_query(&mut self, sql: &str) -> Result<GrpcQueryResult>
Executes a SQL query (blocking).
§Errors
Blocking wrapper around GrpcClient::execute_query; see that
method for the concrete failure modes.
Sourcepub fn execute_query_to_arrow(&mut self, sql: &str) -> Result<Bytes>
pub fn execute_query_to_arrow(&mut self, sql: &str) -> Result<Bytes>
Executes a query and returns Arrow IPC bytes (blocking).
§Errors
Same failure modes as Self::execute_query.
Sourcepub fn execute_query_stream(&mut self, sql: &str) -> Result<GrpcChunkStreamSync>
pub fn execute_query_stream(&mut self, sql: &str) -> Result<GrpcChunkStreamSync>
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.
Sourcepub fn execute_query_with_params(
&mut self,
sql: &str,
params: QueryParameters,
style: ParameterStyle,
) -> Result<GrpcQueryResult>
pub fn execute_query_with_params( &mut self, sql: &str, params: QueryParameters, style: ParameterStyle, ) -> Result<GrpcQueryResult>
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.
Sourcepub fn execute_query_with_params_to_arrow(
&mut self,
sql: &str,
params: QueryParameters,
style: ParameterStyle,
) -> Result<Bytes>
pub fn execute_query_with_params_to_arrow( &mut self, sql: &str, params: QueryParameters, style: ParameterStyle, ) -> Result<Bytes>
Executes a parameterized query and returns Arrow IPC bytes (blocking).
§Errors
Same failure modes as Self::execute_query_with_params.
Sourcepub fn cancel_query(&mut self, query_id: &str) -> Result<()>
pub fn cancel_query(&mut self, query_id: &str) -> Result<()>
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.
Sourcepub fn config(&self) -> &GrpcConfig
pub fn config(&self) -> &GrpcConfig
Returns the client configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GrpcClientSync
impl !RefUnwindSafe for GrpcClientSync
impl Send for GrpcClientSync
impl Sync for GrpcClientSync
impl Unpin for GrpcClientSync
impl UnsafeUnpin for GrpcClientSync
impl !UnwindSafe for GrpcClientSync
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> 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> 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::Request