Struct Client

Source
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

Source

pub async fn connect<D>(dst: D) -> ClientResult<Self>
where D: TryInto<Endpoint>, D::Error: Into<StdError>,

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"

Source

pub async fn alter_table( &mut self, req: AlterTableRequest, ) -> ClientResult<AlterTableResponse>

Alters a table, e.g. by adding columns.

Source

pub async fn create_table( &mut self, req: CreateTableRequest, ) -> ClientResult<CreateTableResponse>

Creates or asserts or declaratively updates a table.

Source

pub async fn drop_table( &mut self, req: DropTableRequest, ) -> ClientResult<DropTableResponse>

Drops a table, deleting all its data.

Source

pub async fn get_schema( &mut self, req: GetSchemaRequest, ) -> ClientResult<GetSchemaResponse>

Returns the table’s schema.

Source

pub async fn delete_from_segment( &mut self, req: DeleteFromSegmentRequest, ) -> ClientResult<DeleteFromSegmentResponse>

Deletes specific rows from the segment.

Source

pub async fn list_tables( &mut self, req: ListTablesRequest, ) -> ClientResult<ListTablesResponse>

Lists of all tables.

Source

pub async fn list_segments( &mut self, req: ListSegmentsRequest, ) -> ClientResult<ListSegmentsResponse>

Lists all segments in the table, optionally subject to a partition filter.

Source

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.

Source

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§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

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

Formats the value using the given formatter. Read more

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V