46 #include <boost/algorithm/string.hpp>
60 Client::Client(
const string &install_dir,
const string &config_file,
61 uint32_t default_timeout_ms)
62 : m_timeout_ms(default_timeout_ms), m_install_dir(install_dir) {
63 lock_guard<recursive_mutex> lock(
rec_mutex);
66 init_with_policy<DefaultCommPolicy>(0, 0);
73 : m_timeout_ms(default_timeout_ms), m_install_dir(install_dir) {
74 lock_guard<recursive_mutex> lock(
rec_mutex);
77 init_with_policy<DefaultCommPolicy>(0, 0);
89 string sub_name = name;
92 if (create_intermediate)
100 full_name += sub_name;
108 string sub_name = name;
116 full_name += sub_name;
123 bool is_namespace =
false;
125 string sub_name = name;
133 full_name += sub_name;
135 if (!
m_namemap->name_to_id(full_name,
id, &is_namespace) || !is_namespace)
152 string sub_name = name;
156 if (sub_name ==
"tmp" || sub_name ==
"sys")
158 "Dropping system namespace /%s is not allowed", sub_name.c_str());
164 full_name += sub_name;
185 HT_WARN(
"close() is no longer supported");
199 uint32_t wait_time, remaining;
200 uint32_t interval=5000;
218 remaining = timer.remaining();
219 wait_time = (remaining < interval) ? remaining : interval;
226 cout <<
"Waiting for connection to Hyperspace..." << endl;
228 remaining = timer.remaining();
229 wait_time = (remaining < interval) ? remaining : interval;
238 make_shared<ApplicationQueue>(
m_props->get_i32(
"Hypertable.Client.Workers"));
245 if (!m_master_client->wait_for_connection(timer))
static Comm * instance()
Creates/returns singleton instance of the Comm class.
Retrieves system information (hardware, installation directory, etc)
RangeLocatorPtr m_range_locator
NameIdMapperPtr get_nameid_mapper()
void drop_namespace(const std::string &name, Namespace *base=NULL, bool if_exists=false)
Removes a namespace.
NamespacePtr open_namespace(const std::string &name, Namespace *base=NULL)
Opens a Namespace.
NameIdMapperPtr m_namemap
HqlInterpreter * create_hql_interpreter(bool immutable_namespace=true)
PropertiesPtr properties
This singleton map stores all options.
std::string String
A String is simply a typedef to std::string.
Lib::Master::ClientPtr m_master_client
bool exists_namespace(const std::string &name, Namespace *base=NULL)
Checks if the namespace exists.
static void canonicalize(String *original)
Get canonical format of name/id string.
ApplicationQueueInterfacePtr m_app_queue
Client(const std::string &install_dir, const std::string &config_file, uint32_t default_timeout_ms=0)
Constructs the object using the specified config file.
Provides access to the cluster ID.
std::shared_ptr< Namespace > NamespacePtr
Shared smart pointer to Namespace.
std::shared_ptr< Client > ClientPtr
Hyperspace::SessionPtr m_hyperspace
std::string m_install_dir
Perform operation if namespace does not exist.
std::shared_ptr< Session > SessionPtr
TableCachePtr m_table_cache
The API of HQL interpreter.
A timer class to keep timeout states across AsyncComm related calls.
Logging routines and macros.
Desc & file_desc(const char *usage)
Get the config file options description.
Compatibility Macros for C/C++.
Declarations for NamespaceFlag.
Initialization helper for applications.
#define HT_THROW_(_code_)
std::string m_toplevel_dir
Declarations for HqlCommandInterpreter.
Perform operation if namespace exists.
Hyperspace::SessionPtr & get_hyperspace_session()
std::recursive_mutex rec_mutex
A global (recursive) configuration mutex.
Create intermediate namespaces.
#define HT_THROWF(_code_, _fmt_,...)
void create_namespace(const std::string &name, Namespace *base=NULL, bool create_intermediate=false, bool if_not_exists=false)
Creates a namespace.
Internet address wrapper classes and utility functions.
Declarations for ReactorFactory.
A timer class to keep timeout states across AsyncComm related calls.
static String install_dir
The installation directory.
This is a generic exception class for Hypertable.
std::shared_ptr< DispatchHandler > DispatchHandlerPtr
Smart pointer to DispatchHandler.
const std::string & get_name() const
bool m_hyperspace_reconnect
Declarations for ApplicationQueue.
std::shared_ptr< ConnectionInitializer > ConnectionInitializerPtr
Smart pointer to ConnectionInitializer.
std::shared_ptr< NameIdMapper > NameIdMapperPtr
Smart pointer to NameIdMapper.
Error codes, Exception handling, error logging.
#define HT_THROW(_code_, _msg_)
Declarations for ClusterId.
NamespaceCachePtr m_namespace_cache
ConnectionManagerPtr m_conn_manager
Lib::Master::ClientPtr get_master_client()
int code() const
Returns the error code.
Executes user-defined functions when leaving the current scope.