Struct cdrs::client::Session
[−]
[src]
pub struct Session<T: Authenticator, X: CDRSTransport> { /* fields omitted */ }
The object that provides functionality for communication with Cassandra server.
Methods
impl<T: Authenticator, X: CDRSTransport> Session<T, X>
[src]
fn start(cdrs: CDRS<T, X>) -> Session<T, X>
Creates new session basing on CDRS instance.
fn compressor(&mut self, compressor: Compression) -> &mut Self
The method overrides a compression method of current session
fn end(&mut self)
Manually ends current session. Apart of that session will be ended automatically when the instance is dropped.
fn prepare(&mut self,
query: String,
with_tracing: bool,
with_warnings: bool)
-> Result<Frame>
query: String,
with_tracing: bool,
with_warnings: bool)
-> Result<Frame>
The method makes a request to DB Server to prepare provided query.
fn execute(&mut self,
id: &CBytesShort,
query_parameters: QueryParams,
with_tracing: bool,
with_warnings: bool)
-> Result<Frame>
id: &CBytesShort,
query_parameters: QueryParams,
with_tracing: bool,
with_warnings: bool)
-> Result<Frame>
The method makes a request to DB Server to execute a query with provided id
using provided query parameters. id
is an ID of a query which Server
returns back to a driver as a response to prepare
request.
fn query(&mut self,
query: Query,
with_tracing: bool,
with_warnings: bool)
-> Result<Frame>
query: Query,
with_tracing: bool,
with_warnings: bool)
-> Result<Frame>
The method makes a request to DB Server to execute a query provided in query
argument.
you can build the query with QueryBuilder
let qb = QueryBuilder::new().query("select * from emp") .consistency(Consistency::One).page_size(Some(4)); session.query_with_builder(qb);
fn batch(&mut self,
batch_query: QueryBatch,
with_tracing: bool,
with_warnings: bool)
-> Result<Frame>
batch_query: QueryBatch,
with_tracing: bool,
with_warnings: bool)
-> Result<Frame>
fn listen_for<'a>(self,
events: Vec<SimpleServerEvent>)
-> Result<(Listener<X>, EventStream)>
events: Vec<SimpleServerEvent>)
-> Result<(Listener<X>, EventStream)>
It consumes CDRS