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

Specification for access group options. More...

#include <AccessGroupSpec.h>

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

Public Types

enum  {
  REPLICATION, BLOCKSIZE, COMPRESSOR, BLOOMFILTER,
  IN_MEMORY, MAX
}
 Enumeration for isset bits. More...
 

Public Member Functions

void set_replication (int16_t replication)
 Sets replication option. More...
 
int16_t get_replication () const
 Gets replication option. More...
 
bool is_set_replication () const
 Checks if replication option is set. More...
 
void set_blocksize (int32_t blocksize)
 Sets blocksize option. More...
 
int32_t get_blocksize () const
 Gets blocksize option. More...
 
bool is_set_blocksize () const
 Checks if blocksize option is set. More...
 
void set_compressor (const std::string &compressor)
 Sets compressor option. More...
 
const std::string & get_compressor () const
 Gets compressor option. More...
 
bool is_set_compressor () const
 Checks if compressor option is set. More...
 
void set_bloom_filter (const std::string &bloomfilter)
 Sets bloom filter option. More...
 
const std::string & get_bloom_filter () const
 Gets bloom filter option. More...
 
bool is_set_bloom_filter () const
 Checks if bloom filter option is set. More...
 
void set_in_memory (bool value)
 Sets in memory option. More...
 
bool get_in_memory () const
 Gets in memory option. More...
 
bool is_set_in_memory () const
 Checks if in memory option is set. More...
 
void merge (const AccessGroupOptions &other)
 Merges options from another AccessGroupOptions object. More...
 
void parse_xml (const char *base, int len)
 Parses XML options specification. More...
 
const std::string render_xml (const std::string &line_prefix) const
 Renders options in XML format. More...
 
const std::string render_hql () const
 Renders options in HQL format. More...
 
bool operator== (const AccessGroupOptions &other) const
 Equality operator. More...
 

Static Public Member Functions

static void parse_bloom_filter (const std::string &spec, PropertiesPtr &props)
 Parsers a bloom filter specification and sets properties. More...
 

Private Attributes

int16_t m_replication {-1}
 Replication. More...
 
int32_t m_blocksize {}
 Block size. More...
 
std::string m_compressor
 Compressor specification. More...
 
std::string m_bloomfilter
 Bloom filter specification. More...
 
bool m_in_memory {}
 In memory. More...
 
std::bitset< MAXm_isset
 Bit mask describing which options are set. More...
 

Detailed Description

Specification for access group options.

Definition at line 54 of file AccessGroupSpec.h.

Member Function Documentation

int32_t Hypertable::AccessGroupOptions::get_blocksize ( ) const
inline

Gets blocksize option.

Returns
blocksize option.

Definition at line 97 of file AccessGroupSpec.h.

const std::string& Hypertable::AccessGroupOptions::get_bloom_filter ( ) const
inline

Gets bloom filter option.

Returns
bloom filter option.

Definition at line 157 of file AccessGroupSpec.h.

const std::string& Hypertable::AccessGroupOptions::get_compressor ( ) const
inline

Gets compressor option.

Returns
compressor option.

Definition at line 125 of file AccessGroupSpec.h.

bool Hypertable::AccessGroupOptions::get_in_memory ( ) const
inline

Gets in memory option.

Returns
in memory option.

Definition at line 173 of file AccessGroupSpec.h.

int16_t Hypertable::AccessGroupOptions::get_replication ( ) const
inline

Gets replication option.

Returns
replication option.

Definition at line 81 of file AccessGroupSpec.h.

bool AccessGroupOptions::is_set_blocksize ( ) const

Checks if blocksize option is set.

This method returns the value of the BLOCKSIZE bit of m_isset.

Returns
true if blocksize option is set, false otherwise.

Definition at line 150 of file AccessGroupSpec.cc.

bool AccessGroupOptions::is_set_bloom_filter ( ) const

Checks if bloom filter option is set.

This method returns the value of the BLOOMFILTER bit of m_isset.

Returns
true if bloom filter option is set, false otherwise.

Definition at line 170 of file AccessGroupSpec.cc.

bool AccessGroupOptions::is_set_compressor ( ) const

Checks if compressor option is set.

This method returns the value of the COMPRESSOR bit of m_isset.

Returns
true if compressor option is set, false otherwise.

Definition at line 160 of file AccessGroupSpec.cc.

bool AccessGroupOptions::is_set_in_memory ( ) const

Checks if in memory option is set.

This method returns the value of the IN_MEMORY bit of m_isset.

Returns
true if in memory option is set, false otherwise.

Definition at line 179 of file AccessGroupSpec.cc.

bool AccessGroupOptions::is_set_replication ( ) const

Checks if replication option is set.

This method returns the value of the REPLICATION bit of m_isset.

Returns
true if replication option is set, false otherwise.

Definition at line 141 of file AccessGroupSpec.cc.

void AccessGroupOptions::merge ( const AccessGroupOptions other)

Merges options from another AccessGroupOptions object.

For each option that is not set, if the corresponding option in the other parameter is set, then the option is set to other's value.

Parameters
otherAccessGroupOptions object with which to merge

Definition at line 183 of file AccessGroupSpec.cc.

