avoid timer in light client (#4602)

This commit is contained in:
Nikolay Volf
2020-01-11 20:22:40 +03:00
committed by Bastian Köcher
parent 08e6df0faf
commit e00ddc5614
+9
View File
@@ -63,6 +63,8 @@ pub struct LightStorage<Block: BlockT> {
meta: RwLock<Meta<NumberFor<Block>, Block::Hash>>,
cache: Arc<DbCacheSync<Block>>,
header_metadata_cache: HeaderMetadataCache<Block>,
#[cfg(not(target_os = "unknown"))]
io_stats: FrozenForDuration<kvdb::IoStats>,
}
@@ -102,6 +104,7 @@ impl<Block> LightStorage<Block>
meta: RwLock::new(meta),
cache: Arc::new(DbCacheSync(RwLock::new(cache))),
header_metadata_cache: HeaderMetadataCache::default(),
#[cfg(not(target_os = "unknown"))]
io_stats: FrozenForDuration::new(std::time::Duration::from_secs(1), kvdb::IoStats::empty()),
})
}
@@ -558,6 +561,7 @@ impl<Block> LightBlockchainStorage<Block> for LightStorage<Block>
Some(self.cache.clone())
}
#[cfg(not(target_os = "unknown"))]
fn usage_info(&self) -> Option<UsageInfo> {
use sc_client_api::{MemoryInfo, IoInfo};
@@ -579,6 +583,11 @@ impl<Block> LightBlockchainStorage<Block> for LightStorage<Block>
}
})
}
#[cfg(target_os = "unknown")]
fn usage_info(&self) -> Option<UsageInfo> {
None
}
}
/// Build the key for inserting header-CHT at given block.