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 | Public Attributes | Protected Member Functions | List of all members
Hypertable::RangeState Class Reference

Range state. More...

#include <RangeState.h>

Inheritance diagram for Hypertable::RangeState:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::RangeState:
Collaboration graph
[legend]

Public Types

enum  StateType {
  STEADY, SPLIT_LOG_INSTALLED, SPLIT_SHRUNK, RELINQUISH_LOG_INSTALLED,
  RELINQUISH_COMPACTED, PHANTOM = 0x80
}
 Mixed enumeration for range state values and PHANTOM bit mask. More...
 

Public Member Functions

 RangeState ()
 Default constructor. More...
 
 RangeState (CharArena &arena, const RangeState &other)
 Copy constructor. More...
 
virtual ~RangeState ()
 Destructor. More...
 
virtual void clear ()
 Clears state. More...
 
- Public Member Functions inherited from Hypertable::Serializable
virtual size_t encoded_length () const
 Returns serialized object length. More...
 
virtual void encode (uint8_t **bufp) const
 Writes serialized representation of object to a buffer. More...
 
virtual void decode (const uint8_t **bufp, size_t *remainp)
 Reads serialized representation of object from a buffer. More...
 

Static Public Member Functions

static std::string get_text (uint8_t state)
 Returns string representation of range state value. More...
 

Public Attributes

uint8_t state
 Range state value (see StateType) More...
 
int64_t timestamp
 Timestamp More...
 
uint64_t soft_limit
 Soft split size limit. More...
 
const char * transfer_log
 Full pathname of transfer log. More...
 
const char * split_point
 Split point (row key) More...
 
const char * old_boundary_row
 Original range boundary row. More...
 
const char * source
 Source server where this range previously lived. More...
 

Protected Member Functions

uint8_t encoding_version () const override
 Returns encoding version. More...
 
size_t encoded_length_internal () const override
 Returns internal serialized length. More...
 
void encode_internal (uint8_t **bufp) const override
 Writes serialized representation of object to a buffer. More...
 
void decode_internal (uint8_t version, const uint8_t **bufp, size_t *remainp) override
 Reads serialized representation of object from a buffer. More...
 

Detailed Description

Range state.

An object of this class is created for each range in a range server and holds state that can change during the lifetime of the range. This class is essentially just a structure with some helper methods. There are several members that are c-style string pointers. The memory that these c-style strings point to must be managed outside of this class and must be valid for the lifetime of the object.

Definition at line 48 of file RangeState.h.

Constructor & Destructor Documentation

Hypertable::RangeState::RangeState ( )
inline

Default constructor.

Initializies all members to 0 and state to RangeState::STEADY

Definition at line 64 of file RangeState.h.

Hypertable::RangeState::RangeState ( CharArena arena,
const RangeState other 
)
inline

Copy constructor.

Parameters
arenaMemory arena for allocating copied strings
otherOther object to copy

Definition at line 71 of file RangeState.h.

virtual Hypertable::RangeState::~RangeState ( )
inlinevirtual

Destructor.

Definition at line 82 of file RangeState.h.

Member Function Documentation

void RangeState::clear ( )
virtual

Clears state.

This method sets state to RangeState::STEADY and all other members to 0, except timestamp, which it leaves intact

Note
This method does not clear the timestamp member

Reimplemented in Hypertable::RangeStateManaged.

Definition at line 41 of file RangeState.cc.

void RangeState::decode_internal ( uint8_t  version,
const uint8_t **  bufp,
size_t *  remainp 
)
overrideprotectedvirtual

Reads serialized representation of object from a buffer.

Parameters
versionEncoding version
bufpAddress of destination buffer pointer (advanced by call)
remainpAddress of integer holding amount of serialized object remaining
See also
encode_internal() for encoding format

Implements Hypertable::Serializable.

Reimplemented in Hypertable::RangeStateManaged.

Definition at line 133 of file RangeState.cc.

void RangeState::encode_internal ( uint8_t **  bufp) const
overrideprotectedvirtual

Writes serialized representation of object to a buffer.

Parameters
bufpAddress of destination buffer pointer (advanced by call)

Encoding is as follows:

Encoding Description
i8 State code
i64 Timestamp
i64 Soft limit
vstr Transfer log
vstr Split point
vstr Old boundary row
vstr Source server location

Implements Hypertable::Serializable.

Definition at line 123 of file RangeState.cc.

size_t RangeState::encoded_length_internal ( ) const
overrideprotectedvirtual

Returns internal serialized length.

Returns
Internal serialized length
See also
encode_internal() for encoding format

Implements Hypertable::Serializable.

Definition at line 80 of file RangeState.cc.

uint8_t RangeState::encoding_version ( ) const
overrideprotectedvirtual

Returns encoding version.

Returns
Encoding version

Implements Hypertable::Serializable.

Definition at line 76 of file RangeState.cc.

String RangeState::get_text ( uint8_t  state)
static

Returns string representation of range state value.

This method returns a string representation of state. If the RangeState::PHANTOM bit is set, then the string representation will include |PHANTOM as a suffix (e.g. SPLIT_SHRUNK|PHANTOM).

Parameters
state&Range state value
Returns
std::string representation of range state value.

Definition at line 48 of file RangeState.cc.

Member Data Documentation

const char* Hypertable::RangeState::old_boundary_row

Original range boundary row.

Definition at line 117 of file RangeState.h.

uint64_t Hypertable::RangeState::soft_limit

Soft split size limit.

Definition at line 108 of file RangeState.h.

const char* Hypertable::RangeState::source

Source server where this range previously lived.

Definition at line 120 of file RangeState.h.

const char* Hypertable::RangeState::split_point

Split point (row key)

Definition at line 114 of file RangeState.h.

uint8_t Hypertable::RangeState::state

Range state value (see StateType)

Definition at line 102 of file RangeState.h.

int64_t Hypertable::RangeState::timestamp

Timestamp

Definition at line 105 of file RangeState.h.

const char* Hypertable::RangeState::transfer_log

Full pathname of transfer log.

Definition at line 111 of file RangeState.h.


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