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

Access group specification. More...

#include <AccessGroupSpec.h>

Collaboration diagram for Hypertable::AccessGroupSpec:
Collaboration graph
[legend]

Public Member Functions

 AccessGroupSpec ()
 Default constructor. More...
 
 AccessGroupSpec (const std::string &name)
 Constructor with name initializer. More...
 
 ~AccessGroupSpec ()
 Destructor. More...
 
void set_name (const std::string &name)
 Sets access group name. More...
 
const std::string & get_name () const
 Gets access group name. More...
 
void set_generation (int64_t generation)
 Sets generation. More...
 
void clear_generation ()
 Clears generation. More...
 
bool clear_generation_if_changed (AccessGroupSpec &original)
 Clears generation if different than original. More...
 
int64_t get_generation () const
 Gets generation. More...
 
void set_option_replication (int16_t replication)
 Sets replication option. More...
 
int16_t get_option_replication () const
 Gets replication option. More...
 
void set_option_blocksize (int32_t blocksize)
 Sets blocksize option. More...
 
int32_t get_option_blocksize () const
 Gets blocksize option. More...
 
void set_option_compressor (const std::string &compressor)
 Sets compressor option. More...
 
const std::string get_option_compressor () const
 Gets compressor option. More...
 
void set_option_bloom_filter (const std::string &bloomfilter)
 Sets bloom filter option. More...
 
const std::string & get_option_bloom_filter () const
 Gets bloom filter option. More...
 
void set_option_in_memory (bool value)
 Sets in memory option. More...
 
bool get_option_in_memory () const
 Gets in memory option. More...
 
void set_default_max_versions (int32_t max_versions)
 Sets default max versions column family option. More...
 
int32_t get_default_max_versions () const
 Gets default max versions column family option. More...
 
void set_default_ttl (time_t ttl)
 Sets default ttl column family option. More...
 
time_t get_default_ttl () const
 Gets default ttl column family option. More...
 
void set_default_time_order_desc (bool value)
 Sets default time order desc column family option. More...
 
bool get_default_time_order_desc () const
 Gets default time order desc column family option. More...
 
void set_default_counter (bool value)
 Sets default counter column family option. More...
 
bool get_default_counter () const
 Gets default counter column family option. More...
 
void add_column (ColumnFamilySpec *cf)
 Adds column family specification. More...
 
ColumnFamilySpecreplace_column (ColumnFamilySpec *new_cf)
 Replaces column family specification. More...
 
ColumnFamilySpecremove_column (const std::string &name)
 Removes column family specification. More...
 
void drop_column (const std::string &name)
 Drops column family. More...
 
ColumnFamilySpecget_column (const std::string &name)
 Gets column family specification. More...
 
void clear_columns ()
 Clears columns. More...
 
void merge_options (const AccessGroupOptions &options)
 Merges options with those from another AccessGroupOptions object. More...
 
void merge_defaults (const ColumnFamilyOptions &options)
 Merges column family defaults with those from another AccessGroupOptions object. More...
 
bool operator== (const AccessGroupSpec &other) const
 Equality operator. More...
 
void parse_xml (const char *base, int len)
 Parses XML access group specification. More...
 
const std::string render_xml (const std::string &line_prefix, bool with_ids=false) const
 Renders access group specification in XML format. More...
 
const std::string render_hql () const
 Renders access group specification in HQL format. More...
 
ColumnFamilySpecscolumns ()
 Returns reference to column specifications. More...
 
const AccessGroupOptionsoptions () const
 Returns reference to options structure. More...
 
const ColumnFamilyOptionsdefaults () const
 Returns reference to column family defaults structure. More...
 

Private Attributes

std::string m_name
 Name. More...
 
int64_t m_generation {}
 Generation. More...
 
AccessGroupOptions m_options
 Options. More...
 
ColumnFamilyOptions m_defaults
 Column family defaults. More...
 
ColumnFamilySpecs m_columns
 Member column family specifications. More...
 

Detailed Description

Access group specification.

Definition at line 319 of file AccessGroupSpec.h.

Constructor & Destructor Documentation

Hypertable::AccessGroupSpec::AccessGroupSpec ( )
inline

Default constructor.

Definition at line 323 of file AccessGroupSpec.h.

Hypertable::AccessGroupSpec::AccessGroupSpec ( const std::string &  name)
inline

