pub struct ScyllaDriver {
session: Session,
prepared_cache: Mutex<HashMap<Vec<u8>, PreparedStatement>>,
consistency: Mutex<Consistency>,
serial_consistency: Mutex<Option<Consistency>>,
tracing_enabled: AtomicBool,
last_trace_id: Mutex<Option<Uuid>>,
}Expand description
ScyllaDriver wraps a scylla Session and provides the CqlDriver trait.
Fields§
§session: Session§prepared_cache: Mutex<HashMap<Vec<u8>, PreparedStatement>>Cache of prepared statements keyed by internal ID.
consistency: Mutex<Consistency>Current consistency level.
serial_consistency: Mutex<Option<Consistency>>Current serial consistency level.
tracing_enabled: AtomicBoolWhether tracing is enabled for queries.
last_trace_id: Mutex<Option<Uuid>>Last tracing session ID.
Implementations§
Source§impl ScyllaDriver
impl ScyllaDriver
Sourcefn build_rustls_config(ssl_config: &SslConfig) -> Result<Arc<ClientConfig>>
fn build_rustls_config(ssl_config: &SslConfig) -> Result<Arc<ClientConfig>>
Build the TLS configuration from SslConfig.
Sourcefn extract_string_list_val(val: Option<&CqlValue>) -> Vec<String>
fn extract_string_list_val(val: Option<&CqlValue>) -> Vec<String>
Extract a Vec<String> from a CqlValue::List column value.
Sourcefn convert_query_result(result: QueryResult) -> Result<CqlResult>
fn convert_query_result(result: QueryResult) -> Result<CqlResult>
Convert a scylla QueryResult into our CqlResult type.
Sourcefn convert_scylla_value(value: ScyllaCqlValue) -> CqlValue
fn convert_scylla_value(value: ScyllaCqlValue) -> CqlValue
Convert a scylla CqlValue to our CqlValue type.
Sourcefn internal_to_scylla_cql(v: &CqlValue) -> ScyllaCqlValue
fn internal_to_scylla_cql(v: &CqlValue) -> ScyllaCqlValue
Convert our internal CqlValue to scylla’s CqlValue (reverse of convert_scylla_value).
Sourcefn to_scylla_consistency(c: Consistency) -> Consistency
fn to_scylla_consistency(c: Consistency) -> Consistency
Convert our Consistency to scylla’s Consistency.
Sourcefn to_scylla_serial_consistency(c: Consistency) -> Option<SerialConsistency>
fn to_scylla_serial_consistency(c: Consistency) -> Option<SerialConsistency>
Convert our Consistency to scylla’s SerialConsistency.
Sourcefn build_query(&self, cql: &str) -> Statement
fn build_query(&self, cql: &str) -> Statement
Build a Statement with the current consistency and tracing settings.
Sourcefn store_trace_id(&self, result: &QueryResult)
fn store_trace_id(&self, result: &QueryResult)
Store tracing ID from a result if present.
Trait Implementations§
Source§impl CqlDriver for ScyllaDriver
impl CqlDriver for ScyllaDriver
Source§fn connect<'life0, 'async_trait>(
config: &'life0 ConnectionConfig,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
config: &'life0 ConnectionConfig,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Establish a connection to the database cluster.
Source§fn execute_unpaged<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CqlResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_unpaged<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CqlResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute a raw CQL query string without parameters.
Source§fn execute_paged<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
page_size: i32,
) -> Pin<Box<dyn Future<Output = Result<CqlResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_paged<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
page_size: i32,
) -> Pin<Box<dyn Future<Output = Result<CqlResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute a CQL query with automatic paging, returning all rows.
Source§fn prepare<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<PreparedId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prepare<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<PreparedId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Prepare a CQL statement for repeated execution.
Source§fn execute_prepared<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prepared_id: &'life1 PreparedId,
values: &'life2 [CqlValue],
) -> Pin<Box<dyn Future<Output = Result<CqlResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_prepared<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prepared_id: &'life1 PreparedId,
values: &'life2 [CqlValue],
) -> Pin<Box<dyn Future<Output = Result<CqlResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a previously prepared statement with the given values.
Source§fn use_keyspace<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn use_keyspace<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Switch the current keyspace (USE ).
Source§fn get_consistency(&self) -> Consistency
fn get_consistency(&self) -> Consistency
Get the current consistency level.
Source§fn set_consistency(&self, consistency: Consistency)
fn set_consistency(&self, consistency: Consistency)
Set the consistency level for subsequent queries.
Source§fn get_serial_consistency(&self) -> Option<Consistency>
fn get_serial_consistency(&self) -> Option<Consistency>
Get the current serial consistency level.
Source§fn set_serial_consistency(&self, consistency: Option<Consistency>)
fn set_serial_consistency(&self, consistency: Option<Consistency>)
Set the serial consistency level for subsequent queries.
Source§fn set_tracing(&self, enabled: bool)
fn set_tracing(&self, enabled: bool)
Enable or disable request tracing.
Source§fn is_tracing_enabled(&self) -> bool
fn is_tracing_enabled(&self) -> bool
Check if tracing is currently enabled.
Source§fn last_trace_id(&self) -> Option<Uuid>
fn last_trace_id(&self) -> Option<Uuid>
Get the last tracing session ID (if tracing was enabled).
Source§fn get_trace_session<'life0, 'async_trait>(
&'life0 self,
trace_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<TracingSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_trace_session<'life0, 'async_trait>(
&'life0 self,
trace_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<TracingSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve tracing session data for a given trace ID.
Source§fn get_keyspaces<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<KeyspaceMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_keyspaces<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<KeyspaceMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get metadata for all keyspaces.
Source§fn get_tables<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<TableMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_tables<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<TableMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get metadata for all tables in a keyspace.
Source§fn get_table_metadata<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
table: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<TableMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_table_metadata<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
table: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<TableMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get metadata for a specific table.
Source§fn get_udts<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<UdtMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_udts<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<UdtMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get metadata for all user-defined types in a keyspace.
Source§fn get_functions<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FunctionMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_functions<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FunctionMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get metadata for all user-defined functions in a keyspace.
Source§fn get_aggregates<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<AggregateMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_aggregates<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<AggregateMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get metadata for all user-defined aggregates in a keyspace.
Source§fn get_cluster_name<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_cluster_name<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the cluster name.
Source§fn get_cql_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_cql_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the CQL version from the connected node.
Source§fn get_release_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_release_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the release version of the connected node.
Auto Trait Implementations§
impl !Freeze for ScyllaDriver
impl !RefUnwindSafe for ScyllaDriver
impl Send for ScyllaDriver
impl Sync for ScyllaDriver
impl Unpin for ScyllaDriver
impl !UnwindSafe for ScyllaDriver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more