pub struct Session<T: CdrsTransport + 'static, CM: ConnectionManager<T> + 'static, LB: LoadBalancingStrategy<T, CM> + Send + Sync> { /* private fields */ }
Expand description

CDRS session that holds a pool of connections to nodes and provides an interface for interacting with the cluster.

Implementations§

source§

impl<T: CdrsTransport + 'static, CM: ConnectionManager<T> + Send + Sync + 'static, LB: LoadBalancingStrategy<T, CM> + Send + Sync + 'static> Session<T, CM, LB>

source

pub fn paged(&self, page_size: i32) -> SessionPager<'_, T, CM, LB>

Returns new SessionPager that can be used for performing paged queries.

source

pub async fn exec_with_params( &self, prepared: &PreparedQuery, parameters: &StatementParams ) -> Result<Envelope>

Executes given prepared query with query parameters.

source

pub async fn exec_with_values<V: Into<QueryValues>>( &self, prepared: &PreparedQuery, values: V ) -> Result<Envelope>

Executes given prepared query with query values.

source

pub async fn exec(&self, prepared: &PreparedQuery) -> Result<Envelope>

Executes given prepared query.

source

pub async fn prepare_raw_tw<Q: ToString>( &self, query: Q, keyspace: Option<String>, with_tracing: bool, with_warnings: bool, beta_protocol: bool ) -> Result<BodyResResultPrepared>

Prepares a query for execution. Along with query itself, the method takes with_tracing and with_warnings flags to get tracing information and warnings. Returns the raw prepared query result.

source

pub async fn prepare_raw<Q: ToString>( &self, query: Q ) -> Result<BodyResResultPrepared>

Prepares query without additional tracing information and warnings. Returns the raw prepared query result.

source

pub async fn prepare_tw<Q: ToString>( &self, query: Q, keyspace: Option<String>, with_tracing: bool, with_warnings: bool, beta_protocol: bool ) -> Result<PreparedQuery>

Prepares a query for execution. Along with query itself, the method takes with_tracing and with_warnings flags to get tracing information and warnings. Returns the prepared query.

source

pub async fn prepare<Q: ToString>(&self, query: Q) -> Result<PreparedQuery>

It prepares query without additional tracing information and warnings. Returns the prepared query.

source

pub async fn batch(&self, batch: QueryBatch) -> Result<Envelope>

Executes batch query.

source

pub async fn batch_with_params( &self, batch: QueryBatch, parameters: &StatementParams ) -> Result<Envelope>

Executes batch query with parameters.

source

pub async fn query<Q: ToString>(&self, query: Q) -> Result<Envelope>

Executes a query.

source

pub async fn query_with_values<Q: ToString, V: Into<QueryValues>>( &self, query: Q, values: V ) -> Result<Envelope>

Executes a query with bounded values (either with or without names).

source

pub async fn query_with_params<Q: ToString>( &self, query: Q, parameters: StatementParams ) -> Result<Envelope>

Executes a query with query parameters.

source

pub fn current_keyspace(&self) -> Option<Arc<String>>

Returns currently set global keyspace.

source

pub fn cluster_metadata(&self) -> Arc<ClusterMetadata<T, CM>>

Returns current cluster metadata.

source

pub fn query_plan(&self, request: Option<Request<'_>>) -> QueryPlan<T, CM>

Returns query plan for given request. If no request is given, return a generic plan for establishing connection(s) to node(s).

source

pub fn create_event_receiver(&self) -> Receiver<ServerEvent>

Creates a new server event receiver. You can use multiple receivers at the same time.

source

pub fn retry_policy(&self) -> &dyn RetryPolicy

Returns current retry policy.

Trait Implementations§

source§

impl<T: CdrsTransport + 'static, CM: ConnectionManager<T> + 'static, LB: LoadBalancingStrategy<T, CM> + Send + Sync> Debug for Session<T, CM, LB>

source§

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

Formats the value using the given formatter. Read more
source§

impl<T: CdrsTransport + 'static, CM: ConnectionManager<T>, LB: LoadBalancingStrategy<T, CM> + Send + Sync> Drop for Session<T, CM, LB>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, CM, LB> !RefUnwindSafe for Session<T, CM, LB>

§

impl<T, CM, LB> Send for Session<T, CM, LB>

§

impl<T, CM, LB> Sync for Session<T, CM, LB>

§

impl<T, CM, LB> Unpin for Session<T, CM, LB>where CM: Unpin, T: Unpin,

§

impl<T, CM, LB> !UnwindSafe for Session<T, CM, LB>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere 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 Twhere 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

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