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

A thread-buffer's epoch marker, which indicates where a thread switched an epoch. More...

Detailed Description

A thread-buffer's epoch marker, which indicates where a thread switched an epoch.

See also
foedus::log::ThreadLogBuffer
foedus::log::ThreadLogBufferMeta

When the thread publishes a commited log with new epoch, it adds this mark for logger. Unlike logger's epoch mark, we don't write out actual log entry for this. Epoch mark is stored for only non-durable regions. Thus, the logger doesn't have to worry about whether the marked offset is still valid or not.

Definition at line 45 of file thread_log_buffer.hpp.

#include <thread_log_buffer.hpp>

Collaboration diagram for foedus::log::ThreadEpockMark:

Public Member Functions

 ThreadEpockMark ()
 
 ThreadEpockMark (Epoch old_epoch, Epoch new_epoch, uint64_t offset_begin)
 

Public Attributes

Epoch old_epoch_
 The value of new_epoch_ of the previous mark. More...
 
Epoch new_epoch_
 The epoch of log entries this mark represents. More...
 
uint64_t offset_begin_
 Where the new epoch starts. More...
 
uint64_t offset_end_
 Where the new epoch ends. More...
 

Friends

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

Constructor & Destructor Documentation

foedus::log::ThreadEpockMark::ThreadEpockMark ( )
inline

Definition at line 76 of file thread_log_buffer.hpp.

References foedus::Epoch::reset().

76  {
77  old_epoch_.reset();
78  new_epoch_.reset();
79  offset_begin_ = 0;
80  offset_end_ = 0;
81  }
void reset()
Clears this epoch variable so that it points to an invalid epoch.
Definition: epoch.hpp:95
uint64_t offset_end_
Where the new epoch ends.
Epoch old_epoch_
The value of new_epoch_ of the previous mark.
Epoch new_epoch_
The epoch of log entries this mark represents.
uint64_t offset_begin_
Where the new epoch starts.

Here is the call graph for this function:

foedus::log::ThreadEpockMark::ThreadEpockMark ( Epoch  old_epoch,
Epoch  new_epoch,
uint64_t  offset_begin 
)
inline

Definition at line 82 of file thread_log_buffer.hpp.

82  {
83  old_epoch_ = old_epoch;
84  new_epoch_ = new_epoch;
85  offset_begin_ = offset_begin;
86  offset_end_ = 0;
87  }
uint64_t offset_end_
Where the new epoch ends.
Epoch old_epoch_
The value of new_epoch_ of the previous mark.
Epoch new_epoch_
The epoch of log entries this mark represents.
uint64_t offset_begin_
Where the new epoch starts.

Friends And Related Function Documentation

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

Definition at line 363 of file thread_log_buffer.cpp.

363  {
364  o << "<ThreadEpockMark "
365  << " old=\"" << v.old_epoch_ << "\""
366  << " new=\"" << v.new_epoch_ << "\""
367  << " offset_begin=\"" << assorted::Hex(v.offset_begin_) << "\""
368  << " offset_end=\"" << assorted::Hex(v.offset_end_) << "\""
369  << " />";
370  return o;
371 }

Member Data Documentation

Epoch foedus::log::ThreadEpockMark::new_epoch_

The epoch of log entries this mark represents.

Because a thread might have no log in some epoch, this might be larger than old_epoch+1. It might be old_epoch+1000 etc. Populated as soon as this mark becomes the current and immutable since then.

Invariant
new_epoch_.is_valid()
old_epoch < new_epoch_

Definition at line 61 of file thread_log_buffer.hpp.

Referenced by foedus::log::ThreadLogBufferMeta::assert_consistent(), foedus::log::ThreadLogBuffer::get_last_epoch(), foedus::log::ThreadLogBuffer::get_logs_to_write(), foedus::log::ThreadLogBuffer::on_log_written(), and foedus::log::operator<<().

uint64_t foedus::log::ThreadEpockMark::offset_begin_

Where the new epoch starts.

Populated as soon as this mark becomes the current and immutable since then.

Definition at line 66 of file thread_log_buffer.hpp.

Referenced by foedus::log::ThreadLogBufferMeta::assert_consistent(), foedus::log::ThreadLogBuffer::get_logs_to_write(), foedus::log::ThreadLogBuffer::on_log_written(), and foedus::log::operator<<().

uint64_t foedus::log::ThreadEpockMark::offset_end_

Where the new epoch ends.

Populated 1) when the thread retires the epoch ("0" while this mark is current) OR 2) when the logger aggressively determines that the thread is idle and will not emit any more logs in this epoch. Thus, when the thread writes this value to move on to next entry, the old value must be 0 or the same value it were to write.

Definition at line 74 of file thread_log_buffer.hpp.

Referenced by foedus::log::ThreadLogBufferMeta::assert_consistent(), foedus::log::ThreadLogBuffer::get_logs_to_write(), foedus::log::ThreadLogBuffer::on_log_written(), and foedus::log::operator<<().

Epoch foedus::log::ThreadEpockMark::old_epoch_

The value of new_epoch_ of the previous mark.

This is not currently used except sanity checks. Populated as soon as this mark becomes the current and immutable since then.

Invariant
old_epoch_.is_valid()

Definition at line 52 of file thread_log_buffer.hpp.

Referenced by foedus::log::ThreadLogBufferMeta::assert_consistent(), and foedus::log::operator<<().


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