irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

irods_server_control_plane.hpp
Go to the documentation of this file.
1 
2 
3 
4 #ifndef SERVER_CONTROL_PLANE_HPP
5 #define SERVER_CONTROL_PLANE_HPP
6 
7 #include "zmq.hpp"
8 #include "boost/thread.hpp"
9 #include "boost/atomic.hpp"
10 #include "irods_lookup_table.hpp"
11 #include "server_control_plane_command.hpp"
12 #include "boost/unordered_map.hpp"
13 
14 namespace irods {
15  const std::string SERVER_CONTROL_OPTION_KW( "server_control_option" );
16  const std::string SERVER_CONTROL_HOST_KW( "server_control_host" );
17  const std::string SERVER_CONTROL_FORCE_AFTER_KW( "server_control_force_after" );
18  const std::string SERVER_CONTROL_WAIT_FOREVER_KW( "server_control_wait_forever" );
19 
20  const std::string SERVER_CONTROL_SHUTDOWN( "server_control_shutdown" );
21  const std::string SERVER_CONTROL_PAUSE( "server_control_pause" );
22  const std::string SERVER_CONTROL_RESUME( "server_control_resume" );
23  const std::string SERVER_CONTROL_STATUS( "server_control_status" );
24  const std::string SERVER_CONTROL_PING( "server_control_ping" );
25 
26  const std::string SERVER_CONTROL_ALL_OPT( "all" );
27  const std::string SERVER_CONTROL_HOSTS_OPT( "hosts" );
28  const std::string SERVER_CONTROL_SUCCESS( "server_control_success" );
29 
30 
31  const std::string SERVER_PAUSED_ERROR( "The server is Paused, resume before issuing any other commands" );
32 
33 
34  // this is a hand-chosen polling time for the control plane
35  static const size_t SERVER_CONTROL_POLLING_TIME_MILLI_SEC = 500;
36 
37  // derived from above - used to wait for the server to shut down or resume
39 
41  public:
42  // @brief constructor
44  server_control_executor( const std::string& ); // port property
45 
46  // @brief callable operator for thread work
47  void operator()();
48 
49  private:
50  // typedefs
51  typedef boost::function< error( const std::string&, const size_t, std::string& ) > ctrl_func_t;
52  typedef std::vector< std::string > host_list_t;
53 
54  // members
57  const zmq::message_t&, // incoming msg
58  std::string& ); // outgoing text
59 
61  const irods::control_plane_command&, // incoming command
62  std::string&, // command name
63  std::string&, // command option
64  std::string&, // wait option
65  size_t&, // wait time in seconds
66  host_list_t& ); // hostnames
68  const std::string&, // command
69  const std::string&, // wait option
70  const size_t&, // wait time in seconds
71  const host_list_t&, // hostnames
72  std::string& ); // outgoing text
74  const host_list_t&, // irods hostnames
75  const host_list_t&, // incoming hostnames
76  host_list_t& ); // valid hostnames
78  host_list_t& ); // fetched hostnames
80  const std::string&, // command
81  const std::string&, // command option
82  const std::string&, // wait option
83  const size_t&, // wait seconds
84  const host_list_t&, // irods hostnames
85  std::string& ); // output
87  const std::string&, // command
88  const std::string&, // command option
89  const std::string&, // wait option
90  const size_t&, // wait seconds
91  const host_list_t&, // irods hostnames
92  std::string& ); // output
94  const std::string&, // command name
95  const std::string&, // host
96  const std::string&, // port keyword
97  const std::string&, // wait option
98  const size_t&, // wait seconds
99  std::string& ); // output
100 
101  bool compare_host_names(
102  const std::string&, // host name 1
103  const std::string& ); // host name 2
104 
105  bool is_host_in_list(
106  const std::string&, // host name in question
107  const host_list_t& ); // list of candidates
108  // attributes
109  const std::string port_prop_;
110  boost::unordered_map< std::string, ctrl_func_t > op_map_;
111  std::string my_host_name_;
112  std::string icat_host_name_;
113 
114  }; // class server_control_executor
115 
117  public:
118  // @brief default constructor taking the port property
119  server_control_plane( const std::string& );
120 
121  // @brief destructor
123 
124  private:
125 
126  // @brief disallow copy constructor
128 
129  // @brief functor which manages the control
131 
132  // @brief thread which manages the control loop
133  boost::thread control_thread_;
134 
135  }; // server_control_plane
136 
137 }; // namespace irods
138 
139 #endif // SERVER_CONTROL_PLANE_HPP
140 
141 
142 
143 
irods::SERVER_CONTROL_OPTION_KW
const std::string SERVER_CONTROL_OPTION_KW("server_control_option")
irods::SERVER_CONTROL_PAUSE
const std::string SERVER_CONTROL_PAUSE("server_control_pause")
irods::server_control_executor::process_operation
error process_operation(const zmq::message_t &, std::string &)
Definition: irods_server_control_plane.cpp:1089
irods::SERVER_CONTROL_POLLING_TIME_MILLI_SEC
static const size_t SERVER_CONTROL_POLLING_TIME_MILLI_SEC
Definition: irods_server_control_plane.hpp:35
irods::server_control_executor::process_host_list
error process_host_list(const std::string &, const std::string &, const size_t &, const host_list_t &, std::string &)
Definition: irods_server_control_plane.cpp:1025
irods::server_control_plane::control_thread_
boost::thread control_thread_
Definition: irods_server_control_plane.hpp:133
irods::server_control_plane
Definition: irods_server_control_plane.hpp:116
irods::server_control_executor::get_resource_host_names
error get_resource_host_names(host_list_t &)
Definition: irods_server_control_plane.cpp:594
irods::server_control_executor::host_list_t
std::vector< std::string > host_list_t
Definition: irods_server_control_plane.hpp:52
irods::server_control_plane::server_control_plane
server_control_plane(const std::string &)
Definition: irods_server_control_plane.cpp:498
irods::server_control_executor::operator()
void operator()()
Definition: irods_server_control_plane.cpp:685
irods::SERVER_CONTROL_FORCE_AFTER_KW
const std::string SERVER_CONTROL_FORCE_AFTER_KW("server_control_force_after")
irods::server_control_plane::~server_control_plane
~server_control_plane()
Definition: irods_server_control_plane.cpp:506
irods::SERVER_CONTROL_ALL_OPT
const std::string SERVER_CONTROL_ALL_OPT("all")
irods::server_control_executor::forward_command
error forward_command(const std::string &, const std::string &, const std::string &, const std::string &, const size_t &, std::string &)
Definition: irods_server_control_plane.cpp:557
irods::SERVER_CONTROL_HOSTS_OPT
const std::string SERVER_CONTROL_HOSTS_OPT("hosts")
irods::SERVER_CONTROL_WAIT_FOREVER_KW
const std::string SERVER_CONTROL_WAIT_FOREVER_KW("server_control_wait_forever")
irods
Definition: apiHandler.hpp:35
irods::server_control_executor::notify_icat_and_local_servers_postop
error notify_icat_and_local_servers_postop(const std::string &, const std::string &, const std::string &, const size_t &, const host_list_t &, std::string &)
Definition: irods_server_control_plane.cpp:852
irods::SERVER_CONTROL_SUCCESS
const std::string SERVER_CONTROL_SUCCESS("server_control_success")
irods::server_control_executor::server_control_executor
server_control_executor(const server_control_executor &)
Definition: irods_server_control_plane.hpp:55
irods::SERVER_PAUSED_ERROR
const std::string SERVER_PAUSED_ERROR("The server is Paused, resume before issuing any other commands")
irods::server_control_plane::control_executor_
server_control_executor control_executor_
Definition: irods_server_control_plane.hpp:130
irods::SERVER_CONTROL_PING
const std::string SERVER_CONTROL_PING("server_control_ping")
irods::server_control_executor::my_host_name_
std::string my_host_name_
Definition: irods_server_control_plane.hpp:111
irods::server_control_executor::port_prop_
const std::string port_prop_
Definition: irods_server_control_plane.hpp:109
irods::server_control_executor::server_control_executor
server_control_executor()
Definition: irods_server_control_plane.hpp:43
irods::error
Definition: irods_error.hpp:23
irods::SERVER_CONTROL_SHUTDOWN
const std::string SERVER_CONTROL_SHUTDOWN("server_control_shutdown")
irods::server_control_executor
Definition: irods_server_control_plane.hpp:40
irods::server_control_executor::notify_icat_and_local_servers_preop
error notify_icat_and_local_servers_preop(const std::string &, const std::string &, const std::string &, const size_t &, const host_list_t &, std::string &)
Definition: irods_server_control_plane.cpp:798
irods::server_control_executor::ctrl_func_t
boost::function< error(const std::string &, const size_t, std::string &) > ctrl_func_t
Definition: irods_server_control_plane.hpp:51
irods::server_control_plane::server_control_plane
server_control_plane(server_control_plane &)
Definition: irods_server_control_plane.hpp:127
error
int error
Definition: filesystem.cpp:101
irods::SERVER_CONTROL_FWD_SLEEP_TIME_MILLI_SEC
static const size_t SERVER_CONTROL_FWD_SLEEP_TIME_MILLI_SEC
Definition: irods_server_control_plane.hpp:38
irods::server_control_executor::compare_host_names
bool compare_host_names(const std::string &, const std::string &)
Definition: irods_server_control_plane.cpp:456
irods::server_control_executor::validate_host_list
error validate_host_list(const host_list_t &, const host_list_t &, host_list_t &)
Definition: irods_server_control_plane.cpp:901
irods::server_control_executor::extract_command_parameters
error extract_command_parameters(const irods::control_plane_command &, std::string &, std::string &, std::string &, size_t &, host_list_t &)
Definition: irods_server_control_plane.cpp:946
irods::SERVER_CONTROL_RESUME
const std::string SERVER_CONTROL_RESUME("server_control_resume")
irods::server_control_executor::icat_host_name_
std::string icat_host_name_
Definition: irods_server_control_plane.hpp:112
irods::server_control_executor::is_host_in_list
bool is_host_in_list(const std::string &, const host_list_t &)
Definition: irods_server_control_plane.cpp:480
irods::server_control_executor::op_map_
boost::unordered_map< std::string, ctrl_func_t > op_map_
Definition: irods_server_control_plane.hpp:110
irods::SERVER_CONTROL_STATUS
const std::string SERVER_CONTROL_STATUS("server_control_status")
irods::SERVER_CONTROL_HOST_KW
const std::string SERVER_CONTROL_HOST_KW("server_control_host")
irods_lookup_table.hpp