libfoedus-core
FOEDUS Core Library
foedus::log::LogHeader Struct Reference

A common header part for all log types. More...

Detailed Description

A common header part for all log types.

Each log type should contain this as the first member. This is 16-byte, so compiler won't do any reorder or filling.

Definition at line 50 of file common_log_types.hpp.

#include <common_log_types.hpp>

Collaboration diagram for foedus::log::LogHeader:

Public Member Functions

LogCode get_type () const __attribute__((always_inline))
 Convenience method to cast into LogCode. More...
 
LogCodeKind get_kind () const __attribute__((always_inline))
 Convenience method to get LogCodeKind. More...
 
bool is_valid_type () const
 Another convenience method to see if the type code is non-zero and exists. More...
 
void set_xct_id (xct::XctId new_xct_id)
 Because of the special case of FillerLogType, we must use this method to set xct_id. More...
 

Public Attributes

uint16_t log_type_code_
 Actually of LogCode defined in the X-Macro, but we want to make sure the type size is 2 bytes. More...
 
uint16_t log_length_
 Byte size of this log entry including this header itself and everything. More...
 
storage::StorageId storage_id_
 The storage this loggable operation mainly affects. More...
 
xct::XctId xct_id_
 Epoch and in-epoch ordinal of this log. More...
 

Friends

std::ostream & operator<< (std::ostream &o, const LogHeader &v)
 

Member Function Documentation

LogCodeKind foedus::log::LogHeader::get_kind ( ) const
inline

Convenience method to get LogCodeKind.

Definition at line 80 of file common_log_types.hpp.

References foedus::log::get_log_code_kind(), and get_type().

Referenced by foedus::log::MetaLogBuffer::commit(), foedus::restart::RestartManagerPimpl::redo_meta_logs(), and foedus::snapshot::LogReducerRef::verify_log_chunk().

80 { return get_log_code_kind(get_type()); }
LogCodeKind get_log_code_kind(LogCode code)
Returns the kind of the given log code.
Definition: log_type.hpp:118
LogCode get_type() const __attribute__((always_inline))
Convenience method to cast into LogCode.

Here is the call graph for this function:

Here is the caller graph for this function:

LogCode foedus::log::LogHeader::get_type ( ) const
inline

Convenience method to cast into LogCode.

Definition at line 78 of file common_log_types.hpp.

References log_type_code_.

Referenced by foedus::storage::DropLogType::assert_valid(), foedus::storage::hash::HashCreateLogType::assert_valid(), foedus::storage::masstree::MasstreeCreateLogType::assert_valid(), foedus::storage::array::ArrayCreateLogType::assert_valid(), foedus::storage::sequential::SequentialCreateLogType::assert_valid(), foedus::storage::sequential::SequentialTruncateLogType::assert_valid(), foedus::storage::sequential::SequentialAppendLogType::assert_valid(), foedus::storage::array::ArrayOverwriteLogType::assert_valid(), foedus::storage::array::ArrayIncrementLogType::assert_valid(), foedus::storage::hash::HashInsertLogType::assert_valid(), foedus::storage::hash::HashDeleteLogType::assert_valid(), foedus::storage::masstree::MasstreeInsertLogType::assert_valid(), foedus::storage::hash::HashUpdateLogType::assert_valid(), foedus::storage::masstree::MasstreeDeleteLogType::assert_valid(), foedus::storage::masstree::MasstreeUpdateLogType::assert_valid(), foedus::storage::hash::HashOverwriteLogType::assert_valid(), foedus::storage::masstree::MasstreeOverwriteLogType::assert_valid(), foedus::snapshot::MergeSort::change_log_type_at(), foedus::storage::array::compact_logs(), get_kind(), foedus::log::invoke_apply_engine(), foedus::log::invoke_apply_record(), foedus::log::invoke_apply_storage(), foedus::log::invoke_assert_valid(), foedus::log::invoke_ostream(), is_valid_type(), foedus::log::operator<<(), foedus::xct::XctManagerPimpl::precommit_xct_apply(), foedus::storage::sequential::StreamStatus::read_entry(), foedus::restart::RestartManagerPimpl::redo_meta_logs(), foedus::storage::masstree::resolve_log(), set_xct_id(), and foedus::snapshot::LogReducerRef::verify_log_chunk().

78 { return static_cast<LogCode>(log_type_code_); }
LogCode
A unique identifier of all log types.
Definition: log_type.hpp:87
uint16_t log_type_code_
Actually of LogCode defined in the X-Macro, but we want to make sure the type size is 2 bytes...

Here is the caller graph for this function:

