0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Client.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef Hypertable_Lib_Client_h
23 #define Hypertable_Lib_Client_h
24 
25 #include "Master/Client.h"
26 #include "NameIdMapper.h"
27 #include "Namespace.h"
28 #include "NamespaceCache.h"
29 #include "TableCache.h"
30 
31 #include <Hyperspace/Session.h>
32 
35 
36 #include <Common/String.h>
37 
38 #include <memory>
39 
40 namespace Hypertable {
41 
51  class Comm;
52  class HqlInterpreter;
53 
54  class Client {
55  public:
56 
64  Client(const std::string &install_dir, const std::string &config_file,
65  uint32_t default_timeout_ms=0);
66 
73  Client(const std::string &install_dir = String(), uint32_t default_timeout_ms=0);
74  ~Client() {}
75 
85  void create_namespace(const std::string &name, Namespace *base=NULL,
86  bool create_intermediate=false,
87  bool if_not_exists=false);
88 
97  NamespacePtr open_namespace(const std::string &name, Namespace *base=NULL);
98 
107  bool exists_namespace(const std::string &name, Namespace *base=NULL);
108 
119  void drop_namespace(const std::string &name, Namespace *base=NULL, bool if_exists=false);
120 
122 
124 
126 
127  void close();
128  void shutdown();
129 
134  HqlInterpreter *create_hql_interpreter(bool immutable_namespace=true);
135 
136  private:
137 
138  void initialize();
139 
148  uint32_t m_timeout_ms;
149  std::string m_install_dir;
153  std::string m_toplevel_dir;
154  };
155 
156  typedef std::shared_ptr<Client> ClientPtr;
157 
158 }
159 
160 #endif // Hypertable_Lib_Client_h
uint32_t m_timeout_ms
Definition: Client.h:148
RangeLocatorPtr m_range_locator
Definition: Client.h:147
NameIdMapperPtr get_nameid_mapper()
Definition: Client.cc:180
void drop_namespace(const std::string &name, Namespace *base=NULL, bool if_exists=false)
Removes a namespace.
Definition: Client.cc:150
NamespacePtr open_namespace(const std::string &name, Namespace *base=NULL)
Opens a Namespace.
Definition: Client.cc:106
NameIdMapperPtr m_namemap
Definition: Client.h:145
HqlInterpreter * create_hql_interpreter(bool immutable_namespace=true)
Definition: Client.cc:193
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
std::shared_ptr< RangeLocator > RangeLocatorPtr
Smart pointer to RangeLocator.
Definition: RangeLocator.h:198
Lib::Master::ClientPtr m_master_client
Definition: Client.h:146
bool exists_namespace(const std::string &name, Namespace *base=NULL)
Checks if the namespace exists.
Definition: Client.cc:121
std::shared_ptr< NamespaceCache > NamespaceCachePtr
Smart pointer to NamespaceCache.
ApplicationQueueInterfacePtr m_app_queue
Definition: Client.h:143
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.
Definition: Client.cc:60
std::shared_ptr< Namespace > NamespacePtr
Shared smart pointer to Namespace.
Definition: Namespace.h:333
std::shared_ptr< Client > ClientPtr
Definition: Client.h:156
Hyperspace::SessionPtr m_hyperspace
Definition: Client.h:144
std::string m_install_dir
Definition: Client.h:149
std::shared_ptr< Session > SessionPtr
Definition: Session.h:734
TableCachePtr m_table_cache
Definition: Client.h:150
The API of HQL interpreter.
std::shared_ptr< Properties > PropertiesPtr
Definition: Properties.h:447
void initialize()
Definition: Client.cc:198
PropertiesPtr m_props
Definition: Client.h:140
std::shared_ptr< ApplicationQueueInterface > ApplicationQueueInterfacePtr
Smart pointer to ApplicationQueueInterface.
std::string m_toplevel_dir
Definition: Client.h:153
Hypertable definitions
std::shared_ptr< TableCache > TableCachePtr
Smart pointer to TableCache.
Definition: TableCache.h:103
Entry point to AsyncComm service.
Definition: Comm.h:61
Hyperspace::SessionPtr & get_hyperspace_session()
Definition: Client.cc:171
Declarations for ConnectionManager.
void create_namespace(const std::string &name, Namespace *base=NULL, bool create_intermediate=false, bool if_not_exists=false)
Creates a namespace.
Definition: Client.cc:86
Declarations for MasterClient This file contains declarations for MasterClient, a client interface cl...
A String class based on std::string.
bool m_hyperspace_reconnect
Definition: Client.h:152
Declarations for ApplicationQueueInterface.
std::shared_ptr< ConnectionManager > ConnectionManagerPtr
Smart pointer to ConnectionManager.
std::shared_ptr< NameIdMapper > NameIdMapperPtr
Smart pointer to NameIdMapper.
Definition: NameIdMapper.h:121
NamespaceCachePtr m_namespace_cache
Definition: Client.h:151
ConnectionManagerPtr m_conn_manager
Definition: Client.h:142
Lib::Master::ClientPtr get_master_client()
Definition: Client.cc:176