#include <Namespace.h>
Public Member Functions | |
Namespace (const std::string &name, const std::string &id, PropertiesPtr &props, ConnectionManagerPtr &conn_manager, Hyperspace::SessionPtr &hyperspace, ApplicationQueueInterfacePtr &app_queue, NameIdMapperPtr &namemap, Lib::Master::ClientPtr &master_client, RangeLocatorPtr &range_locator, TableCachePtr &table_cache, uint32_t timeout, Client *client) | |
Constructs the object. More... | |
virtual | ~Namespace () |
const std::string & | get_name () const |
const std::string & | get_id () const |
void | compact (const std::string &name, const std::string &row, uint32_t flags) |
Performs a manual compaction. More... | |
void | create_table (const std::string &name, const std::string &schema_str) |
Creates a table. More... | |
void | create_table (const std::string &name, SchemaPtr &schema) |
void | alter_table (const std::string &table_name, SchemaPtr &schema, bool force) |
Alter table schema. More... | |
void | alter_table (const std::string &table_name, const std::string &schema_str, bool force) |
TablePtr | open_table (const std::string &name, int32_t flags=0) |
Opens a table. More... | |
void | refresh_table (const std::string &name) |
Refreshes the cached table entry. More... | |
bool | exists_table (const std::string &name) |
Checks if the table exists. More... | |
std::string | get_table_id (const std::string &name) |
Returns the table identifier for a table. More... | |
SchemaPtr | get_schema (const std::string &name) |
Returns a smart ptr to a schema object for a table. More... | |
std::string | get_schema_str (const std::string &name, bool with_ids=false) |
Returns the schema for a table. More... | |
void | get_listing (bool include_sub_entries, std::vector< NamespaceListing > &listing) |
Returns a list of existing tables & namesspaces. More... | |
void | rename_table (const std::string &old_name, const std::string &new_name) |
Renames a table. More... | |
void | drop_table (const std::string &name, bool if_exists) |
Removes a table. More... | |
void | rebuild_indices (const std::string &table_name, TableParts table_parts) |
Rebuild a table's indices. More... | |
void | get_table_splits (const std::string &name, TableSplitsContainer &splits) |
Returns a list of existing table names. More... | |
Client * | get_client () |
Returns a pointer to the client object which created this Namespace. More... | |
Public Member Functions inherited from Hypertable::ClientObject | |
virtual | ~ClientObject () |
Destructor. More... | |
Static Public Member Functions | |
static void | canonicalize (String *original) |
Get canonical format of name/id string. More... | |
Private Types | |
typedef boost::tokenizer < boost::char_separator< char > > | Tokenizer |
Private Member Functions | |
std::string | get_index_table_name (const std::string &table_name) |
std::string | get_qualifier_index_table_name (const std::string &table_name) |
void | create_index_table (const std::string &primary_table_name) |
std::string | get_full_name (const std::string &sub_name) |
void | initialize () |
TablePtr | _open_table (const std::string &full_name, int32_t flags=0) |
Private Attributes | |
std::string | m_name |
std::string | m_id |
PropertiesPtr | m_props |
Comm * | m_comm |
ConnectionManagerPtr | m_conn_manager |
Hyperspace::SessionPtr | m_hyperspace |
ApplicationQueueInterfacePtr | m_app_queue |
NameIdMapperPtr | m_namemap |
Lib::Master::ClientPtr | m_master_client |
RangeLocatorPtr | m_range_locator |
std::string | m_toplevel_dir |
bool | m_hyperspace_reconnect |
TableCachePtr | m_table_cache |
uint32_t | m_timeout_ms |
Client * | m_client |
Definition at line 57 of file Namespace.h.
|
private |
Definition at line 309 of file Namespace.h.
Namespace::Namespace | ( | const std::string & | name, |
const std::string & | id, | ||
PropertiesPtr & | props, | ||
ConnectionManagerPtr & | conn_manager, | ||
Hyperspace::SessionPtr & | hyperspace, | ||
ApplicationQueueInterfacePtr & | app_queue, | ||
NameIdMapperPtr & | namemap, | ||
Lib::Master::ClientPtr & | master_client, | ||
RangeLocatorPtr & | range_locator, | ||
TableCachePtr & | table_cache, | ||
uint32_t | timeout, | ||
Client * | client | ||
) |
Constructs the object.
Definition at line 55 of file Namespace.cc.
|
inlinevirtual |
Definition at line 70 of file Namespace.h.
|
private |
Definition at line 174 of file Namespace.cc.
void Namespace::alter_table | ( | const std::string & | table_name, |
SchemaPtr & | schema, | ||
bool | force | ||
) |
Alter table schema.
table_name | Name of table to alter |
schema | Schema object holding alterations |
force | Force table alteration even if generation mismatch |
Definition at line 135 of file Namespace.cc.
void Namespace::alter_table | ( | const std::string & | table_name, |
const std::string & | schema_str, | ||
bool | force | ||
) |
Definition at line 145 of file Namespace.cc.
|
static |
Get canonical format of name/id string.
This means no leading or trailing '/' and cleanup '//'
Definition at line 84 of file Namespace.cc.
void Namespace::compact | ( | const std::string & | name, |
const std::string & | row, | ||
uint32_t | flags | ||
) |
Performs a manual compaction.
name | Name of table to compact |
row | Optional row identifying range withing table to compact |
flags | Compaction flags (see Lib::RangeServer::Protocol::CompactionFlags) |
Definition at line 102 of file Namespace.cc.
|
private |
void Namespace::create_table | ( | const std::string & | name, |
const std::string & | schema_str | ||
) |
Creates a table.
The schema_str
parameter is a string that contains an XML-style schema specification. The best way to learn the syntax of this specification format is to create tables with HQL in the command interpreter and then run DESCRIBE TABLE to see what the XML specification looks like. For example, the following HQL:
CREATE TABLE COMPRESSOR="lzo" foo ( a MAX_VERSIONS=1 TTL=30 DAYS, b TTL=1 WEEKS, c, ACCESS GROUP primary IN_MEMORY BLOCKSIZE=1024( a ), ACCESS GROUP secondary COMPRESSOR="zlib" BLOOMFILTER="none" ( b, c) ); *
will create a table with the follwing XML schema:
* <Schema compressor="lzo"> * <AccessGroup name="primary" inMemory="true" blksz="1024"> * <ColumnFamily> * <Name>a</Name> * <MaxVersions>1</MaxVersions> * <ttl>2592000</ttl> * </ColumnFamily> * </AccessGroup> * <AccessGroup name="secondary" compressor="zlib" bloomFilter="none"> * <ColumnFamily> * <Name>b</Name> * <ttl>604800</ttl> * </ColumnFamily> * <ColumnFamily> * <Name>c</Name> * </ColumnFamily> * </AccessGroup> * </Schema> *
name | name of the table |
schema_str | schema definition for the table |
Definition at line 111 of file Namespace.cc.
void Namespace::create_table | ( | const std::string & | name, |
SchemaPtr & | schema | ||
) |
Definition at line 124 of file Namespace.cc.
void Namespace::drop_table | ( | const std::string & | name, |
bool | if_exists | ||
) |
Removes a table.
This command instructs the Master to remove a table from the system, including all of its ranges.
name | table name |
if_exists | don't throw an exception if table does not exist |
Definition at line 269 of file Namespace.cc.
bool Namespace::exists_table | ( | const std::string & | name | ) |
Checks if the table exists.
name | name of table |
Definition at line 189 of file Namespace.cc.
|
inline |
Returns a pointer to the client object which created this Namespace.
Definition at line 292 of file Namespace.h.
|
private |
Definition at line 75 of file Namespace.cc.
|
inline |
Definition at line 82 of file Namespace.h.
|
inlineprivate |
Definition at line 297 of file Namespace.h.
void Namespace::get_listing | ( | bool | include_sub_entries, |
std::vector< NamespaceListing > & | listing | ||
) |
Returns a list of existing tables & namesspaces.
include_sub_entries | include or not include all sub entries |
listing | reference to vector of table names |
Definition at line 311 of file Namespace.cc.
|
inline |
Definition at line 78 of file Namespace.h.
|
inlineprivate |
Definition at line 302 of file Namespace.h.
SchemaPtr Namespace::get_schema | ( | const std::string & | name | ) |
Returns a smart ptr to a schema object for a table.
name | table name |
Definition at line 238 of file Namespace.cc.
String Namespace::get_schema_str | ( | const std::string & | name, |
bool | with_ids = false |
||
) |
Returns the schema for a table.
name | table name |
with_ids | include generation and column family ID attributes |
Definition at line 228 of file Namespace.cc.
String Namespace::get_table_id | ( | const std::string & | name | ) |
Returns the table identifier for a table.
name | name of table |
Definition at line 217 of file Namespace.cc.
void Namespace::get_table_splits | ( | const std::string & | name, |
TableSplitsContainer & | splits | ||
) |
Returns a list of existing table names.
name | table name |
splits | reference to TableSplitsContainer object |
Definition at line 316 of file Namespace.cc.
|
private |
TablePtr Namespace::open_table | ( | const std::string & | name, |
int32_t | flags = 0 |
||
) |
Opens a table.
name | name of the table |
flags | open flags |
Definition at line 155 of file Namespace.cc.
void Namespace::rebuild_indices | ( | const std::string & | table_name, |
TableParts | table_parts | ||
) |
Rebuild a table's indices.
Rebuilds the indices for table table_name
by carrying out a recreate index tables master operation an then re-populating the index tables by scanning the primary table with the rebuild_indices member of ScanSpec set.
table_name | Name of table for which indices are to be rebuilt |
table_parts | Controls which indices to rebuild |
Definition at line 286 of file Namespace.cc.
void Namespace::refresh_table | ( | const std::string & | name | ) |
Refreshes the cached table entry.
name | name of the table |
Definition at line 185 of file Namespace.cc.
void Namespace::rename_table | ( | const std::string & | old_name, |
const std::string & | new_name | ||
) |
Renames a table.
old_name | old table name |
new_name | new table name |
Definition at line 248 of file Namespace.cc.
|
private |
Definition at line 321 of file Namespace.h.
|
private |
Definition at line 329 of file Namespace.h.
|
private |
Definition at line 318 of file Namespace.h.
|
private |
Definition at line 319 of file Namespace.h.
|
private |
Definition at line 320 of file Namespace.h.
|
private |
Definition at line 326 of file Namespace.h.
|
private |
Definition at line 316 of file Namespace.h.
|
private |
Definition at line 323 of file Namespace.h.
|
private |
Definition at line 315 of file Namespace.h.
|
private |
Definition at line 322 of file Namespace.h.
|
private |
Definition at line 317 of file Namespace.h.
|
private |
Definition at line 324 of file Namespace.h.
|
private |
Definition at line 327 of file Namespace.h.
|
private |
Definition at line 328 of file Namespace.h.
|
private |
Definition at line 325 of file Namespace.h.