0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Utility.h
Go to the documentation of this file.
1 /*
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 
26 
27 #ifndef Hypertable_Master_Utility_h
28 #define Hypertable_Master_Utility_h
29 
31 
35 
36 #include <AsyncComm/CommAddress.h>
37 
38 #include <Common/Status.h>
39 #include <Common/StringExt.h>
40 #include <Common/Timer.h>
41 
42 namespace Hypertable {
43 
45  namespace Utility {
46 
49 
58  extern void get_table_server_set(ContextPtr &context, const String &id,
59  const String &row, StringSet &servers);
60 
73  extern bool table_exists(ContextPtr &context, const String &name,
74  String &id);
75 
86  extern bool table_exists(ContextPtr &context, const String &id);
87 
94  extern TableParts get_index_parts(const std::string &schema);
95 
112  extern void verify_table_name_availability(ContextPtr &context,
113  const String &name, String &id);
114 
128  extern void
129  create_table_in_hyperspace(ContextPtr &context, const String &name,
130  const String &schema_str,
131  TableIdentifierManaged *table);
132 
146  extern void prepare_index(ContextPtr &context, const String &name,
147  const String &schema_str, bool qualifier,
148  String &index_name, String &index_schema);
149 
158  extern void
160 
170  extern bool next_available_server(ContextPtr &context, String &location,
171  bool urgent=false);
172 
196  extern void
197  create_table_load_range(ContextPtr &context, const String &location,
198  TableIdentifier &table, RangeSpec &range,
199  bool needs_compaction);
200 
211  extern void
212  create_table_acknowledge_range(ContextPtr &context, const String &location,
213  TableIdentifier &table, RangeSpec &range);
214 
229  extern int64_t
230  range_hash_code(const TableIdentifier &table, const RangeSpec &range,
231  const String &qualifier);
232 
240  extern String
241  range_hash_string(const TableIdentifier &table, const RangeSpec &range,
242  const String &qualifier);
243 
252  extern String root_range_location(ContextPtr &context);
253 
260  extern bool status(ContextPtr &context, Timer &timer, Status &status);
261 
265  extern void shutdown_rangeserver(ContextPtr &context, CommAddress &addr);
266 
268 
269  } // namespace Utility
270 
271 }
272 
273 #endif // Hypertable_Master_Utility_h
std::set< String > StringSet
STL Set managing Strings.
Definition: StringExt.h:42
bool next_available_server(ContextPtr &context, String &location, bool urgent)
Gets name of next available server.
Definition: Utility.cc:304
void prepare_index(ContextPtr &context, const String &name, const String &schema_str, bool qualifier, String &index_name, String &index_schema_str)
Prepares index schema and table name.
Definition: Utility.cc:229
Range specification.
Definition: RangeSpec.h:40
Holds Nagios-style program status information.
Definition: Status.h:42
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
Declarations for Status.
Declarations for TableIdentifier and TableIdentifierManaged.
Declarations for CommAddress.
void create_table_load_range(ContextPtr &context, const String &location, TableIdentifier &table, RangeSpec &range, bool needs_compaction)
Loads a table's initial range.
Definition: Utility.cc:313
void create_table_acknowledge_range(ContextPtr &context, const String &location, TableIdentifier &table, RangeSpec &range)
Calls RangeServer::acknowledge_load for a range.
Definition: Utility.cc:350
int64_t range_hash_code(const TableIdentifier &table, const RangeSpec &range, const String &qualifier)
Returns a hash code for a range with an optional qualifer string.
Definition: Utility.cc:379
Represents a set of table parts (sub-tables).
Definition: TableParts.h:47
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
Definition: Context.h:265
String range_hash_string(const TableIdentifier &table, const RangeSpec &range, const String &qualifier)
Returns string representation of hash code for a range with an optional qualifer string.
Definition: Utility.cc:385
Wrapper for TableIdentifier providing member storage.
void verify_table_name_availability(ContextPtr &context, const String &name, String &id)
Checks if table name is available.
Definition: Utility.cc:158
bool status(ContextPtr &context, Timer &timer, Status &status)
Runs a status check on the master.
Definition: Utility.cc:408
A timer class to keep timeout states across AsyncComm related calls.
Declarations for RangeSpec and RangeSpecManaged.
Hypertable definitions
bool table_exists(ContextPtr &context, const String &name, String &id)
Checks if table exists and returns table ID.
Definition: Utility.cc:100
void create_table_in_hyperspace(ContextPtr &context, const String &name, const String &schema_str, TableIdentifierManaged *table)
Creates a table in Hyperspace.
Definition: Utility.cc:182
void create_table_write_metadata(ContextPtr &context, TableIdentifier *table)
Creates initial METADATA table entry for table.
Definition: Utility.cc:275
void get_table_server_set(ContextPtr &context, const String &id, const String &row, StringSet &servers)
Gets set of servers holding ranges for a given table.
Definition: Utility.cc:57
String root_range_location(ContextPtr &context)
Returns location of root METADATA range.
Definition: Utility.cc:389
A timer class to keep timeout states across AsyncComm related calls.
Definition: Timer.h:44
void shutdown_rangeserver(ContextPtr &context, CommAddress &addr)
Sends a shutdown command to a rangeserver.
Definition: Utility.cc:447
TableParts get_index_parts(const std::string &schema)
Gets index parts specified in schema.
Definition: Utility.cc:124
String extensions and helpers: sets, maps, append operators etc.
Declarations for Context.
Address abstraction to hold either proxy name or IPv4:port address.
Definition: CommAddress.h:52
Declarations for TableParts.