Remove secret_store runtimes. (#9888)
* Remove the independent runtimes from `KeyServerHttpListener` and
`KeyServerCore` and instead require a `parity_runtime::Executor`
to be passed upon creation of each.
* Remove the `threads` parameter from both `ClusterConfiguration` structs.
* Implement the `future::Executor` trait for `parity_runtime::Executor`.
* Update tests.
- Update the `loop_until` function to instead use a oneshot to signal
completion.
- Modify the `make_key_servers` function to create and return a runtime.
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
|
||||
//! Tokio Runtime wrapper.
|
||||
|
||||
extern crate futures;
|
||||
extern crate tokio;
|
||||
pub extern crate futures;
|
||||
pub extern crate tokio;
|
||||
|
||||
use std::{fmt, thread};
|
||||
use std::sync::mpsc;
|
||||
@@ -222,6 +222,24 @@ impl Executor {
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: Future<Item = (), Error = ()> + Send + 'static> future::Executor<F> for Executor {
|
||||
fn execute(&self, future: F) -> Result<(), future::ExecuteError<F>> {
|
||||
match self.inner {
|
||||
Mode::Tokio(ref executor) => executor.execute(future),
|
||||
Mode::Sync => {
|
||||
let _= future.wait();
|
||||
Ok(())
|
||||
},
|
||||
Mode::ThreadPerFuture => {
|
||||
thread::spawn(move || {
|
||||
let _= future.wait();
|
||||
});
|
||||
Ok(())
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A handle to a runtime. Dropping the handle will cause runtime to shutdown.
|
||||
pub struct RuntimeHandle {
|
||||
close: Option<futures::Complete<()>>,
|
||||
|
||||
Reference in New Issue
Block a user