basic layout of sync executable and minor fixes in the api

This commit is contained in:
NikVolf
2016-07-15 15:32:29 +02:00
parent c60e02d151
commit 507a4ea26c
7 changed files with 162 additions and 6 deletions

View File

@@ -33,11 +33,12 @@ use service::{HypervisorService, IpcModuleId};
use std::process::{Command,Child};
use std::collections::HashMap;
pub use service::{HypervisorServiceClient, CLIENT_MODULE_ID};
pub use service::{HypervisorServiceClient, CLIENT_MODULE_ID, SYNC_MODULE_ID};
type BinaryId = &'static str;
const CLIENT_BINARY: BinaryId = "client";
const SYNC_BINARY: BinaryId = "sync";
pub struct Hypervisor {
ipc_addr: String,
@@ -76,6 +77,7 @@ impl Hypervisor {
fn match_module(module_id: &IpcModuleId) -> Option<BinaryId> {
match *module_id {
CLIENT_MODULE_ID => Some(CLIENT_BINARY),
SYNC_MODULE_ID => Some(SYNC_BINARY),
// none means the module is inside the main binary
_ => None
}

View File

@@ -26,6 +26,9 @@ pub type IpcModuleId = u64;
/// Blockhain database module id
pub const CLIENT_MODULE_ID: IpcModuleId = 2000;
/// Sync module id
pub const SYNC_MODULE_ID: IpcModuleId = 2100;
/// IPC service that handles module management
pub struct HypervisorService {
check_list: RwLock<HashMap<IpcModuleId, bool>>,