Struct bigtable_rs::bigtable::BigTableConnection

source ·
pub struct BigTableConnection { /* private fields */ }
Expand description

For initiate a Bigtable connection, then a Bigtable client can be made from it.

Implementations§

source§

impl BigTableConnection

source

pub async fn new( project_id: &str, instance_name: &str, is_read_only: bool, channel_size: usize, timeout: Option<Duration>, ) -> Result<Self, Error>

Establish a connection to the BigTable instance named instance_name. If read-only access is required, the read_only flag should be used to reduce the requested OAuth2 scope.

The GOOGLE_APPLICATION_CREDENTIALS environment variable will be used to determine the program name that contains the BigTable instance in addition to access credentials.

The BIGTABLE_EMULATOR_HOST environment variable is also respected.

channel_size defines the number of connections (or channels) established to Bigtable service, and the requests are load balanced onto all the channels. You must therefore make sure all of these connections are open when a new request is to be sent. Idle connections are automatically closed in “a few minutes”. Therefore it is important to make sure you have a high enough QPS to send at least one request through all the connections (in every service host) every minute. If not, you should consider decreasing the channel size. If you are not sure what value to pick and your load is low, just start with 1. The recommended value could be 2 x the thread count in your tokio environment see info here https://docs.rs/tokio/latest/tokio/attr.main.html, but it might be a very different case for different applications.

source

pub fn new_with_token_provider( project_id: &str, instance_name: &str, is_read_only: bool, channel_size: usize, timeout: Option<Duration>, token_provider: Arc<dyn TokenProvider>, ) -> Result<Self, Error>

Establish a connection to the BigTable instance named instance_name. If read-only access is required, the read_only flag should be used to reduce the requested OAuth2 scope.

The authentication_manager variable will be used to determine the program name that contains the BigTable instance in addition to access credentials.

channel_size defines the number of connections (or channels) established to Bigtable service, and the requests are load balanced onto all the channels. You must therefore make sure all of these connections are open when a new request is to be sent. Idle connections are automatically closed in “a few minutes”. Therefore it is important to make sure you have a high enough QPS to send at least one request through all the connections (in every service host) every minute. If not, you should consider decreasing the channel size. If you are not sure what value to pick and your load is low, just start with 1. The recommended value could be 2 x the thread count in your tokio environment see info here https://docs.rs/tokio/latest/tokio/attr.main.html, but it might be a very different case for different applications.

source

pub fn new_with_emulator( emulator_endpoint: &str, project_id: &str, instance_name: &str, is_read_only: bool, timeout: Option<Duration>, ) -> Result<Self, Error>

Establish a connection to a BigTable emulator at [emulator_endpoint]. This is usually covered by Self::new or [Self::new_with_auth_manager], which both support the BIGTABLE_EMULATOR_HOST env variable. However, this function can also be used directly, in case setting BIGTABLE_EMULATOR_HOST is inconvenient.

source

pub fn client(&self) -> BigTable

Create a new BigTable client by cloning needed properties.

Clients require &mut self, due to Tonic::transport::Channel limitations, however the created new clients can be cheaply cloned and thus can be send to different threads

Trait Implementations§

source§

impl Clone for BigTableConnection

source§

fn clone(&self) -> BigTableConnection

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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,

§

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>,

§

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>,

§

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

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