Code Monkey home page Code Monkey logo

cdrs-tokio's Introduction

CDRS tokio crates.io version

CDRS tokio - async Apache Cassandra driver using tokio

CDRS is Apache Cassandra driver written in pure Rust.

Features

  • TCP/SSL connection;
  • Load balancing;
  • Connection pooling;
  • 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.

Documentation and examples

Getting started

Add CDRS tokio to your Cargo.toml file as a dependency:

cdrs-tokio = "desired version"
use cdrs_tokio::authenticators::NoneAuthenticator;
use cdrs_tokio::cluster::session::{new as new_session};
use cdrs_tokio::cluster::{ClusterTcpConfig, NodeTcpConfigBuilder};
use cdrs_tokio::load_balancing::RoundRobin;
use cdrs_tokio::query::*;

#[tokio::main]
async fn main() {
  let node = NodeTcpConfigBuilder::new("127.0.0.1:9042", Arc::new(NoneAuthenticator {})).build();
  let cluster_config = ClusterTcpConfig(vec![node]);
  let no_compression =
    new_session(&cluster_config, RoundRobin::new()).await.expect("session should be created");

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

This example configures a cluster consisting of a single node, and uses round robin load balancing and default bb8 values for connection pool.

License

This project is licensed under either of

at your option.

cdrs-tokio's People

Contributors

aerc18 avatar alexpikalov avatar apezel avatar athre0z avatar byron avatar cibingeorge avatar cnd avatar dfaust avatar doumanash avatar dowlandaiello avatar dylan-dpc avatar ernestas-poskus avatar grossws avatar guy9 avatar harrydevnull avatar j4in avatar jasperav1994 avatar jerrypnz avatar jumbojets avatar krojew avatar nkconnor avatar rrichardson avatar stormbrew avatar sunng87 avatar teburd avatar tupshin avatar wolvereness avatar wwwesleyyy avatar zakcodes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.