pub struct Client {
pub grpc: PancakeDbClient<Channel>,
}
Expand description
The best way to communicate with a PancakeDB server from Rust.
Supports the entire PancakeDB API.
Additionally, since PancakeDB reads return raw byte data in a compressed
format, Client
supports some higher-level functionality for reading
whole segments into a meaningful representation.
use pancake_db_client::Client;
let client = Client::connect("http://localhost:3842").await?;
Fields§
§grpc: PancakeDbClient<Channel>
The generated Tonic GRPC client.
All client calls ultimately go through this.
You can manually make low-level calls like read_segment_columns
through
this GRPC client.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn connect<D>(dst: D) -> ClientResult<Self>
pub async fn connect<D>(dst: D) -> ClientResult<Self>
Creates a new client connected to the given endpoint.
See tonic::transport::Endpoint
for what qualifies as an endpoint.
One option is a string of format "http://$HOST:$PORT"
Sourcepub async fn alter_table(
&mut self,
req: AlterTableRequest,
) -> ClientResult<AlterTableResponse>
pub async fn alter_table( &mut self, req: AlterTableRequest, ) -> ClientResult<AlterTableResponse>
Alters a table, e.g. by adding columns.
Sourcepub async fn create_table(
&mut self,
req: CreateTableRequest,
) -> ClientResult<CreateTableResponse>
pub async fn create_table( &mut self, req: CreateTableRequest, ) -> ClientResult<CreateTableResponse>
Creates or asserts or declaratively updates a table.
Sourcepub async fn drop_table(
&mut self,
req: DropTableRequest,
) -> ClientResult<DropTableResponse>
pub async fn drop_table( &mut self, req: DropTableRequest, ) -> ClientResult<DropTableResponse>
Drops a table, deleting all its data.
Sourcepub async fn get_schema(
&mut self,
req: GetSchemaRequest,
) -> ClientResult<GetSchemaResponse>
pub async fn get_schema( &mut self, req: GetSchemaRequest, ) -> ClientResult<GetSchemaResponse>
Returns the table’s schema.
Sourcepub async fn delete_from_segment(
&mut self,
req: DeleteFromSegmentRequest,
) -> ClientResult<DeleteFromSegmentResponse>
pub async fn delete_from_segment( &mut self, req: DeleteFromSegmentRequest, ) -> ClientResult<DeleteFromSegmentResponse>
Deletes specific rows from the segment.
Sourcepub async fn list_tables(
&mut self,
req: ListTablesRequest,
) -> ClientResult<ListTablesResponse>
pub async fn list_tables( &mut self, req: ListTablesRequest, ) -> ClientResult<ListTablesResponse>
Lists of all tables.
Sourcepub async fn list_segments(
&mut self,
req: ListSegmentsRequest,
) -> ClientResult<ListSegmentsResponse>
pub async fn list_segments( &mut self, req: ListSegmentsRequest, ) -> ClientResult<ListSegmentsResponse>
Lists all segments in the table, optionally subject to a partition filter.
Sourcepub async fn read_segment_deletions(
&mut self,
req: ReadSegmentDeletionsRequest,
) -> ClientResult<ReadSegmentDeletionsResponse>
pub async fn read_segment_deletions( &mut self, req: ReadSegmentDeletionsRequest, ) -> ClientResult<ReadSegmentDeletionsResponse>
Reads the binary data for the rows deleted.
Uncommonly used; you should typically use
[Client::decode_segment
] instead.
Sourcepub async fn write_to_partition(
&mut self,
req: WriteToPartitionRequest,
) -> ClientResult<WriteToPartitionResponse>
pub async fn write_to_partition( &mut self, req: WriteToPartitionRequest, ) -> ClientResult<WriteToPartitionResponse>
Writes rows to a partition of a table.
The request can be easily constructed with macros:
use std::time::SystemTime;
use pancake_db_idl::dml::WriteToPartitionRequest;
use pancake_db_client::{make_row, make_partition};
let req = WriteToPartitionRequest {
table_name: "my_table".to_string(),
partition: make_partition! {
"string_partition_col" => "my_partition_value".to_string(),
"int_partition_col" => 77,
},
rows: vec![
make_row! {
"timestamp_col" => SystemTime::now(),
"bool_col" => false,
}
],
};
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> 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