bool foedus::log::LogHeader::is_valid_type ( ) const
inline

Another convenience method to see if the type code is non-zero and exists.

Definition at line 83 of file common_log_types.hpp.

References get_type(), and foedus::log::is_valid_log_type().

83 { return is_valid_log_type(get_type()); }
bool is_valid_log_type(LogCode code)
Returns if the LogCode value exists.
Definition: log_type.hpp:128
LogCode get_type() const __attribute__((always_inline))
Convenience method to cast into LogCode.

Here is the call graph for this function:

void foedus::log::LogHeader::set_xct_id ( xct::XctId  new_xct_id)
inline

Because of the special case of FillerLogType, we must use this method to set xct_id.

Definition at line 86 of file common_log_types.hpp.

References ASSERT_ND, get_type(), and foedus::log::kLogCodeFiller.

Referenced by foedus::xct::XctManagerPimpl::precommit_xct_apply().

86  {
87  if (log_length_ >= 16) {
88  xct_id_ = new_xct_id;
89  } else {
90  // So far only log type that omits xct_id is FillerLogType.
92  }
93  }
xct::XctId xct_id_
Epoch and in-epoch ordinal of this log.
uint16_t log_length_
Byte size of this log entry including this header itself and everything.
0x3001 : foedus::log::FillerLogType .
Definition: log_type.hpp:111
LogCode get_type() const __attribute__((always_inline))
Convenience method to cast into LogCode.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const LogHeader v 
)
friend

Definition at line 31 of file common_log_types.cpp.

31  {
32  o << "<Header type=\"" << assorted::Hex(v.log_type_code_) << "\" type_name=\""
33  << get_log_type_name(v.get_type()) << "\" length=\"" << assorted::Hex(v.log_length_)
34  << "\" storage_id=\"" << v.storage_id_ << "\" />";
35  return o;
36 }
const char * get_log_type_name(LogCode code)
Returns the names of LogCode enum defined in log_type.xmacro.
Definition: log_type.cpp:28

Member Data Documentation

uint16_t foedus::log::LogHeader::log_length_

Byte size of this log entry including this header itself and everything.

We so far support up to 64KB per log.

Todo:
all log types are 8-byte aligned, so this can store /8, allowing a 512KB log.

Definition at line 61 of file common_log_types.hpp.

Referenced by foedus::snapshot::MergeSort::InputStatus::assert_consistent(), foedus::storage::DropLogType::assert_valid(), foedus::storage::hash::HashCreateLogType::assert_valid(), foedus::storage::masstree::MasstreeCreateLogType::assert_valid(), foedus::storage::array::ArrayCreateLogType::assert_valid(), foedus::storage::sequential::SequentialCreateLogType::assert_valid(), foedus::storage::sequential::SequentialTruncateLogType::assert_valid(), foedus::storage::sequential::SequentialAppendLogType::assert_valid(), foedus::storage::array::ArrayOverwriteLogType::assert_valid(), foedus::storage::array::ArrayIncrementLogType::assert_valid(), foedus::storage::hash::HashInsertLogType::assert_valid(), foedus::storage::hash::HashDeleteLogType::assert_valid(), foedus::storage::masstree::MasstreeInsertLogType::assert_valid(), foedus::storage::hash::HashUpdateLogType::assert_valid(), foedus::storage::masstree::MasstreeDeleteLogType::assert_valid(), foedus::storage::masstree::MasstreeUpdateLogType::assert_valid(), foedus::storage::hash::HashOverwriteLogType::assert_valid(), foedus::storage::masstree::MasstreeOverwriteLogType::assert_valid(), foedus::log::MetaLogBuffer::commit(), foedus::snapshot::MergeSort::InputStatus::is_last_chunk_in_window(), foedus::log::on_non_durable_meta_log_found(), foedus::log::operator<<(), foedus::storage::DropLogType::populate(), foedus::storage::sequential::SequentialAppendLogType::populate(), foedus::storage::array::ArrayOverwriteLogType::populate(), foedus::storage::array::ArrayIncrementLogType::populate(), foedus::log::FillerLogType::populate(), foedus::log::EpochMarkerLogType::populate(), foedus::storage::hash::HashCommonLogType::populate_base(), foedus::storage::masstree::MasstreeCommonLogType::populate_base(), foedus::storage::array::ArrayOverwriteLogType::populate_primitive(), foedus::storage::sequential::StreamStatus::read_entry(), foedus::restart::RestartManagerPimpl::redo_meta_logs(), foedus::storage::sequential::SequentialStoragePimpl::truncate(), and foedus::snapshot::LogReducerRef::verify_log_chunk().


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