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

Specification for column family options. More...

#include <ColumnFamilySpec.h>

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

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< MAXm_isset
 Bit mask describing which options are set. More...
 

Detailed Description

Specification for column family options.

Definition at line 40 of file ColumnFamilySpec.h.

Member Function Documentation

bool Hypertable::ColumnFamilyOptions::get_counter ( ) const
inline

Gets the counter option.

Returns
counter option.

Definition at line 133 of file ColumnFamilySpec.h.

int32_t Hypertable::ColumnFamilyOptions::get_max_versions ( ) const
inline

Gets max versions option.

Returns
max versions option.

Definition at line 71 of file ColumnFamilySpec.h.

bool Hypertable::ColumnFamilyOptions::get_time_order_desc ( ) const
inline

Gets time order desc option.

Returns
time order desc option.

Definition at line 111 of file ColumnFamilySpec.h.

time_t Hypertable::ColumnFamilyOptions::get_ttl ( ) const
inline

Gets ttl option.

Returns
ttl option.

Definition at line 90 of file ColumnFamilySpec.h.

bool ColumnFamilyOptions::is_set_counter ( ) const

Checks if counter option is set.

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

Returns
true if counter option is set, false otherwise.

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.

Returns
true if max versions option is set, false otherwise.

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.

Returns
true if time order desc option is set, false otherwise.

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.

Returns
true if ttl option is set, false otherwise.

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.

Parameters
otherColumnFamilyOptions object with which to merge

Definition at line 123 of file ColumnFamilySpec.cc.

bool ColumnFamilyOptions::operator== ( const ColumnFamilyOptions 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 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>
* 
Parameters
basePointer to character buffer holding XML document
lenLength 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
Returns
std::string representing options in HQL format

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>
* 
Parameters
line_prefixstd::string to prepend to each line of output
Returns
std::string representing options in XML format

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.

Parameters
valueNew value for counter option.
Returns
true if counter option was set, otherwise false if counter option was not set because the supplied value was equal to the existing value.
Exceptions
Exceptionif 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.

Parameters
max_versionsNew value for max versions option
Returns
true if max versions option was set, otherwise false if max versions option was not set because the supplied value max_versions was equal to the existing value.
Exceptions
Exceptionif 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.

Parameters
valueNew value for time order desc option
Returns
true if time order desc option was set, otherwise false if time order desc option was not set because the supplied value was equal to the existing value.
Exceptions
Exceptionif 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.

Parameters
ttlNew value for ttl option
Returns
true if ttl option was set, otherwise false if ttl option was not set because the supplied value ttl was equal to the existing value.
Exceptions
Exceptionif supplied ttl value is negative.

Definition at line 64 of file ColumnFamilySpec.cc.

Member Data Documentation

bool Hypertable::ColumnFamilyOptions::m_counter {}
private

Counter.

Definition at line 218 of file ColumnFamilySpec.h.

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

Bit mask describing which options are set.

Definition at line 221 of file ColumnFamilySpec.h.

int32_t Hypertable::ColumnFamilyOptions::m_max_versions {}
private

Max version.

Definition at line 209 of file ColumnFamilySpec.h.

bool Hypertable::ColumnFamilyOptions::m_time_order_desc {}
private

Time order "desc" flag.

Definition at line 215 of file ColumnFamilySpec.h.

time_t Hypertable::ColumnFamilyOptions::m_ttl {}
private

TTL.

Definition at line 212 of file ColumnFamilySpec.h.


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