Commit dd113a7b authored by Nikolay Volf's avatar Nikolay Volf Committed by Gavin Wood
Browse files

Update kvdb version in availability-store (#709)

* update availability store

* also fix warning

* update Cargo.lock
parent d3e2d9e6
......@@ -2046,6 +2046,15 @@ dependencies = [
"parity-bytes 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kvdb"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"parity-bytes 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kvdb-memorydb"
version = "0.1.2"
......@@ -2055,6 +2064,15 @@ dependencies = [
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kvdb-memorydb"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kvdb 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kvdb-rocksdb"
version = "0.2.0"
......@@ -2072,6 +2090,23 @@ dependencies = [
"rocksdb 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kvdb-rocksdb"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fs-swap 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"interleaved-ordered 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
"owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rocksdb 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kvdb-web"
version = "0.1.1"
......@@ -3596,9 +3631,9 @@ dependencies = [
"derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)",
"exit-future 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb-memorydb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb-rocksdb 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb-memorydb 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb-rocksdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -7304,8 +7339,11 @@ dependencies = [
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c54d9f465d530a752e6ebdc217e081a7a614b48cb200f6f0aee21ba6bc9aabb"
"checksum kvdb 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c1b2f251f01a7224426abdb2563707d856f7de995d821744fd8fa8e2874f69e3"
"checksum kvdb 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cecee8d85a74f6b8284710d52a7d1196f09e31f8217e1f184a475b509d360554"
"checksum kvdb-memorydb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "296c12309ed36cb74d59206406adbf1971c3baa56d5410efdb508d8f1c60a351"
"checksum kvdb-memorydb 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0a5d70712b1fe0f02ce7ee36a962fcb0b15d0fe11262ba21a4aa839ef22cf60d"
"checksum kvdb-rocksdb 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f82177237c1ae67d6ab208a6f790cab569a1d81c1ba02348e0736a99510be3"
"checksum kvdb-rocksdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "54cc6b52f7e511de9f07fd77cda70247adfc6b8192e4b5a1b6dbca416dc425b5"
"checksum kvdb-web 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a5dddd64e88162576fdfbffc5409be89e10f95d367203321c30f8466a7774258"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
......
......@@ -25,8 +25,8 @@ sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "pol
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
kvdb = "0.1.1"
kvdb-memorydb = "0.1.2"
kvdb = "0.2.0"
kvdb-memorydb = "0.2.0"
[target.'cfg(not(target_os = "unknown"))'.dependencies]
kvdb-rocksdb = "0.2"
kvdb-rocksdb = "0.3"
......@@ -198,7 +198,7 @@ impl Store {
client: Arc<P>,
thread_pool: TaskExecutor,
keystore: KeyStorePtr,
) -> ClientResult<(AvailabilityBlockImport<I, P>)>
) -> ClientResult<AvailabilityBlockImport<I, P>>
where
P: ProvideRuntimeApi + BlockchainEvents<Block> + BlockBody<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block>,
......
......@@ -35,8 +35,8 @@ use std::io;
use crate::{LOG_TARGET, Data, Config};
mod columns {
pub const DATA: Option<u32> = Some(0);
pub const META: Option<u32> = Some(1);
pub const DATA: u32 = 0;
pub const META: u32 = 1;
pub const NUM_COLUMNS: u32 = 2;
}
......@@ -85,12 +85,12 @@ impl Store {
/// Create a new `Store` with given condig on disk.
#[cfg(not(target_os = "unknown"))]
pub(super) fn new(config: Config) -> io::Result<Self> {
let mut db_config = DatabaseConfig::with_columns(Some(columns::NUM_COLUMNS));
let mut db_config = DatabaseConfig::with_columns(columns::NUM_COLUMNS);
if let Some(cache_size) = config.cache_size {
let mut memory_budget = std::collections::HashMap::new();
for i in 0..columns::NUM_COLUMNS {
memory_budget.insert(Some(i), cache_size / columns::NUM_COLUMNS as usize);
memory_budget.insert(i, cache_size / columns::NUM_COLUMNS as usize);
}
db_config.memory_budget = memory_budget;
......@@ -396,7 +396,7 @@ impl Store {
self.query_inner(columns::META, &block_to_candidate_key(&block_hash))
}
fn query_inner<T: Decode>(&self, column: Option<u32>, key: &[u8]) -> Option<T> {
fn query_inner<T: Decode>(&self, column: u32, key: &[u8]) -> Option<T> {
match self.inner.get(column, key) {
Ok(Some(raw)) => {
let res = T::decode(&mut &raw[..]).expect("all stored data serialized correctly; qed");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment