Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo.toml edition update to 2021 #174

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
name: Setup Cargo Toolchain 🛎️
with:
components: rustfmt, clippy, llvm-tools-preview
toolchain: stable
toolchain: nightly
default: true
- name: Check Code Format 🔧
run: |
Expand Down
37 changes: 16 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,37 @@
name = "agatedb"
version = "0.1.0"
authors = ["Jay Lee <busyjaylee@gmail.com>"]
edition = "2018"
edition = "2021"

[dependencies]
bytes = "1.0"
bytes = "1.1.0"
coarsetime = "0.1.22"
crc = "1.8"
crc32fast = "1.2"
crossbeam-channel = "0.5"
enum_dispatch = "0.3"
farmhash = "1.1"
crc32fast = "1.3.2"
crossbeam-channel = "0.5.5"
enum_dispatch = "0.3.8"
farmhash = "1.1.5"
getset = "0.1.2"
lazy_static = "1.4.0"
log = "0.4.17"
memmap2 = "0.3"
parking_lot = "0.11"
prost = "0.8"
memmap2 = "0.5.4"
parking_lot = "0.12.1"
prost = "0.10.4"
proto = { path = "proto" }
rand = "0.7"
rand = "0.8.5"
skiplist = { path = "skiplist" }
tempdir = "0.3"
thiserror = "1.0"
tempdir = "0.3.7"
thiserror = "1.0.31"
yatp = { git = "https://github.com/tikv/yatp.git" }

[dev-dependencies]
criterion = "0.3"
tempfile = "3"
criterion = "0.3.5"
tempfile = "3.3.0"

[target.'cfg(not(target_env = "msvc"))'.dev-dependencies]
tikv-jemallocator = "0.4.0"
tikv-jemallocator = "0.5.0"

[workspace]
members = [
"agate_bench",
"proto",
"skiplist"
]
members = ["agate_bench", "proto", "skiplist"]

[[bench]]
name = "bench_common"
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@

SANITIZER_FLAGS=-Zsanitizer=address

upgrade:
cargo upgrade --workspace

pre-format:
@rustup component add rustfmt
@cargo install -q cargo-sort
@cargo install -q cargo-sort

format: pre-format
@cargo fmt
@cargo sort -w ./Cargo.toml ./*/Cargo.toml > /dev/null
@cargo sort -w ./Cargo.toml ./*/Cargo.toml > /dev/null

clippy:
cargo clippy --all-targets --all-features --workspace -- -D "warnings"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ optimizations that have been made in [unistore][4].

[1]: https://github.com/tikv/tikv
[2]: https://github.com/tikv/agatedb/projects/1
[3]: https://github.com/dgraph-io/badger/tree/45bca18f24ef5cc04701a1e17448ddfce9372da0
[3]: https://github.com/outcaste-io/badger/tree/45bca18f24ef5cc04701a1e17448ddfce9372da0
[4]: https://github.com/ngaut/unistore

