Specification for column family options. More...
#include <ColumnFamilySpec.h>
Public Types | |
enum | { MAX_VERSIONS, TTL, TIME_ORDER_DESC, COUNTER, MAX } |
Enumeration for isset bits. More... | |
Public Member Functions | |
bool | set_max_versions (int32_t max_versions) |
Sets max versions option. More... | |
int32_t | get_max_versions () const |
Gets max versions option. More... | |
bool | is_set_max_versions () const |
Checks if max versions option is set. More... | |
bool | set_ttl (time_t ttl) |
Sets ttl option. More... | |
time_t | get_ttl () const |
Gets ttl option. More... | |
bool | is_set_ttl () const |
Checks if ttl option is set. More... | |
bool | set_time_order_desc (bool value) |
Sets time order desc option. More... | |
bool | get_time_order_desc () const |
Gets time order desc option. More... | |
bool | is_set_time_order_desc () const |
Checks if time_order_desc option is set. More... | |
bool | set_counter (bool value) |
Sets counter option. More... | |
bool | get_counter () const |
Gets the counter option. More... | |
bool | is_set_counter () const |
Checks if counter option is set. More... | |
void | merge (const ColumnFamilyOptions &other) |
Merges options from another ColumnFamilyOptions object. More... | |
void | parse_xml (const char *base, int len) |
Parses XML options document. 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 ColumnFamilyOptions &other) const |
Equality operator. More... | |
Private Attributes | |
int32_t | m_max_versions {} |
Max version. More... | |
time_t | m_ttl {} |
TTL. More... | |
bool | m_time_order_desc {} |
Time order "desc" flag. More... | |
bool | m_counter {} |
Counter. More... | |
std::bitset< MAX > | m_isset |
Bit mask describing which options are set. More... | |
Specification for column family options.
Definition at line 40 of file ColumnFamilySpec.h.
|
inline |
|
inline |
Gets max versions option.
Definition at line 71 of file ColumnFamilySpec.h.
|
inline |
Gets time order desc option.
Definition at line 111 of file ColumnFamilySpec.h.
|
inline |
bool ColumnFamilyOptions::is_set_counter | ( | ) | const |
Checks if counter option is set.
This method returns the value of the COUNTER bit of m_isset.
Definition at line 118 of file ColumnFamilySpec.cc.
bool ColumnFamilyOptions::is_set_max_versions | ( | ) | const |
Checks if max versions option is set.
This method returns the value of the MAX_VERSIONS bit of m_isset.
Definition at line 59 of file ColumnFamilySpec.cc.
bool ColumnFamilyOptions::is_set_time_order_desc | ( | ) | const |
Checks if time_order_desc option is set.
This method returns the value of the TIME_ORDER_DESC bit of m_isset.
Definition at line 96 of file ColumnFamilySpec.cc.
bool ColumnFamilyOptions::is_set_ttl | ( | ) | const |
Checks if ttl option is set.
This method returns the value of the TTL bit of m_isset.
Definition at line 76 of file ColumnFamilySpec.cc.
void ColumnFamilyOptions::merge | ( | const ColumnFamilyOptions & | other | ) |
Merges options from another ColumnFamilyOptions 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.
other | ColumnFamilyOptions object with which to merge |
Definition at line 123 of file ColumnFamilySpec.cc.
bool ColumnFamilyOptions::operator== | ( | const ColumnFamilyOptions & | other | ) | const |
Equality operator.
other | Other object to which comparison is to be made |
other
, false otherwise. Definition at line 195 of file ColumnFamilySpec.cc.
void ColumnFamilyOptions::parse_xml | ( | const char * | base, |
int | len | ||
) |
Parses XML options document.
This method parses an XML document which holds column family 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. ColumnFamilyDefaults and Options). The following example illustrates a valid XML opitons document.
* <Options> * <MaxVersions>3</MaxVersions> * <TTL>1398615345</TTL> * <TimeOrder>desc</TimeOrder> * <Counter>false</Counter> * </Options> *
base | Pointer to character buffer holding XML document |
len | Length of XML document |
Definition at line 161 of file ColumnFamilySpec.cc.
const std::string ColumnFamilyOptions::render_hql | ( | ) | const |
Renders options in HQL format.
Column family options can be specified in an HQL CREATE TABLE
command for columns, access group defaults, and table defaults. In all three situations, the format of the options specification is the same. The following shows an example of the HQL output that could be produced by this member function.
MAX_VERSIONS 3 TTL 1398615345 TIME_ORDER desc
Definition at line 182 of file ColumnFamilySpec.cc.
const std::string ColumnFamilyOptions::render_xml | ( | const std::string & | line_prefix | ) | const |
Renders options in XML format.
Column family options can be specified in an XML schema document within the ColumnFamily -> Options
element or the AccessGroup -> ColumnFamilyDefaults
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.
* <MaxVersions>3</MaxVersions> * <TTL>1398615345</TTL> * <TimeOrder>desc</TimeOrder> * <Counter>false</Counter> *
line_prefix | std::string to prepend to each line of output |
Definition at line 166 of file ColumnFamilySpec.cc.
bool ColumnFamilyOptions::set_counter | ( | bool | value | ) |
Sets counter option.
Sets the COUNTER bit of m_isset and sets m_counter to value
.
value | New value for counter option. |
value
was equal to the existing value. Exception | if supplied value is true and either the max versions or time order desc options are set, which are incompatible with the counter option. |
Definition at line 101 of file ColumnFamilySpec.cc.
bool ColumnFamilyOptions::set_max_versions | ( | int32_t | max_versions | ) |
Sets max versions option.
Sets the MAX_VERSIONS bit of m_isset and sets m_max_versions to max_versions
.
max_versions | New value for max versions option |
max_versions
was equal to the existing value. Exception | if max_versions is negative or if the counter option is set, which is incompatible. |
Definition at line 39 of file ColumnFamilySpec.cc.
bool ColumnFamilyOptions::set_time_order_desc | ( | bool | value | ) |
Sets time order desc option.
Sets the TIME_ORDER_DESC bit of m_isset and sets m_time_order_desc to value
.
value | New value for time order desc option |
value
was equal to the existing value. Exception | if supplied value is true and the counter option is set, which is incompatible with the time order desc option. |
Definition at line 81 of file ColumnFamilySpec.cc.
bool ColumnFamilyOptions::set_ttl | ( | time_t | ttl | ) |
Sets ttl option.
Sets the TTL bit of m_isset and sets m_ttl to ttl
.
ttl | New value for ttl option |
ttl
was equal to the existing value. Exception | if supplied ttl value is negative. |
Definition at line 64 of file ColumnFamilySpec.cc.
|
private |
Counter.
Definition at line 218 of file ColumnFamilySpec.h.
|
private |
Bit mask describing which options are set.
Definition at line 221 of file ColumnFamilySpec.h.
|
private |
Max version.
Definition at line 209 of file ColumnFamilySpec.h.
|
private |
Time order "desc" flag.
Definition at line 215 of file ColumnFamilySpec.h.
|
private |
TTL.
Definition at line 212 of file ColumnFamilySpec.h.