5 #ifndef __AGENT_OPER_INSTANCE_MANAGER_H__
6 #define __AGENT_OPER_INSTANCE_MANAGER_H__
8 #include <boost/uuid/uuid.hpp>
21 #define INSTANCE_MANAGER_TRACE(obj, ...) \
23 InstanceManager##obj::TraceMsg(InstanceManagerTraceBuf, __FILE__, __LINE__, __VA_ARGS__);\
77 void Initialize(
DB *database,
const std::string &netns_cmd,
78 const std::string &docker_cmd,
const int netns_workers,
79 const int netns_timeout);
151 typedef std::map<InstanceTask *, ServiceInstance *>
TaskSvcMap;
255 boost::system::error_code
ec_;
void InitSigHandler(AgentSignal *signal)
void UpdateStateStatusType(InstanceManagerChildEvent event)
SandeshTraceBufferPtr InstanceManagerTraceBuf
std::map< std::string, int > last_cmd_types_
void SetNamespaceStorePath(std::string path)
void Enqueue(InstanceTask *task, const boost::uuids::uuid &uuid)
DISALLOW_COPY_AND_ASSIGN(InstanceManager)
void StopServiceInstance(ServiceInstance *svc_instance, InstanceState *state)
std::vector< InstanceTaskQueue * > task_queues_
TaskSvcMap task_svc_instances_
std::map< InstanceTask *, ServiceInstance * > TaskSvcMap
DBTableBase::ListenerId si_listener_
void RegisterSvcInstance(InstanceTask *task, ServiceInstance *svc_instance)
void SetStaleTimerInterval(int minutes)
void StopStaleNetNS(ServiceInstance::Properties &props)
void UnregisterSvcInstance(ServiceInstance *svc_instance)
void set_cmd(const std::string &cmd)
void OnErrorEventHandler(InstanceManagerChildEvent event)
InstanceTaskQueue * task_queue
std::vector< InstanceManagerAdapter * > adapters_
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
void OnTaskTimeout(InstanceTaskQueue *task_queue)
void set_pid(const pid_t &pid)
static const int kReattemptsDefault
int stale_timer_interval_
std::string loadbalancer_config_path_
ServiceInstance::Properties properties_
void RegisterSigHandler()
InstanceTaskQueue * GetTaskQueue(const std::string &str)
InstanceState * GetState(ServiceInstance *) const
WorkQueue< InstanceManagerChildEvent > work_queue_
void StartServiceInstance(ServiceInstance *svc_instance, InstanceState *state, bool update)
ServiceInstance * GetSvcInstance(InstanceTask *task) const
void set_properties(const ServiceInstance::Properties &properties)
int GetLastCmdType(ServiceInstance *svc_instance) const
void OnExit(InstanceTask *task, const boost::system::error_code &ec)
std::string errors() const
void Initialize(DB *database, const std::string &netns_cmd, const std::string &docker_cmd, const int netns_workers, const int netns_timeout)
void ScheduleNextTask(InstanceTaskQueue *task_queue)
const ServiceInstance::Properties & properties() const
boost::system::error_code ec_
void set_status(const int status)
std::unique_ptr< NamespaceStaleCleaner > stale_cleaner_
bool StartTask(InstanceTaskQueue *task_queue, InstanceTask *task)
void OnTaskTimeoutEventHandler(InstanceManagerChildEvent event)
static const int kWorkersDefault
static const int kTimeoutDefault
void OnExitEventHandler(InstanceManagerChildEvent event)
int tasks_running() const
InstanceManagerAdapter * FindApplicableAdapter(const ServiceInstance::Properties &props)
InstanceManagerChildEvent()
void OnError(InstanceTask *task, const std::string errors)
void EventObserver(DBTablePartBase *db_part, DBEntryBase *entry)
std::string namespace_store_path_
void SetState(ServiceInstance *svc_instance, InstanceState *state)
void ClearState(ServiceInstance *svc_instance)
void set_errors(const std::string &errors)
bool DequeueEvent(InstanceManagerChildEvent event)
friend class InstanceManagerTest
void SetNetNSCmd(const std::string &netns_cmd)
void SetLastCmdType(ServiceInstance *svc_instance, int last_cmd_type)
bool DeleteState(ServiceInstance *svc_instance)
void ClearLastCmdType(ServiceInstance *svc_instance)
void set_status_type(const int status)