libfoedus-core
FOEDUS Core Library
foedus::memory::LocalPageResolver Struct Referencefinal

Resolves an offset in local (same NUMA node) page pool to a pointer and vice versa. More...

Detailed Description

Resolves an offset in local (same NUMA node) page pool to a pointer and vice versa.

This class abstracts how we convert 4-byte page-pool offset to/from 8-byte pointer for cases where we are handling a page that resides in a local page pool. Especially, snapshot pages and snapshotting can always use this page resolver.

This object is copiable and the copying is very efficient. The size of this object is only 16 bytes.

Definition at line 42 of file page_resolver.hpp.

#include <page_resolver.hpp>

Collaboration diagram for foedus::memory::LocalPageResolver:

Public Member Functions

 LocalPageResolver ()
 
 LocalPageResolver (storage::Page *base, PagePoolOffset begin, PagePoolOffset end)
 
PagePoolOffset resolve_page (storage::Page *page) const __attribute__((always_inline))
 Resolves storage::Page* to offset in this pool. More...
 
storage::Pageresolve_offset (PagePoolOffset offset) const __attribute__((always_inline))
 Resolves offset in this pool to storage::Page*. More...
 
storage::Pageresolve_offset_newpage (PagePoolOffset offset) const __attribute__((always_inline))
 As the name suggests, this version is for new pages, which don't have sanity checks. More...
 

Public Attributes

PagePoolOffset begin_
 where a valid page entry starts. More...
 
PagePoolOffset end_
 where a valid page entry ends. More...
 
storage::Pagebase_
 base address to calculate from/to offset. More...
 

Constructor & Destructor Documentation

foedus::memory::LocalPageResolver::LocalPageResolver ( )
inline

Definition at line 43 of file page_resolver.hpp.

43 : begin_(0), end_(0), base_(CXX11_NULLPTR) {}
#define CXX11_NULLPTR
Used in public headers in place of "nullptr" of C++11.
Definition: cxx11.hpp:132
PagePoolOffset end_
where a valid page entry ends.
PagePoolOffset begin_
where a valid page entry starts.
storage::Page * base_
base address to calculate from/to offset.
foedus::memory::LocalPageResolver::LocalPageResolver ( storage::Page base,
PagePoolOffset  begin,
PagePoolOffset  end 
)
inline

Definition at line 44 of file page_resolver.hpp.

45  : begin_(begin), end_(end), base_(base) {}
PagePoolOffset end_
where a valid page entry ends.
PagePoolOffset begin_
where a valid page entry starts.
storage::Page * base_
base address to calculate from/to offset.

Member Function Documentation

storage::Page* foedus::memory::LocalPageResolver::resolve_offset ( PagePoolOffset  offset) const
inline

Resolves offset in this pool to storage::Page*.

Definition at line 57 of file page_resolver.hpp.

References foedus::storage::assert_valid_volatile_page(), and resolve_offset_newpage().

Referenced by foedus::storage::sequential::SequentialStoragePimpl::append_record(), foedus::storage::sequential::SequentialStoragePimpl::drop(), foedus::storage::sequential::SequentialComposer::drop_volatiles(), foedus::storage::sequential::SequentialStoragePimpl::for_every_page(), foedus::storage::sequential::SequentialStoragePimpl::get_head(), foedus::storage::sequential::SequentialStoragePimpl::get_tail(), and foedus::thread::Thread::resolve().

57  {
58  storage::Page* page = resolve_offset_newpage(offset);
59  // this is NOT a new page, so we have sanity checks
61  return page;
62  }
storage::Page * resolve_offset_newpage(PagePoolOffset offset) const __attribute__((always_inline))
As the name suggests, this version is for new pages, which don't have sanity checks.
void assert_valid_volatile_page(const Page *page, uint32_t offset)
Definition: page.hpp:407

Here is the call graph for this function:

Here is the caller graph for this function:

storage::Page* foedus::memory::LocalPageResolver::resolve_offset_newpage ( PagePoolOffset  offset) const
inline

As the name suggests, this version is for new pages, which don't have sanity checks.

Definition at line 64 of file page_resolver.hpp.

References ASSERT_ND, base_, begin_, and end_.

Referenced by foedus::storage::sequential::SequentialStoragePimpl::append_record(), foedus::storage::hash::HashStoragePimpl::create(), foedus::storage::hash::HashStoragePimpl::follow_page_bin_head(), foedus::thread::ThreadPimpl::follow_page_pointer(), foedus::thread::ThreadPimpl::follow_page_pointers_for_read_batch(), foedus::thread::ThreadPimpl::follow_page_pointers_for_write_batch(), foedus::memory::EngineMemory::grab_one_volatile_page(), foedus::storage::sequential::SequentialStoragePimpl::initialize_head_tail_pages(), foedus::thread::ThreadPimpl::install_a_volatile_page(), foedus::storage::masstree::MasstreeStoragePimpl::load_empty(), foedus::thread::ThreadPimpl::place_a_new_volatile_page(), foedus::thread::Thread::resolve_newpage(), resolve_offset(), and foedus::storage::masstree::ReserveRecords::run().

64  {
65  ASSERT_ND(offset >= begin_);
66  ASSERT_ND(offset < end_);
67  return base_ + offset;
68  }
PagePoolOffset end_
where a valid page entry ends.
PagePoolOffset begin_
where a valid page entry starts.
#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
storage::Page * base_
base address to calculate from/to offset.

Here is the caller graph for this function:

PagePoolOffset foedus::memory::LocalPageResolver::resolve_page ( storage::Page page) const
inline

Resolves storage::Page* to offset in this pool.

Definition at line 50 of file page_resolver.hpp.

References ASSERT_ND, base_, begin_, and end_.

50  {
51  PagePoolOffset offset = page - base_;
52  ASSERT_ND(offset >= begin_);
53  ASSERT_ND(offset < end_);
54  return offset;
55  }
uint32_t PagePoolOffset
Offset in PagePool that compactly represents the page address (unlike 8 bytes pointer).
Definition: memory_id.hpp:44
PagePoolOffset end_
where a valid page entry ends.
PagePoolOffset begin_
where a valid page entry starts.
#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
storage::Page * base_
base address to calculate from/to offset.

Member Data Documentation

storage::Page* foedus::memory::LocalPageResolver::base_

base address to calculate from/to offset.

Definition at line 75 of file page_resolver.hpp.

Referenced by resolve_offset_newpage(), and resolve_page().

PagePoolOffset foedus::memory::LocalPageResolver::begin_

where a valid page entry starts.

only for sanity checking.

Definition at line 71 of file page_resolver.hpp.

Referenced by foedus::memory::EngineMemory::initialize_once(), resolve_offset_newpage(), and resolve_page().

PagePoolOffset foedus::memory::LocalPageResolver::end_

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