diff --git a/service/src/daemon.rs b/service/src/daemon.rs
index 1134da0c055..9c3fbadeb50 100644
--- a/service/src/daemon.rs
+++ b/service/src/daemon.rs
@@ -12,10 +12,12 @@ use std::convert::From;
use std::fmt::{Display, Formatter};
use std::ops::Deref;
use std::process;
+use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{Receiver, Sender};
-use std::sync::Arc;
+use std::sync::{Arc, Mutex};
use std::thread::{Builder, JoinHandle};
+use mio::{Events, Poll, Token, Waker};
use nydus_api::BuildTimeInfo;
use rust_fsm::*;
use serde::{self, Serialize};
@@ -337,6 +339,131 @@ pub trait DaemonStateMachineSubscriber {
fn on_event(&self, event: DaemonStateMachineInput) -> Result<()>;
}
+/// Controller to manage registered filesystem/blobcache/fscache services.
+pub struct DaemonController {
+ active: AtomicBool,
+ singleton_mode: AtomicBool,
+ daemon: Mutex