Skip to content

Commit

Permalink
dep update
Browse files Browse the repository at this point in the history
  • Loading branch information
krojew committed Mar 25, 2024
1 parent 7eabde6 commit 4981c13
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [

[workspace.dependencies]
arc-swap = "1.6.0"
uuid = "1.4.1"
uuid = "1.8.0"
derivative = "2.2.0"
derive_more = "0.99.17"
bytes = "1.5.0"
Expand Down
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# CDRS tokio

[![crates.io version](https://img.shields.io/crates/v/cdrs-tokio.svg)](https://crates.io/crates/cdrs-tokio) ![build status](https://github.com/krojew/cdrs-tokio/actions/workflows/rust.yml/badge.svg) ![Maintenance](https://img.shields.io/maintenance/yes/2023)
[![crates.io version](https://img.shields.io/crates/v/cdrs-tokio.svg)](https://crates.io/crates/cdrs-tokio) ![build status](https://github.com/krojew/cdrs-tokio/actions/workflows/rust.yml/badge.svg)

![CDRS tokio - async Apache Cassandra driver using tokio](./cdrs-logo.png)

CDRS is production-ready Apache **C**assandra **d**river written in pure **R**u**s**t. Focuses on providing high
level of configurability to suit most use cases at any scale, as its Java counterpart, while also leveraging the
CDRS is production-ready Apache **C**assandra **d**river written in pure **R**u*
*s**t. Focuses on providing high
level of configurability to suit most use cases at any scale, as its Java
counterpart, while also leveraging the
safety and performance of Rust.

## Features
Expand All @@ -32,15 +34,20 @@ safety and performance of Rust.

## Performance

Due to high configurability of **CDRS**, the performance will vary depending on use case. The following benchmarks
have been made against the latest (master as of 03-12-2021) versions of respective libraries (except
Due to high configurability of **CDRS**, the performance will vary depending on
use case. The following benchmarks
have been made against the latest (master as of 03-12-2021) versions of
respective libraries (except
cassandra-cpp: 2.16.0) and protocol version 4.

- `cdrs-tokio-large-pool` - **CDRS** with node connection pool equal to double of physical CPU cores
- `cdrs-tokio-large-pool` - **CDRS** with node connection pool equal to double
of physical CPU cores
- `cdrs-tokio-small-pool` - **CDRS** with a single connection per node
- `scylladb-rust-large-pool` - `scylla` crate with node connection pool equal to double of physical CPU cores
- `scylladb-rust-large-pool` - `scylla` crate with node connection pool equal to
double of physical CPU cores
- `scylladb-rust-small-pool` - `scylla` crate with a single connection per node
- `cassandra-cpp` - Rust bindings for Datastax C++ Driver, running on multiple threads using Tokio
- `cassandra-cpp` - Rust bindings for Datastax C++ Driver, running on multiple
threads using Tokio
- `gocql` - a driver written in Go

<img src="./perf-inserts.png" alt="insert benchmark">
Expand All @@ -54,11 +61,13 @@ Knowing given use case, CDRS can be optimized for peak performance.
- [User guide](./documentation).
- [Examples](./cdrs-tokio/examples).
- [API docs](https://docs.rs/cdrs-tokio/latest/cdrs_tokio/).
- Using ScyllaDB with RUST [lesson](https://university.scylladb.com/courses/using-scylla-drivers/lessons/rust-and-scylla/).
- Using ScyllaDB with
RUST [lesson](https://university.scylladb.com/courses/using-scylla-drivers/lessons/rust-and-scylla/).

## Getting started

This example configures a cluster consisting of a single node without authentication, and uses round-robin
This example configures a cluster consisting of a single node without
authentication, and uses round-robin
load balancing. Other options are kept as default.

```rust
Expand Down Expand Up @@ -92,7 +101,9 @@ async fn main() {

This project is licensed under either of

- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0))
- MIT license ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)
or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0))
- MIT license ([LICENSE-MIT](LICENSE-MIT)
or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))

at your option.
4 changes: 2 additions & 2 deletions cassandra-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ e2e-tests = []
[dependencies]
arc-swap.workspace = true
arrayref = "0.3.7"
bitflags = "2.4.0"
bitflags = "2.5.0"
chrono = { version = "0.4.31", default_features = false, features = ["std"] }
crc32fast = "1.3.2"
crc32fast = "1.4.0"
derivative.workspace = true
derive_more.workspace = true
float_eq = "1.0.1"
Expand Down
14 changes: 6 additions & 8 deletions cassandra-protocol/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,8 @@ macro_rules! as_rust_type {
ColType::Timestamp => match $data_value.as_slice() {
Some(ref bytes) => decode_timestamp(bytes)
.map(|ts| {
NaiveDateTime::from_timestamp_opt(ts / 1000, (ts % 1000 * 1_000_000) as u32)
DateTime::from_timestamp(ts / 1000, (ts % 1000 * 1_000_000) as u32)
.map(|dt| dt.naive_utc())
})
.map_err(Into::into),
None => Ok(None),
Expand All @@ -1381,13 +1382,10 @@ macro_rules! as_rust_type {
ColType::Timestamp => match $data_value.as_slice() {
Some(ref bytes) => decode_timestamp(bytes)
.map(|ts| {
Some(DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(
ts / 1000,
(ts % 1000 * 1_000_000) as u32,
)?,
Utc,
))
DateTime::from_timestamp(
ts / 1000,
(ts % 1000 * 1_000_000) as u32,
)
})
.map_err(Into::into),
None => Ok(None),
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl From<Decimal> for Bytes {
impl From<NaiveDateTime> for Bytes {
#[inline]
fn from(value: NaiveDateTime) -> Self {
value.timestamp_millis().into()
value.and_utc().timestamp_millis().into()
}
}

Expand Down
6 changes: 3 additions & 3 deletions cdrs-tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ http-proxy = ["async-http-proxy"]
[dependencies]
arc-swap.workspace = true
atomic = "0.6.0"
bytemuck = { version = "1.14.0", features = ["derive"] }
bytemuck = { version = "1.15.0", features = ["derive"] }
bytes.workspace = true
cassandra-protocol = { path = "../cassandra-protocol", version = "3.1.1" }
cdrs-tokio-helpers-derive = { path = "../cdrs-tokio-helpers-derive", version = "5.0.3", optional = true }
Expand All @@ -34,7 +34,7 @@ lazy_static = "1.4.0"
rand = "0.8.5"
serde_json = "1.0.107"
thiserror.workspace = true
tokio = { version = "1.32.0", features = ["net", "io-util", "rt", "sync", "macros", "rt-multi-thread", "time"] }
tokio = { version = "1.36.0", features = ["net", "io-util", "rt", "sync", "macros", "rt-multi-thread", "time"] }
# note: default features for tokio-rustls include aws_lc_rs, which require clang on Windows => disable and let users
# enable it explicitly
tokio-rustls = { version = "0.26.0", optional = true, default-features = false, features = ["logging", "tls12"] }
Expand All @@ -52,7 +52,7 @@ float_eq = "1.0.1"
maplit = "1.0.2"
mockall = "0.12.0"
lazy_static = "1.4.0"
regex = "1.9.6"
regex = "1.10.4"
uuid = { version = "1.4.1", features = ["v4"] }
time = { version = "0.3.29", features = ["std", "macros"] }

Expand Down

0 comments on commit 4981c13

Please sign in to comment.