Fetching multiple remote values using single message (#3612)

* multiple remote values in single message

* keys_str: String ->keys_str: closure
This commit is contained in:
Svyatoslav Nikolsky
2019-09-16 13:30:21 +03:00
committed by GitHub
parent c45a15e559
commit 849e824652
11 changed files with 273 additions and 190 deletions
+1 -57
View File
@@ -36,12 +36,9 @@ pub use state_machine::ExecutionStrategy;
use std::sync::Arc;
use std::collections::HashMap;
use futures::future::Ready;
use hash_db::Hasher;
use primitives::storage::well_known_keys;
use sr_primitives::traits::{
Block as BlockT, NumberFor
};
use sr_primitives::traits::Block as BlockT;
use client::LocalCallExecutor;
/// Test client light database backend.
@@ -50,9 +47,6 @@ pub type LightBackend<Block> = client::light::backend::Backend<
Blake2Hasher,
>;
/// Test client light fetcher.
pub struct LightFetcher;
/// A genesis storage initialisation trait.
pub trait GenesisInit: Default {
/// Construct genesis storage.
@@ -231,53 +225,3 @@ impl<E, Backend, G: GenesisInit> TestClientBuilder<
self.build_with_executor(executor)
}
}
impl<Block: BlockT> client::light::fetcher::Fetcher<Block> for LightFetcher {
type RemoteHeaderResult = Ready<Result<Block::Header, client::error::Error>>;
type RemoteReadResult = Ready<Result<Option<Vec<u8>>, client::error::Error>>;
type RemoteCallResult = Ready<Result<Vec<u8>, client::error::Error>>;
type RemoteChangesResult = Ready<Result<Vec<(NumberFor<Block>, u32)>, client::error::Error>>;
type RemoteBodyResult = Ready<Result<Vec<Block::Extrinsic>, client::error::Error>>;
fn remote_header(
&self,
_request: client::light::fetcher::RemoteHeaderRequest<Block::Header>,
) -> Self::RemoteHeaderResult {
unimplemented!("not (yet) used in tests")
}
fn remote_read(
&self,
_request: client::light::fetcher::RemoteReadRequest<Block::Header>,
) -> Self::RemoteReadResult {
unimplemented!("not (yet) used in tests")
}
fn remote_read_child(
&self,
_request: client::light::fetcher::RemoteReadChildRequest<Block::Header>,
) -> Self::RemoteReadResult {
unimplemented!("not (yet) used in tests")
}
fn remote_call(
&self,
_request: client::light::fetcher::RemoteCallRequest<Block::Header>,
) -> Self::RemoteCallResult {
unimplemented!("not (yet) used in tests")
}
fn remote_changes(
&self,
_request: client::light::fetcher::RemoteChangesRequest<Block::Header>,
) -> Self::RemoteChangesResult {
unimplemented!("not (yet) used in tests")
}
fn remote_body(
&self,
_request: client::light::fetcher::RemoteBodyRequest<Block::Header>,
) -> Self::RemoteBodyResult {
unimplemented!("not (yet) used in tests")
}
}