Recover entity used for sanity checking. More...
#include <MetaLogEntity.h>
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... | |
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.
|
inline |
Constructor.
Initializes parent Entity constructor with EntityType::RECOVER.
Definition at line 213 of file MetaLogEntity.h.
|
inlineoverridevirtual |
Reads serialized representation of object from a buffer.
bufp | Address of destination buffer pointer (advanced by call) |
remainp | Address of integer holding amount of remaining buffer |
Exception | with 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.
|
inlineoverridevirtual |
Decodes serialized entity state.
bufp | Address of destination buffer pointer (advanced by call) |
remainp | Address of integer holding amount of remaining buffer |
definition_version | Version of MetaLog::Definition that was used to generate the log. |
Reimplemented from Hypertable::MetaLog::Entity.
Definition at line 221 of file MetaLogEntity.h.
|
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().
version | Encoding version |
bufp | Address of destination buffer pointer (advanced by call) |
remainp | Address of integer holding amount of serialized encoding remaining |
Implements Hypertable::Serializable.
Definition at line 238 of file MetaLogEntity.h.
|
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().
bufp | Address 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.
|
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.
bufp | Address of destination buffer pointer (advanced by call) |
Implements Hypertable::Serializable.
Definition at line 236 of file MetaLogEntity.h.
|
inlineoverridevirtual |
Returns serialized object length.
Returns the serialized length of the object as encoded by encode().
Reimplemented from Hypertable::Serializable.
Definition at line 215 of file MetaLogEntity.h.
|
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.
Implements Hypertable::Serializable.
Definition at line 234 of file MetaLogEntity.h.
|
inlineoverrideprivatevirtual |
Returns encoding version.
Implements Hypertable::Serializable.
Definition at line 232 of file MetaLogEntity.h.
|
inlineoverridevirtual |
Returns the name of the entity.
This method returns the name of the entity ("Recover")
Implements Hypertable::MetaLog::Entity.
Definition at line 228 of file MetaLogEntity.h.