Constructor with name initializer.

Initializes m_name with name

Parameters
nameAccess group name

Definition at line 328 of file AccessGroupSpec.h.

AccessGroupSpec::~AccessGroupSpec ( )

Destructor.

Deletes all of the column family specification objects in m_columns

Definition at line 299 of file AccessGroupSpec.cc.

Member Function Documentation

void AccessGroupSpec::add_column ( ColumnFamilySpec cf)

Adds column family specification.

Merges column family defaults, m_defaults, into cf options, sets the cf access group to m_name, and then pushes, cf, onto the end of m_columns.

Definition at line 451 of file AccessGroupSpec.cc.

void Hypertable::AccessGroupSpec::clear_columns ( )
inline

Clears columns.

Clears the m_columns vector.

Definition at line 505 of file AccessGroupSpec.h.

void Hypertable::AccessGroupSpec::clear_generation ( )
inline

Clears generation.

Sets m_generation to 0.

Definition at line 349 of file AccessGroupSpec.h.

bool AccessGroupSpec::clear_generation_if_changed ( AccessGroupSpec original)

Clears generation if different than original.

Compares this object with original and if then differ, sets m_generation to 0 and returns true. Comparison of each member column family is compared with ColumnFamilySpec::clear_generation_if_changed() causing the column family spec's generation to be set to 0 if they differ.

Parameters
originalOriginal access group spec with which to compare
Returns
true if this object differs from original, false otherwise.

Definition at line 308 of file AccessGroupSpec.cc.

ColumnFamilySpecs& Hypertable::AccessGroupSpec::columns ( )
inline

Returns reference to column specifications.

Returns
Reference to column specifications.

Definition at line 607 of file AccessGroupSpec.h.

const ColumnFamilyOptions& Hypertable::AccessGroupSpec::defaults ( ) const
inline

Returns reference to column family defaults structure.

Returns
Reference to column family defaults structure.

Definition at line 615 of file AccessGroupSpec.h.

void AccessGroupSpec::drop_column ( const std::string &  name)

Drops column family.

Finds column family specification with name name in m_columns and clears its generation, marks it as deleted, and renames it to its column ID prefixed with the '!' character.

Definition at line 489 of file AccessGroupSpec.cc.

ColumnFamilySpec * AccessGroupSpec::get_column ( const std::string &  name)

Gets column family specification.

Returns
Column specification matching name or nullptr if it is not contained in the spec

Definition at line 500 of file AccessGroupSpec.cc.

bool AccessGroupSpec::get_default_counter ( ) const

Gets default counter column family option.

Returns
Default counter column family option.

Definition at line 447 of file AccessGroupSpec.cc.

int32_t AccessGroupSpec::get_default_max_versions ( ) const

Gets default max versions column family option.

Returns
Default max versions column family option.

Definition at line 416 of file AccessGroupSpec.cc.

bool AccessGroupSpec::get_default_time_order_desc ( ) const

Gets default time order desc column family option.

Returns
Default time order desc column family option.

Definition at line 437 of file AccessGroupSpec.cc.

time_t AccessGroupSpec::get_default_ttl ( ) const

Gets default ttl column family option.

Returns
Default ttl column family option.

Definition at line 426 of file AccessGroupSpec.cc.

int64_t Hypertable::AccessGroupSpec::get_generation ( ) const
inline

Gets generation.

Returns
Generation value

Definition at line 364 of file AccessGroupSpec.h.

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

Gets access group name.

Returns
Access group name.

Definition at line 341 of file AccessGroupSpec.h.

int32_t AccessGroupSpec::get_option_blocksize ( ) const

Gets blocksize option.

Returns
blocksize option.

Definition at line 372 of file AccessGroupSpec.cc.

const std::string & AccessGroupSpec::get_option_bloom_filter ( ) const

Gets bloom filter option.

Returns
bloom filter option.

Definition at line 394 of file AccessGroupSpec.cc.

const std::string AccessGroupSpec::get_option_compressor ( ) const

Gets compressor option.

Returns
compressor option.

Definition at line 383 of file AccessGroupSpec.cc.

bool AccessGroupSpec::get_option_in_memory ( ) const

Gets in memory option.

Returns
in memory option.

Definition at line 405 of file AccessGroupSpec.cc.

