libfoedus-core
FOEDUS Core Library
|
Represents a time epoch. More...
Represents a time epoch.
Epoch is an corase-grained timestamp used all over the places.
#include <epoch.hpp>
Public Types | |
enum | Constants { kEpochInvalid = 0, kEpochInitialDurable = 1, kEpochInitialGrace = 2, kEpochInitialCurrent = 3, kEpochBits = 28, kEpochIntOverflow = (1 << kEpochBits), kEpochIntHalf = (1 << (kEpochBits - 1)) } |
Defines constant values. More... | |
typedef uint32_t | EpochInteger |
Unsigned integer representation of epoch. More... | |
Public Member Functions | |
Epoch () noexcept | |
Construct an invalid epoch. More... | |
Epoch (EpochInteger value) noexcept | |
Construct an epoch of specified integer representation. More... | |
void | reset () |
Clears this epoch variable so that it points to an invalid epoch. More... | |
bool | is_valid () const |
EpochInteger | value () const |
Returns the raw integer representation. More... | |
Epoch & | operator++ () |
Epoch & | operator-- () |
Epoch | one_less () const |
Epoch | one_more () const |
uint32_t | subtract (const Epoch &other) const |
Returns the number epochs from the given epoch to this epoch accounting for wrap-around. More... | |
void | store_min (const Epoch &other) |
Kind of std::min(this, other). More... | |
void | store_max (const Epoch &other) |
Kind of std::max(this, other). More... | |
bool | before (const Epoch &other) const |
Returns if this epoch is before the given epoch in the sense of distance defined in RFC 1982. More... | |
bool | operator== (const Epoch &other) const |
bool | operator!= (const Epoch &other) const |
bool | operator< (const Epoch &other) const |
bool | operator> (const Epoch &other) const |
bool | operator<= (const Epoch &other) const |
bool | operator>= (const Epoch &other) const |
Friends | |
std::ostream & | operator<< (std::ostream &o, const Epoch &v) |
typedef uint32_t foedus::Epoch::EpochInteger |
Defines constant values.
Enumerator | |
---|---|
kEpochInvalid |
Zero is always reserved for invalid epoch. A valid epoch always skips this value. |
kEpochInitialDurable |
As there is no transaction in ep-1, initial durable_epoch is 1. |
kEpochInitialGrace |
Usually, current epoch -1 is the grace period before being durable. Initial epochs don't need grace period, but let's reserve one for consistency. |
kEpochInitialCurrent |
The first epoch (before wrap-around) that might have transactions is ep-3. |
kEpochBits |
Bits to represent an epoch. |
kEpochIntOverflow |
Epoch values wrap around at this value. |
kEpochIntHalf |
Used for before(). |
Definition at line 66 of file epoch.hpp.
|
inlinenoexcept |
|
inlineexplicitnoexcept |
Construct an epoch of specified integer representation.
Definition at line 89 of file epoch.hpp.
References ASSERT_ND, kEpochIntOverflow, and value().
|
inline |
Returns if this epoch is before the given epoch in the sense of distance defined in RFC 1982.
Both this and other must be valid epochs.
Definition at line 176 of file epoch.hpp.
References ASSERT_ND, is_valid(), and kEpochIntHalf.
Referenced by foedus::xct::XctId::before(), foedus::xct::Xct::issue_next_id(), operator<(), and operator>().
|
inline |
Definition at line 96 of file epoch.hpp.
References ASSERT_ND, kEpochIntOverflow, and kEpochInvalid.
Referenced by foedus::log::ThreadLogBufferMeta::assert_consistent(), before(), foedus::xct::XctId::compare_epoch_and_orginal(), foedus::storage::StorageManagerPimpl::create_storage(), foedus::storage::array::ArrayComposer::drop_root_volatile(), foedus::storage::StorageManagerPimpl::drop_storage(), foedus::snapshot::SnapshotManagerPimpl::drop_volatile_pages(), foedus::log::LoggerRef::get_log_range(), foedus::thread::ThreadGroupRef::get_min_in_commit_epoch(), foedus::xct::XctManagerPimpl::handle_epoch_chime_wait_grace_period(), foedus::snapshot::SnapshotManagerPimpl::handle_snapshot(), foedus::snapshot::SnapshotManagerPimpl::handle_snapshot_triggered(), foedus::storage::array::ArrayPage::initialize_snapshot_page(), foedus::storage::array::ArrayPage::initialize_volatile_page(), foedus::storage::sequential::SequentialStoragePimpl::load(), foedus::storage::sequential::max_from_epoch_snapshot_epoch(), foedus::storage::sequential::SequentialRecordIterator::next(), operator++(), operator--(), foedus::operator<<(), foedus::xct::XctManagerPimpl::precommit_xct_apply(), foedus::restart::RestartManagerPimpl::redo_meta_logs(), foedus::log::LogManagerPimpl::refresh_global_durable_epoch(), foedus::storage::sequential::SequentialCursor::SequentialCursor(), foedus::storage::sequential::SequentialRecordIterator::SequentialRecordIterator(), store_max(), store_min(), subtract(), foedus::snapshot::SnapshotManagerPimpl::trigger_snapshot_immediate(), foedus::storage::sequential::SequentialStoragePimpl::truncate(), foedus::snapshot::LogReducerRef::verify_log_chunk(), foedus::storage::masstree::MasstreeStoragePimpl::verify_single_thread_border(), and foedus::storage::hash::HashStoragePimpl::verify_single_thread_data().
|
inline |
Definition at line 122 of file epoch.hpp.
Referenced by foedus::xct::XctManager::get_current_grace_epoch(), foedus::xct::XctManager::get_current_grace_epoch_weak(), and foedus::xct::XctManagerPimpl::handle_epoch_chime().
|
inline |
Definition at line 127 of file epoch.hpp.
Referenced by foedus::xct::XctManagerPimpl::advance_current_global_epoch(), foedus::thread::ThreadPimpl::collect_retired_volatile_page(), foedus::storage::sequential::SequentialComposer::compose(), foedus::snapshot::SnapshotManagerPimpl::drop_volatile_pages_parallel(), foedus::cache::CacheManagerPimpl::handle_cleaner(), foedus::xct::XctManagerPimpl::handle_epoch_chime(), foedus::xct::XctManagerPimpl::handle_epoch_chime_wait_grace_period(), and foedus::xct::XctManagerPimpl::wait_for_commit().
|
inline |
|
inline |
Definition at line 104 of file epoch.hpp.
References ASSERT_ND, is_valid(), and kEpochIntOverflow.
|
inline |
Definition at line 113 of file epoch.hpp.
References ASSERT_ND, is_valid(), and kEpochIntOverflow.
|
inline |
Definition at line 185 of file epoch.hpp.
References before().
Referenced by operator>=().
|
inline |
Definition at line 187 of file epoch.hpp.
References operator>().
|
inline |
|
inline |
Definition at line 186 of file epoch.hpp.
References before().
Referenced by operator<=().
|
inline |
Definition at line 188 of file epoch.hpp.
References operator<().
|
inline |
Clears this epoch variable so that it points to an invalid epoch.
Definition at line 95 of file epoch.hpp.
References kEpochInvalid.
Referenced by foedus::log::ThreadEpockMark::ThreadEpockMark().
|
inline |
Kind of std::max(this, other).
If this.is_valid(), this is exactly std::max. If not, other is unconditionally taken.
Definition at line 165 of file epoch.hpp.
References ASSERT_ND, and is_valid().
Referenced by foedus::storage::Composer::DropResult::combine(), foedus::storage::sequential::SequentialComposer::compose(), and foedus::xct::XctManagerPimpl::precommit_xct_verify_readonly().
|
inline |
Kind of std::min(this, other).
If this.is_valid(), this is exactly std::min. If not, other is unconditionally taken.
Definition at line 153 of file epoch.hpp.
References ASSERT_ND, and is_valid().
Referenced by foedus::storage::sequential::SequentialComposer::compose(), foedus::thread::ThreadGroupRef::get_min_in_commit_epoch(), and foedus::log::LogManagerPimpl::refresh_global_durable_epoch().
|
inline |
Returns the number epochs from the given epoch to this epoch accounting for wrap-around.
Definition at line 137 of file epoch.hpp.
References ASSERT_ND, is_valid(), and kEpochIntOverflow.
Referenced by foedus::snapshot::MergeSort::assert_sorted(), foedus::storage::array::prepare_sort_entries(), foedus::storage::hash::prepare_sort_entries(), and foedus::storage::masstree::prepare_sort_entries().
|
inline |
Returns the raw integer representation.
Definition at line 102 of file epoch.hpp.
Referenced by foedus::log::LogManagerPimpl::announce_new_durable_global_epoch(), foedus::storage::sequential::SequentialStoragePimpl::apply_truncate(), foedus::storage::sequential::SequentialStoragePimpl::create(), Epoch(), foedus::memory::PagePoolOffsetAndEpochChunk::get_safe_offset_count(), foedus::xct::XctManagerPimpl::handle_epoch_chime(), foedus::snapshot::SnapshotManagerPimpl::handle_snapshot_triggered(), foedus::log::LogManagerPimpl::initialize_once(), foedus::xct::XctManagerPimpl::initialize_once(), foedus::log::Logger::initialize_once(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), foedus::storage::sequential::SequentialStoragePimpl::load(), foedus::operator<<(), foedus::memory::PagePoolOffsetAndEpochChunk::push_back(), foedus::restart::RestartManagerPimpl::recover(), foedus::log::LogManagerPimpl::refresh_global_durable_epoch(), foedus::savepoint::SavepointManagerPimpl::savepoint_main(), foedus::xct::XctManagerPimpl::set_requested_global_epoch(), foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata(), foedus::savepoint::SavepointManagerPimpl::take_savepoint(), foedus::savepoint::SavepointManagerPimpl::take_savepoint_after_snapshot(), and foedus::storage::sequential::SequentialStoragePimpl::truncate().
|
friend |