Thanks to visit codestin.com
Credit goes to github.com

Skip to content
forked from krojew/cdrs-tokio

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

rukai/cdrs-tokio

 
 

Repository files navigation

CDRS tokio crates.io version build status

CDRS tokio - async Apache Cassandra driver using tokio

CDRS is production-ready Apache Cassandra driver written in pure Rust.

Features

  • Asynchronous API;
  • TCP/TLS connection;
  • Topology-aware dynamic and configurable load balancing;
  • Configurable connection strategies;
  • LZ4, Snappy compression;
  • Cassandra-to-Rust data deserialization;
  • Pluggable authentication strategies;
  • ScyllaDB support;
  • Server events listening;
  • Multiple CQL version support (3, 4), full spec implementation;
  • Query tracing information;
  • Prepared statements;
  • Query paging;
  • Batch statements;
  • Configurable retry and reconnection policy;
  • Support for interleaved queries;
  • Support for Yugabyte YCQL JSONB;

Documentation and examples

Getting started

This example configures a cluster consisting of a single node, and uses round-robin load balancing.

use cdrs_tokio::cluster::session::{TcpSessionBuilder, SessionBuilder};
use cdrs_tokio::cluster::NodeTcpConfigBuilder;
use cdrs_tokio::load_balancing::RoundRobinBalancingStrategy;
use cdrs_tokio::query::*;
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let cluster_config = NodeTcpConfigBuilder::new()
        .with_contact_point("127.0.0.1:9042".into())
        .build()
        .await
        .unwrap();
    let session = TcpSessionBuilder::new(RoundRobinBalancingStrategy::new(), cluster_config).build();

    let create_ks = "CREATE KEYSPACE IF NOT EXISTS test_ks WITH REPLICATION = { \
                     'class' : 'SimpleStrategy', 'replication_factor' : 1 };";
    session
        .query(create_ks)
        .await
        .expect("Keyspace create error");
}

License

This project is licensed under either of

at your option.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%