36 #include <boost/algorithm/string.hpp>
37 #include <boost/thread/exceptions.hpp>
47 using namespace boost;
59 int main(
int argc,
char **argv) {
71 init_with_policy<MyPolicy>(argc, argv);
75 int32_t timeout =
has(
"timeout") ? get_i32(
"timeout") : 10000;
76 silent =
has(
"silent") && get_bool(
"silent");
78 session_ptr = make_shared<Hyperspace::Session>(comm,
properties);
79 session_ptr->add_callback(&session_handler);
81 interp = session_ptr->create_hs_interpreter();
82 shell = make_shared<CommandShell>(
"hyperspace",
"Hyperspace", interp,
properties);
83 interp->set_silent(shell->silent());
84 interp->set_test_mode(shell->test_mode());
86 if (
has(
"induce-failure")) {
92 if(!session_ptr->wait_for_connection(timeout)) {
94 cout <<
"Hyperspace CRITICAL - connect error" << endl;
98 HsClientState::exit_status = shell->run();
104 const char *msg = e.what();
106 cout <<
" - " << msg;
static Comm * instance()
Creates/returns singleton instance of the Comm class.
A callback object derived from this class gets passed into the constructor of Hyperspace.
The FailureInducer simulates errors.
PropertiesPtr properties
This singleton map stores all options.
static FailureInducer * instance
This is a singleton class.
bool has(const String &name)
Check existence of a configuration value.
std::shared_ptr< Session > SessionPtr
const char * get_text(int error)
Returns a descriptive error message.
Helpers to compose init policies; allow to combine two policies into one.
virtual void reconnected()
Compatibility Macros for C/C++.
void parse_option(String spec)
Parses a spec string (as explained above) and stores it in an internal structure. ...
Initialization helper for applications.
std::shared_ptr< CommandInterpreter > CommandInterpreterPtr
std::shared_ptr< CommandShell > CommandShellPtr
Entry point to AsyncComm service.
This is a generic exception class for Hypertable.
int main(int argc, char **argv)
virtual void disconnected()
int code() const
Returns the error code.