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

Recover entity used for sanity checking. More...

#include <MetaLogEntity.h>

Inheritance diagram for Hypertable::MetaLog::EntityRecover:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::MetaLog::EntityRecover:
Collaboration graph
[legend]

Public Member Functions

 EntityRecover ()
 Constructor. More...
 
size_t encoded_length () const override
 Returns serialized object length. More...
 
void encode (uint8_t **bufp) const override
 Writes serialized representation of object to a buffer. More...
 
void decode (const uint8_t **bufp, size_t *remainp) override
 Reads serialized representation of object from a buffer. More...
 
void decode (const uint8_t **bufp, size_t *remainp, uint16_t definition_version) override
 Decodes serialized entity state. More...
 
const std::string name () override
 Returns the name of the entity. More...
 
- Public Member Functions inherited from Hypertable::MetaLog::Entity
 Entity (int32_t type)
 Constructor from entity type. More...
 
 Entity (const EntityHeader &header_)
 Constructor from entity header. More...
 
virtual ~Entity ()
 Destructor. More...
 
void lock ()
 Locks the entity's mutex. More...
 
void unlock ()
 Unlocks the entity's mutex. More...
 
void mark_for_removal ()
 Marks entity for removal. More...
 
bool marked_for_removal ()
 Checks if entity is marked for removal. More...
 
int64_t id () const
 Returns the entity ID. More...
 
virtual void display (std::ostream &os)
 Prints a textual representation of the entity state to an ostream. More...
 

Private 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...
 

Additional Inherited Members

- Protected Member Functions inherited from Hypertable::MetaLog::Entity
void encode_entry (uint8_t **bufp)
 Encodes entity header plus serialized state. More...
 
- Protected Attributes inherited from Hypertable::MetaLog::Entity
std::mutex m_mutex
 Mutex for serializing access to members More...
 
EntityHeader header
 Entity header More...
 

Detailed Description

Recover entity used for sanity checking.

When a MetaLog is opened for writing, a set of entities are provided which first get written to the new log (see Writer()). The log file is kept open by the MetaLog::Writer during the execution of the server and application object state changes are recorded in the log by updating the state of the associated entity object and appending the updated entity to the log file. To detect the situation when a server exits before the initially provided entities were completely written to the log, an EntityRecover object is written to the log after all of the initially provided entities. When the MetaLog::Reader reads a MetaLog file, it checks for this entity and if not found, it throws and Exception with error code Error::METALOG_MISSING_RECOVER_ENTITY.

Definition at line 207 of file MetaLogEntity.h.

Constructor & Destructor Documentation

Hypertable::MetaLog::EntityRecover::EntityRecover ( )
inline

Constructor.

Initializes parent Entity constructor with EntityType::RECOVER.

Definition at line 213 of file MetaLogEntity.h.

Member Function Documentation

void Hypertable::MetaLog::EntityRecover::decode ( const uint8_t **  bufp,
size_t *  remainp 
)
inlineoverridevirtual

Reads serialized representation of object from a buffer.

Parameters
bufpAddress of destination buffer pointer (advanced by call)
remainpAddress of integer holding amount of remaining buffer
See also
encode() for encoding format
Exceptions
Exceptionwith code Error::PROTOCOL_ERROR if version being decoded is greater than that returned by encoding_version().

Reimplemented from Hypertable::Serializable.

Definition at line 219 of file MetaLogEntity.h.

void Hypertable::MetaLog::EntityRecover::decode ( const uint8_t **  bufp,
size_t *  remainp,
uint16_t  definition_version 
)
inlineoverridevirtual

Decodes serialized entity state.

Parameters
bufpAddress of destination buffer pointer (advanced by call)
remainpAddress of integer holding amount of remaining buffer
definition_versionVersion of MetaLog::Definition that was used to generate the log.

Reimplemented from Hypertable::MetaLog::Entity.

Definition at line 221 of file MetaLogEntity.h.

void Hypertable::MetaLog::EntityRecover::decode_internal ( uint8_t  version,
const uint8_t **  bufp,
size_t *  remainp 
)
inlineoverrideprivatevirtual

Reads serialized representation of object from a buffer.

This function is to be overridden by derived classes and should decode the object per-se as encoded with encode_internal().

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

Implements Hypertable::Serializable.

Definition at line 238 of file MetaLogEntity.h.

void Hypertable::MetaLog::EntityRecover::encode ( uint8_t **  bufp) const
inlineoverridevirtual

Writes serialized representation of object to a buffer.

This function encodes a serialized representation of the object, starting with a header that includes the encoding version and the serialized length of the object. After the header, the object per-se is encoded with encode_internal().

Parameters
bufpAddress of destination buffer pointer (advanced by call)

Encoding is as follows:

Encoding Description
1 byte Encoding version as returned by encoding_version()
vint Length of encoded object as returned by encoded_length_internal()
variable Object encoded with encode_internal()

Reimplemented from Hypertable::Serializable.

Definition at line 217 of file MetaLogEntity.h.

void Hypertable::MetaLog::EntityRecover::encode_internal ( uint8_t **  bufp) const
inlineoverrideprivatevirtual

Writes serialized representation of object to a buffer.

This function is to be overridden by derived classes and should encode the object per-se.

Parameters
bufpAddress of destination buffer pointer (advanced by call)

Implements Hypertable::Serializable.

Definition at line 236 of file MetaLogEntity.h.

size_t Hypertable::MetaLog::EntityRecover::encoded_length ( ) const
inlineoverridevirtual

Returns serialized object length.

Returns the serialized length of the object as encoded by encode().

See also
encode() for encoding format
Returns
Overall serialized object length

Reimplemented from Hypertable::Serializable.

Definition at line 215 of file MetaLogEntity.h.

size_t Hypertable::MetaLog::EntityRecover::encoded_length_internal ( ) const
inlineoverrideprivatevirtual

Returns internal serialized length.

This function is to be overridden by derived classes and should return the length of the the serialized object per-se.

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

Implements Hypertable::Serializable.

Definition at line 234 of file MetaLogEntity.h.

uint8_t Hypertable::MetaLog::EntityRecover::encoding_version ( ) const
inlineoverrideprivatevirtual

Returns encoding version.

Returns
Encoding version

Implements Hypertable::Serializable.

Definition at line 232 of file MetaLogEntity.h.

const std::string Hypertable::MetaLog::EntityRecover::name ( )
inlineoverridevirtual

Returns the name of the entity.

This method returns the name of the entity ("Recover")

Returns
Name of the entity ("Recover")

Implements Hypertable::MetaLog::Entity.

Definition at line 228 of file MetaLogEntity.h.


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