Skip to content

Commit

Permalink
Migrated code to 2018 edition, updated dependencies (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashley authored and dvdplm committed Sep 22, 2019
1 parent 6a580c1 commit baf1df9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
9 changes: 5 additions & 4 deletions kvdb-rocksdb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
[package]
name = "kvdb-rocksdb"
version = "0.1.4"
version = "0.1.5"
authors = ["Parity Technologies <admin@parity.io>"]
repository = "https://github.com/paritytech/parity-common"
description = "kvdb implementation backed by rocksDB"
license = "GPL-3.0"
edition = "2018"

[dependencies]
elastic-array = "0.10"
fs-swap = "0.2.4"
interleaved-ordered = "0.1.0"
kvdb = { version = "0.1", path = "../kvdb" }
log = "0.4"
num_cpus = "1.0"
parking_lot = "0.6"
regex = "1.0"
num_cpus = "1.10"
parking_lot = "0.9"
regex = "1.3"
parity-rocksdb = "0.5"

[dev-dependencies]
Expand Down
31 changes: 8 additions & 23 deletions kvdb-rocksdb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

#[macro_use]
extern crate log;

extern crate elastic_array;
extern crate fs_swap;
extern crate interleaved_ordered;
extern crate num_cpus;
extern crate parking_lot;
extern crate regex;
extern crate parity_rocksdb;

#[cfg(test)]
extern crate ethereum_types;

extern crate kvdb;

use std::collections::HashMap;
use std::marker::PhantomData;
use std::{cmp, fs, io, mem, result, error};
use std::path::Path;
use std::{
cmp, fs, io, mem, result, error,
collections::HashMap, marker::PhantomData, path::Path
};

use parking_lot::{Mutex, MutexGuard, RwLock};
use parity_rocksdb::{
Expand All @@ -42,6 +26,7 @@ use parity_rocksdb::{
};
use interleaved_ordered::{interleave_ordered, InterleaveOrdered};

use log::{debug, warn};
use elastic_array::ElasticArray32;
use fs_swap::{swap, swap_nonatomic};
use kvdb::{KeyValueDB, DBTransaction, DBValue, DBOp};
Expand All @@ -55,7 +40,7 @@ use std::fs::File;
#[cfg(target_os = "linux")]
use std::path::PathBuf;

fn other_io_err<E>(e: E) -> io::Error where E: Into<Box<error::Error + Send + Sync>> {
fn other_io_err<E>(e: E) -> io::Error where E: Into<Box<dyn error::Error + Send + Sync>> {
io::Error::new(io::ErrorKind::Other, e)
}

Expand Down Expand Up @@ -692,13 +677,13 @@ impl KeyValueDB for Database {
Database::flush(self)
}

fn iter<'a>(&'a self, col: Option<u32>) -> Box<Iterator<Item=(Box<[u8]>, Box<[u8]>)> + 'a> {
fn iter<'a>(&'a self, col: Option<u32>) -> Box<dyn Iterator<Item=(Box<[u8]>, Box<[u8]>)> + 'a> {
let unboxed = Database::iter(self, col);
Box::new(unboxed.into_iter().flat_map(|inner| inner))
}

fn iter_from_prefix<'a>(&'a self, col: Option<u32>, prefix: &'a [u8])
-> Box<Iterator<Item=(Box<[u8]>, Box<[u8]>)> + 'a>
-> Box<dyn Iterator<Item=(Box<[u8]>, Box<[u8]>)> + 'a>
{
let unboxed = Database::iter_from_prefix(self, col, prefix);
Box::new(unboxed.into_iter().flat_map(|inner| inner))
Expand Down

0 comments on commit baf1df9

Please sign in to comment.