0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Hypertable::Namespace Class Reference

#include <Namespace.h>

Inheritance diagram for Hypertable::Namespace:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::Namespace:
Collaboration graph
[legend]

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...
 
Clientget_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
 
Commm_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
 
Clientm_client
 

Detailed Description

Definition at line 57 of file Namespace.h.

Member Typedef Documentation

typedef boost::tokenizer<boost::char_separator<char> > Hypertable::Namespace::Tokenizer
private

Definition at line 309 of file Namespace.h.

Constructor & Destructor Documentation

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.

virtual Hypertable::Namespace::~Namespace ( )
inlinevirtual

Definition at line 70 of file Namespace.h.

Member Function Documentation

TablePtr Namespace::_open_table ( const std::string &  full_name,
int32_t  flags = 0 
)
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.

Parameters
table_nameName of table to alter
schemaSchema object holding alterations
forceForce 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.

void Namespace::canonicalize ( String original)
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.

Parameters
nameName of table to compact
rowOptional row identifying range withing table to compact
flagsCompaction flags (see Lib::RangeServer::Protocol::CompactionFlags)

Definition at line 102 of file Namespace.cc.

void Hypertable::Namespace::create_index_table ( const std::string &  primary_table_name)
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>
* 
Parameters
namename of the table
schema_strschema 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.

Parameters
nametable name
if_existsdon'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.

Parameters
namename of table
Returns
true of table exists false ow

Definition at line 189 of file Namespace.cc.

Client* Hypertable::Namespace::get_client ( )
inline

Returns a pointer to the client object which created this Namespace.

Definition at line 292 of file Namespace.h.

String Namespace::get_full_name ( const std::string &  sub_name)
private

Definition at line 75 of file Namespace.cc.

const std::string& Hypertable::Namespace::get_id ( ) const
inline

Definition at line 82 of file Namespace.h.

std::string Hypertable::Namespace::get_index_table_name ( const std::string &  table_name)
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.

Parameters
include_sub_entriesinclude or not include all sub entries
listingreference to vector of table names

Definition at line 311 of file Namespace.cc.

const std::string& Hypertable::Namespace::get_name ( ) const
inline

Definition at line 78 of file Namespace.h.

std::string Hypertable::Namespace::get_qualifier_index_table_name ( const std::string &  table_name)
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.

Parameters
nametable name
Returns
schema object of table

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.

Parameters
nametable name
with_idsinclude generation and column family ID attributes
Returns
XML schema of table

Definition at line 228 of file Namespace.cc.

String Namespace::get_table_id ( const std::string &  name)

Returns the table identifier for a table.

Parameters
namename of table
Returns
identifier string for the 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.

Parameters
nametable name
splitsreference to TableSplitsContainer object

Definition at line 316 of file Namespace.cc.

void Hypertable::Namespace::initialize ( )
private
TablePtr Namespace::open_table ( const std::string &  name,
int32_t  flags = 0 
)

Opens a table.

Parameters
namename of the table
flagsopen flags
Returns
pointer to Table object

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.

Parameters
table_nameName of table for which indices are to be rebuilt
table_partsControls 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.

Parameters
namename 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.

Parameters
old_nameold table name
new_namenew table name

Definition at line 248 of file Namespace.cc.

Member Data Documentation

ApplicationQueueInterfacePtr Hypertable::Namespace::m_app_queue
private

Definition at line 321 of file Namespace.h.

Client* Hypertable::Namespace::m_client
private

Definition at line 329 of file Namespace.h.

Comm* Hypertable::Namespace::m_comm
private

Definition at line 318 of file Namespace.h.

ConnectionManagerPtr Hypertable::Namespace::m_conn_manager
private

Definition at line 319 of file Namespace.h.

Hyperspace::SessionPtr Hypertable::Namespace::m_hyperspace
private

Definition at line 320 of file Namespace.h.

bool Hypertable::Namespace::m_hyperspace_reconnect
private

Definition at line 326 of file Namespace.h.

std::string Hypertable::Namespace::m_id
private

Definition at line 316 of file Namespace.h.

Lib::Master::ClientPtr Hypertable::Namespace::m_master_client
private

Definition at line 323 of file Namespace.h.

std::string Hypertable::Namespace::m_name
private

Definition at line 315 of file Namespace.h.

NameIdMapperPtr Hypertable::Namespace::m_namemap
private

Definition at line 322 of file Namespace.h.

PropertiesPtr Hypertable::Namespace::m_props
private

Definition at line 317 of file Namespace.h.

RangeLocatorPtr Hypertable::Namespace::m_range_locator
private

Definition at line 324 of file Namespace.h.

TableCachePtr Hypertable::Namespace::m_table_cache
private

Definition at line 327 of file Namespace.h.

uint32_t Hypertable::Namespace::m_timeout_ms
private

Definition at line 328 of file Namespace.h.

std::string Hypertable::Namespace::m_toplevel_dir
private

Definition at line 325 of file Namespace.h.


The documentation for this class was generated from the following files: