Access group specification. More...
#include <AccessGroupSpec.h>
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... | |
ColumnFamilySpec * | replace_column (ColumnFamilySpec *new_cf) |
Replaces column family specification. More... | |
ColumnFamilySpec * | remove_column (const std::string &name) |
Removes column family specification. More... | |
void | drop_column (const std::string &name) |
Drops column family. More... | |
ColumnFamilySpec * | get_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... | |
ColumnFamilySpecs & | columns () |
Returns reference to column specifications. More... | |
const AccessGroupOptions & | options () const |
Returns reference to options structure. More... | |
const ColumnFamilyOptions & | defaults () 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... | |
Access group specification.
Definition at line 319 of file AccessGroupSpec.h.
|
inline |
Default constructor.
Definition at line 323 of file AccessGroupSpec.h.
|
inline |
Constructor with name initializer.
Initializes m_name with name
name | Access 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.
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.
|
inline |
|
inline |
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.
original | Original access group spec with which to compare |
original
, false otherwise. Definition at line 308 of file AccessGroupSpec.cc.
|
inline |
Returns reference to column specifications.
Definition at line 607 of file AccessGroupSpec.h.
|
inline |
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.
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.
Definition at line 447 of file AccessGroupSpec.cc.
int32_t AccessGroupSpec::get_default_max_versions | ( | ) | const |
Gets 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.
Definition at line 437 of file AccessGroupSpec.cc.
time_t AccessGroupSpec::get_default_ttl | ( | ) | const |
Gets default ttl column family option.
Definition at line 426 of file AccessGroupSpec.cc.
|
inline |
|
inline |
int32_t AccessGroupSpec::get_option_blocksize | ( | ) | const |
const std::string & AccessGroupSpec::get_option_bloom_filter | ( | ) | const |
Gets bloom filter option.
Definition at line 394 of file AccessGroupSpec.cc.
const std::string AccessGroupSpec::get_option_compressor | ( | ) | const |
Gets compressor option.
Definition at line 383 of file AccessGroupSpec.cc.
bool AccessGroupSpec::get_option_in_memory | ( | ) | const |
int16_t AccessGroupSpec::get_option_replication | ( | ) | const |
Gets replication option.
Definition at line 361 of file AccessGroupSpec.cc.
|
inline |
Merges column family defaults with those from another AccessGroupOptions object.
options | Options with which to merge |
Definition at line 516 of file AccessGroupSpec.h.
|
inline |
Merges options with those from another AccessGroupOptions object.
options | Options with which to merge |
Definition at line 509 of file AccessGroupSpec.h.
bool AccessGroupSpec::operator== | ( | const AccessGroupSpec & | other | ) | const |
Equality operator.
other | Other object to which comparison is to be made |
other
, false otherwise. Definition at line 507 of file AccessGroupSpec.cc.
|
inline |
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.
base | Pointer to character buffer holding XML document |
len | Length of XML document |
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.
name | Name of column family specification to remove |
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
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>
line_prefix | std::string to prepend to each line of output |
with_ids | Include column family IDs and Generation in output |
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.
new_cf | Replacement 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
value | New counter column family default |
Exception | if 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
max_versions | New max versions column family default |
Exception | if 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
value | New time order desc column family default |
Exception | if 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
ttl | New ttl column family default |
Exception | if supplied ttl value is negative. |
Definition at line 420 of file AccessGroupSpec.cc.
|
inline |
Sets generation.
generation | Generation 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
name | Access 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
blocksize | New 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().
bloomfilter | Bloom filter specification |
Exception | with 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().
compressor | Compressor specification |
Exception | with 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
value | New 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
replication | New value for replication option |
Definition at line 354 of file AccessGroupSpec.cc.
|
private |
Member column family specifications.
Definition at line 632 of file AccessGroupSpec.h.
|
private |
Column family defaults.
Definition at line 629 of file AccessGroupSpec.h.
|
private |
Generation.
Definition at line 623 of file AccessGroupSpec.h.
|
private |
Name.
Definition at line 620 of file AccessGroupSpec.h.
|
private |
Options.
Definition at line 626 of file AccessGroupSpec.h.