DDS  ver. 1.6
ConnectionManager.h
Go to the documentation of this file.
1 // Copyright 2014 GSI, Inc. All rights reserved.
2 //
3 //
4 //
5 #ifndef __DDS__ConnectionManager__
6 #define __DDS__ConnectionManager__
7 // DDS
8 #include "AgentChannel.h"
10 #include "KeyValueManager.h"
11 #include "Options.h"
12 #include "SSHScheduler.h"
13 #include "Topology.h"
14 #include "UIChannelInfo.h"
15 // STD
16 #include <condition_variable>
17 #include <mutex>
18 
19 namespace dds
20 {
21  namespace commander_cmd
22  {
23  class CConnectionManager : public protocol_api::CConnectionManagerImpl<CAgentChannel, CConnectionManager>,
24  public std::enable_shared_from_this<CConnectionManager>
25  {
26  public:
27  CConnectionManager(const SOptions_t& _options);
28 
30 
31  public:
33  void _start();
34  void _stop();
35  void _createInfoFile(const std::vector<size_t>& _ports) const;
36  void _deleteInfoFile() const;
37 
38  private:
39  bool on_cmdGET_AGENTS_INFO(
44  bool on_cmdBINARY_ATTACHMENT_RECEIVED(
49  bool on_cmdTRANSPORT_TEST(
56  bool on_cmdUSER_TASK_DONE(
59  bool on_cmdGET_PROP_LIST(
62  bool on_cmdGET_PROP_VALUES(
65  bool on_cmdUPDATE_TOPOLOGY(
70  bool on_cmdENABLE_STAT(
73  bool on_cmdDISABLE_STAT(
80 
81  private:
82  void activateTasks(const CSSHScheduler& _shceduler);
83  void stopTasks(const CAgentChannel::weakConnectionPtrVector_t& _agents,
85  bool _shutdownOnComplete);
86  void enableDisableStatForChannels(bool _enable);
87  void _createWnPkg(bool _needInlineBashScript) const;
88 
89  private:
90  CGetLogChannelInfo m_getLog;
91  CTestChannelInfo m_transportTest;
92  CUpdateTopologyChannelInfo m_updateTopology;
93  CSubmitAgentsChannelInfo m_SubmitAgents;
95 
96  // TODO: This is temporary storage only. Store this information as a part of scheduler.
97  typedef std::map<uint64_t, CAgentChannel::weakConnectionPtr_t> TaskIDToAgentChannelMap_t;
98  TaskIDToAgentChannelMap_t m_taskIDToAgentChannelMap;
99  std::mutex m_mapMutex;
100 
101  CKeyValueManager m_keyValueManager;
102 
103  std::mutex m_stopTasksMutex;
104  std::condition_variable m_stopTasksCondition;
105 
106  // Statistic on/off flag
107  bool m_statEnabled;
108  };
109  }
110 }
111 #endif /* defined(__DDS__ConnectionManager__) */
void _start()
Definition: ConnectionManager.cpp:51
std::shared_ptr< CAgentChannel > connectionPtr_t
Definition: BaseChannelImpl.h:192
void _stop()
Definition: ConnectionManager.cpp:72
std::shared_ptr< SEmptyCmd > ptr_t
Definition: CommandAttachmentImpl.h:65
void _createInfoFile(const std::vector< size_t > &_ports) const
Definition: ConnectionManager.cpp:230
Definition: UIChannelInfo.h:185
Definition: UIChannelInfo.h:222
Definition: ConnectionManager.h:23
std::weak_ptr< CAgentChannel > weakConnectionPtr_t
Definition: BaseChannelImpl.h:193
CConnectionManager(const SOptions_t &_options)
Definition: ConnectionManager.cpp:40
Definition: UIChannelInfo.h:270
Definition: dds-agent/src/AgentConnectionManager.h:16
void newClientCreated(CAgentChannel::connectionPtr_t _newClient)
Definition: ConnectionManager.cpp:76
Definition: Topology.h:42
Key-value manager for the DDS commander.
Definition: KeyValueManager.h:105
dds-commander&#39;s container of options
Definition: dds-commander/src/Options.h:24
std::vector< weakConnectionPtr_t > weakConnectionPtrVector_t
Definition: BaseChannelImpl.h:195
Definition: SSHScheduler.h:19
void _deleteInfoFile() const
Definition: ConnectionManager.cpp:266
~CConnectionManager()
Definition: ConnectionManager.cpp:47
Base class for connection managers.
Definition: ConnectionManagerImpl.h:32
Definition: UIChannelInfo.h:309