Update kvdb version in availability-store (#709)

* update availability store

* also fix warning

* update Cargo.lock
This commit is contained in:
Nikolay Volf
2020-01-03 21:31:04 +03:00
committed by Gavin Wood
parent 11b1bf230e
commit 9a9bbd1c2d
4 changed files with 50 additions and 12 deletions
+3 -3
View File
@@ -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"
+1 -1
View File
@@ -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>,
+5 -5
View File
@@ -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");