int16_t AccessGroupSpec::get_option_replication ( ) const

Gets replication option.

Returns
replication option.

Definition at line 361 of file AccessGroupSpec.cc.

void Hypertable::AccessGroupSpec::merge_defaults ( const ColumnFamilyOptions options)
inline

Merges column family defaults with those from another AccessGroupOptions object.

Parameters
optionsOptions with which to merge

Definition at line 516 of file AccessGroupSpec.h.

void Hypertable::AccessGroupSpec::merge_options ( const AccessGroupOptions options)
inline

Merges options with those from another AccessGroupOptions object.

Parameters
optionsOptions with which to merge

Definition at line 509 of file AccessGroupSpec.h.

bool AccessGroupSpec::operator== ( const AccessGroupSpec other) const

Equality operator.

Parameters
otherOther object to which comparison is to be made
Returns
true if this object is equal to other, false otherwise.

Definition at line 507 of file AccessGroupSpec.cc.

const AccessGroupOptions& Hypertable::AccessGroupSpec::options ( ) const
inline

Returns reference to options structure.

Returns
Reference to options structure.

Definition at line 611 of file AccessGroupSpec.h.

void AccessGroupSpec::parse_xml ( const char *  base,
int  len 
)

Parses XML access group specification.

This method parses an XML document representing an access group specification, populating the corresponding member variables.

Parameters
basePointer to character buffer holding XML document
lenLength of XML document
See also
parse_xml() for an example input that is parseable by this member function.

Definition at line 581 of file AccessGroupSpec.cc.

ColumnFamilySpec * AccessGroupSpec::remove_column ( const std::string &  name)

Removes column family specification.

Removes column family specification with name name from m_columns.

Parameters
nameName of column family specification to remove
Returns
Removed column family specification

Definition at line 476 of file AccessGroupSpec.cc.

const std::string AccessGroupSpec::render_hql ( ) const

Renders access group specification in HQL format.

Renders the access group specification in a format that can be used as the column specification in an HQL CREATE TABLE command. The following shows an example of the HQL produced by this member function (newlines added for readability).

  ACCESS GROUP default (foo, baz) REPLICATION 3 BLOCKSIZE 67108864
    COMPRESSOR "bmz --fp-len 20 --offset 5" BLOOMFILTER "none"
    IN_MEMORY MAX_VERSIONS 3 TTL 86400 TIME_ORDER desc
Returns
std::string representing access group specification in HQL format

Definition at line 626 of file AccessGroupSpec.cc.

const std::string AccessGroupSpec::render_xml ( const std::string &  line_prefix,
bool  with_ids = false 
) const

Renders access group specification in XML format.

Renders the specification as an XML document. The line_prefix parameter can be used to get nice indenting if the object is being rendered as part of a larger object and is typically some number of space characters. The with_ids parameter causes the generated XML to include the ID attribute and Generation elements for the column families. The following is example output produced by this member function.

<AccessGroup name="default">
  <Options>
    <Replication>3</Replication>
    <BlockSize>67108864</BlockSize>
    <Compressor>bmz --fp-len 20 --offset 5</Compressor>
    <BloomFilter>none</BloomFilter>
    <InMemory>true</InMemory>
  </Options>
  <ColumnFamilyDefaults>
    <MaxVersions>3</MaxVersions>
    <TTL>86400</TTL>
    <TimeOrder>desc</TimeOrder>
  </ColumnFamilyDefaults>
  <ColumnFamily id="42">
    <Generation>123</Generation>
    <Name>foo</Name>
    <AccessGroup>default</AccessGroup>
    <Deleted>false</Deleted>
    <Index>true</Index>
    <QualifierIndex>true</QualifierIndex>
    <Options>
      <MaxVersions>1</MaxVersions>
      <TTL>86400</TTL>
      <TimeOrder>desc</TimeOrder>
    </Options>
  </ColumnFamily>
  <ColumnFamily id="43">
    <Generation>234</Generation>
    <Name>bar</Name>
    <AccessGroup>default</AccessGroup>
    <Deleted>true</Deleted>
    <QualifierIndex>true</QualifierIndex>
    <Options>
      <MaxVersions>3</MaxVersions>
      <TTL>86400</TTL>
      <TimeOrder>desc</TimeOrder>
    </Options>
  </ColumnFamily>