AgateDB is under active development on [develop](https://github.com/tikv/agatedb/tree/develop)
Expand Down
14 changes: 7 additions & 7 deletions agate_bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ enable-rocksdb = ["rocksdb"]

[dependencies]
agatedb = { path = "../" }
bytes = "1.0"
clap = "2.33"
indicatif = "0.15"
rand = "0.7"
rocksdb = { version = "0.15", optional = true }
threadpool = "1.8"
bytes = "1.1.0"
clap = "3.2.8"
indicatif = "0.16.2"
rand = "0.8.5"
rocksdb = { version = "0.18.0", optional = true }
threadpool = "1.8.1"
yatp = { git = "https://github.com/tikv/yatp.git" }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.4.0"
tikv-jemallocator = "0.5.0"
36 changes: 17 additions & 19 deletions agate_bench/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use std::{
path::PathBuf,
sync::{mpsc::channel, Arc},
time::{Duration, UNIX_EPOCH},
};

use agatedb::{AgateOptions, IteratorOptions};
use bytes::{Bytes, BytesMut};
use clap::clap_app;
use indicatif::{ProgressBar, ProgressStyle};
use rand::Rng;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::UNIX_EPOCH;
use std::{sync::mpsc::channel, time::Duration};

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;

Expand Down Expand Up @@ -126,14 +127,13 @@ fn main() {
let pool = threadpool::ThreadPool::new(threads);
let (tx, rx) = channel();

match matches.subcommand() {
("populate", Some(sub_matches)) => {
match matches.subcommand().unwrap() {
("populate", sub_matches) => {
let key_nums: u64 = sub_matches.value_of("key_nums").unwrap().parse().unwrap();
let value_size: usize = sub_matches.value_of("value_size").unwrap().parse().unwrap();
let chunk_size: u64 = sub_matches.value_of("chunk_size").unwrap().parse().unwrap();

let mut options = AgateOptions {
create_if_not_exists: true,
dir: directory.clone(),
value_dir: directory,
managed_txns: true,
Expand Down Expand Up @@ -169,7 +169,7 @@ fn main() {
let (key, value) = if seq {
gen_kv_pair(j, value_size)
} else {
gen_kv_pair(rng.gen_range(0, key_nums), value_size)
gen_kv_pair(rng.gen_range(0..key_nums), value_size)
};
txn.set(key, value).unwrap();
write.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
Expand Down Expand Up @@ -198,14 +198,13 @@ fn main() {
}
pb.finish_with_message("done");
}
("randread", Some(sub_matches)) => {
("randread", sub_matches) => {
let key_nums: u64 = sub_matches.value_of("key_nums").unwrap().parse().unwrap();
let value_size: usize = sub_matches.value_of("value_size").unwrap().parse().unwrap();
let chunk_size: u64 = sub_matches.value_of("chunk_size").unwrap().parse().unwrap();
let times: u64 = sub_matches.value_of("times").unwrap().parse().unwrap();

let mut options = AgateOptions {
create_if_not_exists: true,
sync_writes: true,
dir: directory.clone(),
value_dir: directory,
Expand Down Expand Up @@ -236,7 +235,7 @@ fn main() {
let txn = agate.new_transaction_at(unix_time(), false);
let mut rng = rand::thread_rng();
for _ in range {
let (key, _) = gen_kv_pair(rng.gen_range(0, key_nums), value_size);
let (key, _) = gen_kv_pair(rng.gen_range(0..key_nums), value_size);
match txn.get(&key) {
Ok(item) => {
assert_eq!(item.value().len(), value_size);
Expand Down Expand Up @@ -276,12 +275,11 @@ fn main() {
}
pb.finish_with_message("done");
}
("iterate", Some(sub_matches)) => {
("iterate", sub_matches) => {
let times: u64 = sub_matches.value_of("times").unwrap().parse().unwrap();
let value_size: usize = sub_matches.value_of("value_size").unwrap().parse().unwrap();

let mut options = AgateOptions {
create_if_not_exists: true,
sync_writes: true,
dir: directory.clone(),
value_dir: directory,
Expand Down Expand Up @@ -327,7 +325,7 @@ fn main() {
)
}
#[cfg(feature = "enable-rocksdb")]
("rocks_populate", Some(sub_matches)) => {
("rocks_populate", sub_matches) => {
let key_nums: u64 = sub_matches.value_of("key_nums").unwrap().parse().unwrap();
let value_size: usize = sub_matches.value_of("value_size").unwrap().parse().unwrap();
let chunk_size: u64 = sub_matches.value_of("chunk_size").unwrap().parse().unwrap();
Expand Down Expand Up @@ -369,7 +367,7 @@ fn main() {
let (key, value) = if seq {
gen_kv_pair(j, value_size)
} else {
gen_kv_pair(rng.gen_range(0, key_nums), value_size)
gen_kv_pair(rng.gen_range(0..key_nums), value_size)
};
batch.put(key, value);
write.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
Expand Down Expand Up @@ -399,7 +397,7 @@ fn main() {
pb.finish_with_message("done");
}
#[cfg(feature = "enable-rocksdb")]
("rocks_randread", Some(sub_matches)) => {
("rocks_randread", sub_matches) => {
let key_nums: u64 = sub_matches.value_of("key_nums").unwrap().parse().unwrap();
let value_size: usize = sub_matches.value_of("value_size").unwrap().parse().unwrap();
let chunk_size: u64 = sub_matches.value_of("chunk_size").unwrap().parse().unwrap();
Expand Down Expand Up @@ -431,7 +429,7 @@ fn main() {
let range = (i * chunk_size)..((i + 1) * chunk_size);
let mut rng = rand::thread_rng();
for _ in range {
let (key, _) = gen_kv_pair(rng.gen_range(0, key_nums), value_size);
let (key, _) = gen_kv_pair(rng.gen_range(0..key_nums), value_size);
match db.get(&key) {
Ok(Some(value)) => {
assert_eq!(value.len(), value_size);
Expand Down Expand Up @@ -471,7 +469,7 @@ fn main() {
pb.finish_with_message("done");
}
#[cfg(feature = "enable-rocksdb")]
("rocks_iterate", Some(sub_matches)) => {
("rocks_iterate", sub_matches) => {
let times: u64 = sub_matches.value_of("times").unwrap().parse().unwrap();
let value_size: usize = sub_matches.value_of("value_size").unwrap().parse().unwrap();

Expand Down
16 changes: 6 additions & 10 deletions benches/bench_iterator.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
mod common;

use agatedb::util::unix_time;
use agatedb::AgateIterator;
use agatedb::AgateOptions;
use agatedb::ConcatIterator;
use agatedb::Iterators;
use agatedb::MergeIterator;

use agatedb::{
util::unix_time, AgateIterator, AgateOptions, ConcatIterator, Iterators, MergeIterator,
};
use bytes::Bytes;
use common::get_table_for_benchmark;
use criterion::{criterion_group, criterion_main, Criterion};
Expand Down Expand Up @@ -58,7 +54,7 @@ fn bench_iterator(c: &mut Criterion) {

c.bench_function("iterate noprefix single key", |b| {
let txn = db.new_transaction_at(unix_time(), false);
let key_id = thread_rng().gen_range(0, N);
let key_id = thread_rng().gen_range(0..N);
let seek_key = key(key_id);
let it_opts = agatedb::IteratorOptions {
all_versions: true,
Expand Down Expand Up @@ -110,7 +106,7 @@ fn bench_merge_iterator(c: &mut Criterion) {
c.bench_function("merge iterator random read", |b| {
b.iter_batched(
|| {
let i = rng.gen_range(0, n);
let i = rng.gen_range(0..n);
(
Bytes::from(format!("{:016x}", i)),
Bytes::from(i.to_string()),
Expand Down Expand Up @@ -149,7 +145,7 @@ fn bench_concat_iterator(c: &mut Criterion) {
c.bench_function("concat iterator random read", |b| {
b.iter_batched(
|| {
let i = rng.gen_range(0, n);
let i = rng.gen_range(0..n);
(
Bytes::from(format!("{:016x}", i)),
Bytes::from(i.to_string()),
Expand Down
2 changes: 1 addition & 1 deletion benches/bench_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn bench_table(c: &mut Criterion) {

b.iter_batched(
|| {
let i = rng.gen_range(0, n);
let i = rng.gen_range(0..n);
(
Bytes::from(format!("{:016x}", i)),
Bytes::from(i.to_string()),
Expand Down
4 changes: 3 additions & 1 deletion benches/common.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#![allow(dead_code)]
use std::ops::{Deref, DerefMut};

use agatedb::{
opt::build_table_options, AgateOptions, ChecksumVerificationMode::NoVerification, Table,
TableBuilder, Value,
};
use bytes::Bytes;
use rand::{distributions::Alphanumeric, Rng};
use std::ops::{Deref, DerefMut};
use tempdir::TempDir;

pub fn rand_value() -> String {
rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(32)
.map(char::from)
.collect::<String>()
}

Expand Down
8 changes: 4 additions & 4 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
name = "proto"
version = "0.1.0"
authors = ["Jay Lee <busyjaylee@gmail.com>"]
edition = "2018"
edition = "2021"

[dependencies]
bytes = "1.0"
prost = "0.8"
bytes = "1.1.0"
prost = "0.10.4"

[build-dependencies]
prost-build = { version = "0.8" }
prost-build = "0.10.4"
10 changes: 5 additions & 5 deletions skiplist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
name = "skiplist"
version = "0.1.0"
authors = ["Jay Lee <busyjaylee@gmail.com>"]
edition = "2018"
edition = "2021"

[dependencies]
bytes = "1.0"
rand = "0.7"
bytes = "1.1.0"
rand = "0.8.5"

[dev-dependencies]
criterion = "0.3"
criterion = "0.3.5"
yatp = { git = "https://github.com/tikv/yatp.git" }

[target.'cfg(not(target_env = "msvc"))'.dev-dependencies]
tikv-jemallocator = "0.4.0"
tikv-jemallocator = "0.5.0"

[[bench]]
name = "bench"
Expand Down
8 changes: 4 additions & 4 deletions skiplist/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ fn bench_read_write_skiplist_frac(b: &mut Bencher<'_>, frac: &usize) {
let mut rng = rand::thread_rng();
while !s.load(Ordering::SeqCst) {
let key = random_key(&mut rng);
let case = (key, frac > rng.gen_range(0, 11));
let case = (key, frac > rng.gen_range(0..11));
skiplist_round(&l, &case, &v);
}
});
let mut rng = rand::thread_rng();
b.iter_batched_ref(
|| (random_key(&mut rng), frac > rng.gen_range(0, 11)),
|| (random_key(&mut rng), frac > rng.gen_range(0..11)),
|case| skiplist_round(&list, case, &value),
BatchSize::SmallInput,
);
Expand Down Expand Up @@ -104,15 +104,15 @@ fn bench_read_write_map_frac(b: &mut Bencher<'_>, frac: &usize) {
let h = thread::spawn(move || {
let mut rng = rand::thread_rng();
while !s.load(Ordering::SeqCst) {
let f = rng.gen_range(0, 11);
let f = rng.gen_range(0..11);
let case = (random_key(&mut rng), f < frac);
map_round(&m, &case, &v);
}
});
let mut rng = rand::thread_rng();
b.iter_batched_ref(
|| {
let f = rng.gen_range(0, 11);
let f = rng.gen_range(0..11);
(random_key(&mut rng), f < frac)
},
|case| map_round(&map, case, &value),
Expand Down
Loading