ScyllaDriver

Struct ScyllaDriver 

Source
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: AtomicBool

Whether tracing is enabled for queries.

§last_trace_id: Mutex<Option<Uuid>>

Last tracing session ID.

Implementations§

Source§

impl ScyllaDriver

Source

fn build_rustls_config(ssl_config: &SslConfig) -> Result<Arc<ClientConfig>>

Build the TLS configuration from SslConfig.

Source

fn extract_string_list_val(val: Option<&CqlValue>) -> Vec<String>

Extract a Vec<String> from a CqlValue::List column value.

Source

fn convert_query_result(result: QueryResult) -> Result<CqlResult>

Convert a scylla QueryResult into our CqlResult type.

Source

fn convert_scylla_value(value: ScyllaCqlValue) -> CqlValue

Convert a scylla CqlValue to our CqlValue type.

Source

fn internal_to_scylla_cql(v: &CqlValue) -> ScyllaCqlValue

Convert our internal CqlValue to scylla’s CqlValue (reverse of convert_scylla_value).

Source

fn to_scylla_consistency(c: Consistency) -> Consistency

Convert our Consistency to scylla’s Consistency.

Source

fn to_scylla_serial_consistency(c: Consistency) -> Option<SerialConsistency>

Convert our Consistency to scylla’s SerialConsistency.

Source

fn build_query(&self, cql: &str) -> Statement

Build a Statement with the current consistency and tracing settings.

Source

fn store_trace_id(&self, result: &QueryResult)

Store tracing ID from a result if present.

Trait Implementations§

Source§

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,

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,

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,

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,

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,

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,

Switch the current keyspace (USE ).
Source§

fn get_consistency(&self) -> Consistency

Get the current consistency level.
Source§

fn set_consistency(&self, consistency: Consistency)

Set the consistency level for subsequent queries.
Source§

fn get_serial_consistency(&self) -> Option<Consistency>

Get the current serial consistency level.
Source§

fn set_serial_consistency(&self, consistency: Option<Consistency>)

Set the serial consistency level for subsequent queries.
Source§

fn set_tracing(&self, enabled: bool)

Enable or disable request tracing.
Source§

fn is_tracing_enabled(&self) -> bool

Check if tracing is currently enabled.
Source§

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

Get the release version of the connected node.
Source§

fn get_scylla_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 ScyllaDB version (None if not ScyllaDB).
Source§

fn is_connected<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the connection is still alive.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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 T
where 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,