Struct cdrs_tokio::cluster::session::Session
source · 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>
impl<T: CdrsTransport + 'static, CM: ConnectionManager<T> + Send + Sync + 'static, LB: LoadBalancingStrategy<T, CM> + Send + Sync + 'static> Session<T, CM, LB>
sourcepub fn paged(&self, page_size: i32) -> SessionPager<'_, T, CM, LB>
pub fn paged(&self, page_size: i32) -> SessionPager<'_, T, CM, LB>
Returns new SessionPager
that can be used for performing paged queries.
sourcepub async fn exec_with_params(
&self,
prepared: &PreparedQuery,
parameters: &StatementParams
) -> Result<Envelope>
pub async fn exec_with_params( &self, prepared: &PreparedQuery, parameters: &StatementParams ) -> Result<Envelope>
Executes given prepared query with query parameters.
sourcepub async fn exec_with_values<V: Into<QueryValues>>(
&self,
prepared: &PreparedQuery,
values: V
) -> Result<Envelope>
pub async fn exec_with_values<V: Into<QueryValues>>( &self, prepared: &PreparedQuery, values: V ) -> Result<Envelope>
Executes given prepared query with query values.
sourcepub async fn exec(&self, prepared: &PreparedQuery) -> Result<Envelope>
pub async fn exec(&self, prepared: &PreparedQuery) -> Result<Envelope>
Executes given prepared query.
sourcepub async fn prepare_raw_tw<Q: ToString>(
&self,
query: Q,
keyspace: Option<String>,
with_tracing: bool,
with_warnings: bool,
beta_protocol: bool
) -> Result<BodyResResultPrepared>
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.
sourcepub async fn prepare_raw<Q: ToString>(
&self,
query: Q
) -> Result<BodyResResultPrepared>
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.
sourcepub async fn prepare_tw<Q: ToString>(
&self,
query: Q,
keyspace: Option<String>,
with_tracing: bool,
with_warnings: bool,
beta_protocol: bool
) -> Result<PreparedQuery>
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.
sourcepub async fn prepare<Q: ToString>(&self, query: Q) -> Result<PreparedQuery>
pub async fn prepare<Q: ToString>(&self, query: Q) -> Result<PreparedQuery>
It prepares query without additional tracing information and warnings. Returns the prepared query.
sourcepub async fn batch(&self, batch: QueryBatch) -> Result<Envelope>
pub async fn batch(&self, batch: QueryBatch) -> Result<Envelope>
Executes batch query.
sourcepub async fn batch_with_params(
&self,
batch: QueryBatch,
parameters: &StatementParams
) -> Result<Envelope>
pub async fn batch_with_params( &self, batch: QueryBatch, parameters: &StatementParams ) -> Result<Envelope>
Executes batch query with parameters.
sourcepub async fn query_with_values<Q: ToString, V: Into<QueryValues>>(
&self,
query: Q,
values: V
) -> Result<Envelope>
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).
sourcepub async fn query_with_params<Q: ToString>(
&self,
query: Q,
parameters: StatementParams
) -> Result<Envelope>
pub async fn query_with_params<Q: ToString>( &self, query: Q, parameters: StatementParams ) -> Result<Envelope>
Executes a query with query parameters.
sourcepub fn current_keyspace(&self) -> Option<Arc<String>>
pub fn current_keyspace(&self) -> Option<Arc<String>>
Returns currently set global keyspace.
sourcepub fn cluster_metadata(&self) -> Arc<ClusterMetadata<T, CM>>
pub fn cluster_metadata(&self) -> Arc<ClusterMetadata<T, CM>>
Returns current cluster metadata.
sourcepub fn query_plan(&self, request: Option<Request<'_>>) -> QueryPlan<T, CM>
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).
sourcepub fn create_event_receiver(&self) -> Receiver<ServerEvent>
pub fn create_event_receiver(&self) -> Receiver<ServerEvent>
Creates a new server event receiver. You can use multiple receivers at the same time.
sourcepub fn retry_policy(&self) -> &dyn RetryPolicy
pub fn retry_policy(&self) -> &dyn RetryPolicy
Returns current retry policy.