fix warnings
This commit is contained in:
parent
1b2ef60bbe
commit
7ac985dded
@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
//! Parity interprocess hypervisor module
|
//! Parity interprocess hypervisor module
|
||||||
|
|
||||||
|
// while not in binary
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
pub mod service;
|
pub mod service;
|
||||||
|
|
||||||
pub const HYPERVISOR_IPC_URL: &'static str = "ipc:///tmp/parity-internal-hyper-status.ipc";
|
pub const HYPERVISOR_IPC_URL: &'static str = "ipc:///tmp/parity-internal-hyper-status.ipc";
|
||||||
@ -23,7 +26,6 @@ pub const HYPERVISOR_IPC_URL: &'static str = "ipc:///tmp/parity-internal-hyper-s
|
|||||||
use nanoipc;
|
use nanoipc;
|
||||||
use std::sync::{Arc,RwLock};
|
use std::sync::{Arc,RwLock};
|
||||||
use hypervisor::service::*;
|
use hypervisor::service::*;
|
||||||
use ipc::IpcInterface;
|
|
||||||
|
|
||||||
pub struct Hypervisor {
|
pub struct Hypervisor {
|
||||||
service: Arc<HypervisorService>,
|
service: Arc<HypervisorService>,
|
||||||
@ -42,7 +44,7 @@ impl Hypervisor {
|
|||||||
|
|
||||||
fn with_url_and_service(addr: &str, service: Arc<HypervisorService>) -> Arc<Hypervisor> {
|
fn with_url_and_service(addr: &str, service: Arc<HypervisorService>) -> Arc<Hypervisor> {
|
||||||
let mut worker = nanoipc::Worker::new(&service);
|
let mut worker = nanoipc::Worker::new(&service);
|
||||||
worker.add_reqrep(addr);
|
worker.add_reqrep(addr).expect("Hypervisor ipc worker can not start - critical!");
|
||||||
|
|
||||||
Arc::new(Hypervisor{
|
Arc::new(Hypervisor{
|
||||||
service: service,
|
service: service,
|
||||||
@ -73,8 +75,9 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn can_init() {
|
fn can_init() {
|
||||||
let url = "ipc:///tmp/test-parity-hypervisor-10.ipc";
|
let url = "ipc:///tmp/test-parity-hypervisor-10.ipc";
|
||||||
|
let test_module_id = 8080u64;
|
||||||
|
|
||||||
let hypervisor = Hypervisor::with_url(url);
|
let hypervisor = Hypervisor::with_url_and_service(url, HypervisorService::with_modules(vec![test_module_id]));
|
||||||
assert_eq!(false, hypervisor.modules_ready());
|
assert_eq!(false, hypervisor.modules_ready());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
pub type IpcModuleId = u64;
|
pub type IpcModuleId = u64;
|
||||||
|
|
||||||
pub const DATABASE_MODULE_ID: IpcModuleId = 1000;
|
pub const _DATABASE_MODULE_ID: IpcModuleId = 1000;
|
||||||
pub const BLOCKCHAIN_MODULE_ID: IpcModuleId = 2000;
|
pub const _BLOCKCHAIN_MODULE_ID: IpcModuleId = 2000;
|
||||||
|
|
||||||
pub struct HypervisorService {
|
pub struct HypervisorService {
|
||||||
check_list: RwLock<HashMap<IpcModuleId, bool>>,
|
check_list: RwLock<HashMap<IpcModuleId, bool>>,
|
||||||
@ -39,7 +39,7 @@ impl HypervisorService {
|
|||||||
|
|
||||||
impl HypervisorService {
|
impl HypervisorService {
|
||||||
pub fn new() -> Arc<HypervisorService> {
|
pub fn new() -> Arc<HypervisorService> {
|
||||||
HypervisorService::with_modules(vec![DATABASE_MODULE_ID])
|
HypervisorService::with_modules(vec![])
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_modules(module_ids: Vec<IpcModuleId>) -> Arc<HypervisorService> {
|
pub fn with_modules(module_ids: Vec<IpcModuleId>) -> Arc<HypervisorService> {
|
||||||
|
Loading…
Reference in New Issue
Block a user