bool AccessGroupOptions::operator== ( const AccessGroupOptions 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 264 of file AccessGroupSpec.cc.

void AccessGroupOptions::parse_bloom_filter ( const std::string &  spec,
PropertiesPtr props 
)
static

Parsers a bloom filter specification and sets properties.

Parses the bloom filter specification given in spec and populates props with the corresponding properties described in the following table.

Property Type Default Description
bloom-filter-mode string none Mode (rows|rows+cols|none)
bits-per-item float none Number of bits to use per item
num-hashes int none Number of hash functions to use
false-positive float 0.01 Expected false positive probability
max-approx-items int 1000 Number of cell store items used to estimate the number of actual entries
Parameters
specBloom filter specification
propsProperties object to populate

Definition at line 274 of file AccessGroupSpec.cc.

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

Parses XML options specification.

This method parses an XML document which holds access group options, populates the corresponding member variables. The parser accepts any element name for the outtermost element so that it can be used to parse options from any section within a schema XML document (e.g. AccessGroupDefaults or Options). The following example illustrates a valid XML opitons document.

* <Options>
*   <Replication>3</Replication>
*   <BlockSize>67108864</BlockSize>
*   <Compressor>zlib --best</Compressor>
*   <BloomFilter>rows+cols --false-positive 0.02 --bits-per-item 9
*                --num-hashes 7 --max-approx-items 900</BloomFilter>
*   <InMemory>true</InMemory>
* </Options>
* 
Parameters
basePointer to character buffer holding XML document
lenLength of XML document

Definition at line 224 of file AccessGroupSpec.cc.

const std::string AccessGroupOptions::render_hql ( ) const

Renders options in HQL format.

Access group options can be specified in an HQL CREATE TABLE command for access group specifications or table defaults. In both situations, the format of the options specification is the same. The following shows an example of the HQL output produced by this member function.

REPLICATION 3 BLOCKSIZE 67108864 COMPRESSOR "zlib --best" BLOOMFILTER "rows+cols --false-positive 0.02" IN_MEMORY
Returns
std::string representing options in HQL format

Definition at line 249 of file AccessGroupSpec.cc.

const std::string AccessGroupOptions::render_xml ( const std::string &  line_prefix) const

Renders options in XML format.

Access group options can be specified in an XML schema document within the AccessGroup -> Options element or the Table -> AccessGroupDefaults element. This member function generates the XML option specification elements that can be used in both places. 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 following is example output produced by this member function.

*   <Replication>3</Replication>
*   <BlockSize>67108864</BlockSize>
*   <Compressor>zlib --best</Compressor>
*   <BloomFilter>rows+cols --false-positive 0.02 --bits-per-item 9
*                --num-hashes 7 --max-approx-items 900</BloomFilter>
*   <InMemory>true</InMemory>
* 
Parameters
line_prefixstd::string to prepend to each line of output
Returns
std::string representing options in XML format

Definition at line 229 of file AccessGroupSpec.cc.

void AccessGroupOptions::set_blocksize ( int32_t  blocksize)

Sets blocksize option.

Sets the BLOCKSIZE bit of m_isset and sets m_blocksize to blocksize.

Parameters
blocksizeNew value for blocksize option

Definition at line 145 of file AccessGroupSpec.cc.

void AccessGroupOptions::set_bloom_filter ( const std::string &  bloomfilter)

Sets bloom filter option.

Sets the BLOOMFILTER bit of m_isset, validates the specification given in the bloomfilter argument, and if it is valid, sets m_bloomfilter to bloomfilter. The following bloom filter specifications are valid:

mode:
  rows [options]
  rows+cols [options]
  none
options:
  --bits-per-item <float>
  --num-hashes <int>
  --false-positive <float>
  --max-approx-items <int>
Parameters
bloomfilterBloom filter specification
Exceptions
Exceptionwith code set to Error::SCHEMA_PARSE_ERROR if bloom filter specification is invalid

Definition at line 164 of file AccessGroupSpec.cc.

void AccessGroupOptions::set_compressor ( const std::string &  compressor)

Sets compressor option.

Sets the COMPRESSOR bit of m_isset, validates the specification given in the compressor argument, and if it is valid, sets m_compressor to compressor. The following compressor specifications are valid:

  bmz [--fp-len <int>] [--offset <int>]
  lzo
  quicklz
  zlib [--best|--9|--normal]
  snappy
  none
Parameters
compressorCompressor specification
Exceptions
Exceptionwith code set to Error::SCHEMA_PARSE_ERROR if compressor specification is invalid

Definition at line 154 of file AccessGroupSpec.cc.

void AccessGroupOptions::set_in_memory ( bool  value)

Sets in memory option.

Sets the IN_MEMORY bit of m_isset and sets m_in_memory to value.

Parameters
valueNew value for in memory option

Definition at line 174 of file AccessGroupSpec.cc.

void AccessGroupOptions::set_replication ( int16_t  replication)

Sets replication option.

Sets the REPLICATON bit of m_isset and sets m_replication to replication.

Parameters
replicationNew value for replication option

Definition at line 136 of file AccessGroupSpec.cc.

Member Data Documentation

int32_t Hypertable::AccessGroupOptions::m_blocksize {}
private

Block size.

Definition at line 303 of file AccessGroupSpec.h.

std::string Hypertable::AccessGroupOptions::m_bloomfilter
private

Bloom filter specification.

Definition at line 309 of file AccessGroupSpec.h.

std::string Hypertable::AccessGroupOptions::m_compressor
private

Compressor specification.

Definition at line 306 of file AccessGroupSpec.h.

bool Hypertable::AccessGroupOptions::m_in_memory {}
private

In memory.

Definition at line 312 of file AccessGroupSpec.h.

std::bitset<MAX> Hypertable::AccessGroupOptions::m_isset
private

Bit mask describing which options are set.

Definition at line 315 of file AccessGroupSpec.h.

int16_t Hypertable::AccessGroupOptions::m_replication {-1}
private

Replication.

Definition at line 300 of file AccessGroupSpec.h.


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