</AccessGroup>
Parameters
line_prefixstd::string to prepend to each line of output
with_idsInclude column family IDs and Generation in output
Returns
std::string representing spec in XML format

Definition at line 587 of file AccessGroupSpec.cc.

ColumnFamilySpec * AccessGroupSpec::replace_column ( ColumnFamilySpec new_cf)

Replaces column family specification.

Merges default column family options into new_cf and then removes the old specification with the same name from m_columns and adds new_cf to m_columns.

Parameters
new_cfReplacement column family specification
Returns
Old column family specification

Definition at line 459 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_default_counter ( bool  value)

Sets default counter column family option.

Sets counter option in the column family default structure, m_defaults, to value

Parameters
valueNew counter column family default
Exceptions
Exceptionif supplied value is true and either the max versions or time order desc default options are set, which are incompatible with the counter default option.

Definition at line 441 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_default_max_versions ( int32_t  max_versions)

Sets default max versions column family option.

Sets max versions option in the column family default structure, m_defaults, to max_versions

Parameters
max_versionsNew max versions column family default
Exceptions
Exceptionif max_versions is negative or if the counter default option is set, which is incompatible.

Definition at line 409 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_default_time_order_desc ( bool  value)

Sets default time order desc column family option.

Sets time order desc option in the column family default structure, m_defaults, to value

Parameters
valueNew time order desc column family default
Exceptions
Exceptionif supplied value is true and the counter default option is set, which is incompatible with the time order desc default option.

Definition at line 430 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_default_ttl ( time_t  ttl)

Sets default ttl column family option.

Sets ttl option in the column family default structure, m_defaults, to ttl

Parameters
ttlNew ttl column family default
Exceptions
Exceptionif supplied ttl value is negative.

Definition at line 420 of file AccessGroupSpec.cc.

void Hypertable::AccessGroupSpec::set_generation ( int64_t  generation)
inline

Sets generation.

Parameters
generationGeneration value

Definition at line 345 of file AccessGroupSpec.h.

void AccessGroupSpec::set_name ( const std::string &  name)

Sets access group name.

Sets m_name to name

Parameters
nameAccess group name

Definition at line 304 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_option_blocksize ( int32_t  blocksize)

Sets blocksize option.

Sets the blocksize option of the m_options member to blocksize

Parameters
blocksizeNew value for blocksize option

Definition at line 365 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_option_bloom_filter ( const std::string &  bloomfilter)

Sets bloom filter option.

Sets the bloom filter option of the m_options member to bloomfilter by calling AccessGroupOptions::set_bloom_filter().

Parameters
bloomfilterBloom filter specification
Exceptions
Exceptionwith code set to Error::SCHEMA_PARSE_ERROR if bloom filter specification is invalid

Definition at line 387 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_option_compressor ( const std::string &  compressor)

Sets compressor option.

Sets the compressor option of the m_options member to compressor by calling AccessGroupOptions::set_compressor().

Parameters
compressorCompressor specification
Exceptions
Exceptionwith code set to Error::SCHEMA_PARSE_ERROR if compressor specification is invalid

Definition at line 376 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_option_in_memory ( bool  value)

Sets in memory option.

Sets the in memory option of the m_options member to value

Parameters
valueNew value for in memory option

Definition at line 398 of file AccessGroupSpec.cc.

void AccessGroupSpec::set_option_replication ( int16_t  replication)

Sets replication option.

Sets the replication option of the m_options member to replication

Parameters
replicationNew value for replication option

Definition at line 354 of file AccessGroupSpec.cc.

Member Data Documentation

ColumnFamilySpecs Hypertable::AccessGroupSpec::m_columns
private

Member column family specifications.

Definition at line 632 of file AccessGroupSpec.h.

ColumnFamilyOptions Hypertable::AccessGroupSpec::m_defaults
private

Column family defaults.

Definition at line 629 of file AccessGroupSpec.h.

int64_t Hypertable::AccessGroupSpec::m_generation {}
private

Generation.

Definition at line 623 of file AccessGroupSpec.h.

std::string Hypertable::AccessGroupSpec::m_name
private

Name.

Definition at line 620 of file AccessGroupSpec.h.

AccessGroupOptions Hypertable::AccessGroupSpec::m_options
private

Options.

Definition at line 626 of file AccessGroupSpec.h.


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