Struct cassandra_cpp::Session
source · Expand description
A session object is used to execute queries and maintains cluster state through the control connection. The control connection is used to auto-discover nodes and monitor cluster changes (topology and schema). Each session also maintains multiple /pools of connections to cluster nodes which are used to query the cluster.
Instances of the session object are thread-safe to execute queries.
Tuple Fields§
§0: *mut _Session
Implementations§
source§impl Session
impl Session
sourcepub fn new() -> Session
pub fn new() -> Session
Create a new Cassanda session. It’s recommended to use Cluster.connect() instead
sourcepub fn connect(self, cluster: &Cluster) -> CassFuture<()>
pub fn connect(self, cluster: &Cluster) -> CassFuture<()>
Connects a session.
sourcepub fn connect_keyspace(
&self,
cluster: &Cluster,
keyspace: &str
) -> Result<CassFuture<()>>
pub fn connect_keyspace(
&self,
cluster: &Cluster,
keyspace: &str
) -> Result<CassFuture<()>>
Connects a session and sets the keyspace.
sourcepub fn close(self) -> CassFuture<()>
pub fn close(self) -> CassFuture<()>
Closes the session instance, outputs a close future which can be used to determine when the session has been terminated. This allows in-flight requests to finish.
sourcepub fn prepare(&self, query: &str) -> Result<CassFuture<PreparedStatement>>
pub fn prepare(&self, query: &str) -> Result<CassFuture<PreparedStatement>>
Create a prepared statement.
sourcepub fn execute_batch(&self, batch: Batch) -> CassFuture<CassResult>
pub fn execute_batch(&self, batch: Batch) -> CassFuture<CassResult>
Execute a batch statement.
sourcepub fn execute(&self, statement: &Statement) -> CassFuture<CassResult>
pub fn execute(&self, statement: &Statement) -> CassFuture<CassResult>
Execute a statement.
sourcepub fn get_schema_meta(&self) -> SchemaMeta
pub fn get_schema_meta(&self) -> SchemaMeta
Gets a snapshot of this session’s schema metadata. The returned snapshot of the schema metadata is not updated. This function must be called again to retrieve any schema changes since the previous call.
sourcepub fn get_metrics(&self) -> SessionMetrics
pub fn get_metrics(&self) -> SessionMetrics
Gets a copy of this session’s performance/diagnostic metrics.