ca
cdrs-async
cargo install cdrs-async
ca

cdrs-async

Async Cassandra driver made in Rust

by Alex Pikalov

0.1.0-alpha.0 (see all)License:MIT OR Apache-2.0
cargo install cdrs-async
Readme

CDRS-async - async Apache Cassandra and Scylla driver for Rust

CDRS - Apache Cassandra driver

CDRS-async is an asynchronous driver for Apache Cassandra and Scylla databases.

It's still alpha but you can try it out.

Features

  • 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.

Getting started

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

cdrs-async = { version = "*" }

Then add it as an external crate to your main.rs file:

extern crate async_std;
extern crate async_trait;
extern crate cdrs_async;

use async_std::{pin::Pin, task};
use cdrs_async::{authenticators::NoneAuthenticator, query::QueryExecutor, Compression, Session};

const CREATE_KS_QUERY: &'static str = r#"
  CREATE KEYSPACE IF NOT EXISTS async_cdrs_3
    WITH REPLICATION = {
      'class' : 'SimpleStrategy',
      'replication_factor' : 1
    };
"#;

fn main() {
  task::block_on(async {
    let authenticator_strategy = NoneAuthenticator {};
    let mut session = Session::connect(
      "127.0.0.1:9042",
      Compression::None,
      authenticator_strategy.into(),
    )
    .await
    .expect("session connect");
    let pinned_session = Pin::new(&mut session);

    let r = pinned_session.query(CREATE_KS_QUERY).await;
    println!("Result {:?}", r);
  });
}

License

This project is licensed under either of

GitHub Stars

46

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

2

OPEN PRs

2
VersionTagPublished
0.1.0-alpha.0
2yrs ago
No alternatives found
No tutorials found
Add a tutorial