libfoedus-core
FOEDUS Core Library
foedus::storage::array::ArrayPage Class Referencefinal

Represents one data page in Array Storage. More...

Detailed Description

Represents one data page in Array Storage.

This is a private implementation-details of Array Storage, thus file name ends with _impl. Do not include this header from a client program unless you know what you are doing.

Attention
Do NOT instantiate this object or derive from this class. A page is always reinterpret-ed from a pooled memory region. No meaningful RTTI.

Definition at line 46 of file array_page_impl.hpp.

#include <array_page_impl.hpp>

Classes

union  Data
 Data union for either leaf (dynamic size) or interior (fixed size). More...
 

Public Member Functions

 ArrayPage ()=delete
 
 ArrayPage (const ArrayPage &other)=delete
 
ArrayPageoperator= (const ArrayPage &other)=delete
 
PageHeaderheader ()
 
const PageHeaderheader () const
 
StorageId get_storage_id () const
 
uint16_t get_leaf_record_count () const
 
uint16_t get_payload_size () const
 
bool is_leaf () const
 
uint8_t get_level () const
 
const ArrayRangeget_array_range () const
 
void initialize_snapshot_page (Epoch initial_epoch, StorageId storage_id, SnapshotPagePointer page_id, uint16_t payload_size, uint8_t level, const ArrayRange &array_range)
 Called only when this page is initialized. More...
 
void initialize_volatile_page (Epoch initial_epoch, StorageId storage_id, VolatilePagePointer page_id, uint16_t payload_size, uint8_t level, const ArrayRange &array_range)
 
const Recordget_leaf_record (uint16_t record, uint16_t payload_size) const __attribute__((always_inline))
 
Recordget_leaf_record (uint16_t record, uint16_t payload_size) __attribute__((always_inline))
 
const DualPagePointerget_interior_record (uint16_t record) const __attribute__((always_inline))
 
DualPagePointerget_interior_record (uint16_t record) __attribute__((always_inline))
 
uint8_t unused_dummy_func_reserved1 () const
 
uint32_t unused_dummy_func_reserved2 () const
 

Constructor & Destructor Documentation

foedus::storage::array::ArrayPage::ArrayPage ( )
delete
foedus::storage::array::ArrayPage::ArrayPage ( const ArrayPage other)
delete

Member Function Documentation

DualPagePointer& foedus::storage::array::ArrayPage::get_interior_record ( uint16_t  record)
inline

Definition at line 108 of file array_page_impl.hpp.

References ASSERT_ND, foedus::storage::array::ArrayPage::Data::interior_data, is_leaf(), and foedus::storage::array::kInteriorFanout.

108  {
109  ASSERT_ND(!is_leaf());
110  ASSERT_ND(record < kInteriorFanout);
111  return data_.interior_data[record];
112  }
DualPagePointer interior_data[kInteriorFanout]
const uint16_t kInteriorFanout
Max number of entries in an interior page of array storage.
Definition: array_id.hpp:110
#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:

const Record* foedus::storage::array::ArrayPage::get_leaf_record ( uint16_t  record,
uint16_t  payload_size 
) const
inline

Definition at line 91 of file array_page_impl.hpp.

References foedus::assorted::align8(), ASSERT_ND, is_leaf(), foedus::storage::array::kDataSize, foedus::storage::kRecordOverhead, and foedus::storage::array::ArrayPage::Data::leaf_data.

Referenced by foedus::storage::array::ArrayComposer::drop_root_volatile(), foedus::storage::array::ArrayStoragePimpl::follow_pointers_for_read_batch(), foedus::storage::array::ArrayStoragePimpl::follow_pointers_for_write_batch(), initialize_snapshot_page(), initialize_volatile_page(), foedus::storage::array::ArrayStoragePimpl::locate_record_for_read(), foedus::storage::array::ArrayStoragePimpl::locate_record_for_read_batch(), foedus::storage::array::ArrayStoragePimpl::locate_record_for_write(), foedus::storage::array::ArrayStoragePimpl::lookup_for_read(), foedus::storage::array::ArrayStoragePimpl::lookup_for_read_batch(), foedus::storage::array::ArrayStoragePimpl::lookup_for_write(), foedus::storage::array::ArrayStoragePimpl::lookup_for_write_batch(), and foedus::storage::array::ArrayStoragePimpl::verify_single_thread().

91  {
92  ASSERT_ND(payload_size_ == payload_size);
93  ASSERT_ND(is_leaf());
94  ASSERT_ND((record + 1) * (kRecordOverhead + assorted::align8(payload_size_)) <= kDataSize);
95  return reinterpret_cast<const Record*>(
96  data_.leaf_data + record * (kRecordOverhead + assorted::align8(payload_size_)));
97  }
T align8(T value)
8-alignment.
const uint16_t kRecordOverhead
Byte size of system-managed region per each record.
Definition: record.hpp:56
const uint16_t kDataSize
Byte size of data region in each page of array storage.
Definition: array_id.hpp:100
char leaf_data[kInteriorFanout *sizeof(DualPagePointer)]
#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:

Record* foedus::storage::array::ArrayPage::get_leaf_record ( uint16_t  record,
uint16_t  payload_size 
)
inline

Definition at line 98 of file array_page_impl.hpp.

References foedus::assorted::align8(), ASSERT_ND, is_leaf(), foedus::storage::array::kDataSize, foedus::storage::kRecordOverhead, and foedus::storage::array::ArrayPage::Data::leaf_data.

98  {
99  ASSERT_ND(payload_size_ == payload_size);
100  ASSERT_ND(is_leaf());
101  ASSERT_ND((record + 1) * (kRecordOverhead + assorted::align8(payload_size_)) <= kDataSize);
102  return reinterpret_cast<Record*>(
103  data_.leaf_data + record * (kRecordOverhead + assorted::align8(payload_size_)));
104  }
T align8(T value)
8-alignment.
const uint16_t kRecordOverhead
Byte size of system-managed region per each record.
Definition: record.hpp:56
const uint16_t kDataSize
Byte size of data region in each page of array storage.
Definition: array_id.hpp:100
char leaf_data[kInteriorFanout *sizeof(DualPagePointer)]
#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:

uint16_t foedus::storage::array::ArrayPage::get_leaf_record_count ( ) const
inline

Definition at line 66 of file array_page_impl.hpp.

References foedus::assorted::align8(), foedus::storage::array::kDataSize, and foedus::storage::kRecordOverhead.

Referenced by initialize_snapshot_page(), initialize_volatile_page(), and foedus::storage::array::ArrayStoragePimpl::verify_single_thread().

66  {
67  return kDataSize / (kRecordOverhead + assorted::align8(payload_size_));
68  }
T align8(T value)
8-alignment.
const uint16_t kRecordOverhead
Byte size of system-managed region per each record.
Definition: record.hpp:56
const uint16_t kDataSize
Byte size of data region in each page of array storage.
Definition: array_id.hpp:100

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t foedus::storage::array::ArrayPage::get_payload_size ( ) const
inline

Definition at line 69 of file array_page_impl.hpp.

69 { return payload_size_; }
StorageId foedus::storage::array::ArrayPage::get_storage_id ( ) const
inline

Definition at line 65 of file array_page_impl.hpp.

References foedus::storage::PageHeader::storage_id_.

Referenced by foedus::storage::array::array_volatile_page_init().

65 { return header_.storage_id_; }
StorageId storage_id_
ID of the storage this page belongs to.
Definition: page.hpp:196

Here is the caller graph for this function:

const PageHeader& foedus::storage::array::ArrayPage::header ( ) const
inline

Definition at line 64 of file array_page_impl.hpp.

64 { return header_; }
void foedus::storage::array::ArrayPage::initialize_snapshot_page ( Epoch  initial_epoch,
StorageId  storage_id,
SnapshotPagePointer  page_id,
uint16_t  payload_size,
uint8_t  level,
const ArrayRange array_range 
)

Called only when this page is initialized.

Definition at line 32 of file array_page_impl.cpp.

References ASSERT_ND, get_leaf_record(), get_leaf_record_count(), foedus::storage::PageHeader::init_snapshot(), is_leaf(), foedus::Epoch::is_valid(), foedus::storage::kArrayPageType, and foedus::storage::kPageSize.

Referenced by foedus::storage::array::ArrayComposer::construct_root().

38  {
39  ASSERT_ND(initial_epoch.is_valid());
40  std::memset(this, 0, kPageSize);
41  header_.init_snapshot(page_id, storage_id, kArrayPageType);
42  payload_size_ = payload_size;
43  level_ = level;
44  array_range_ = array_range;
45  if (is_leaf()) {
46  uint16_t records = get_leaf_record_count();
47  for (uint16_t i = 0; i < records; ++i) {
48  auto* rec = get_leaf_record(i, payload_size);
49  rec->owner_id_.lock_.reset();
50  rec->owner_id_.xct_id_.set_epoch(initial_epoch);
51  }
52  }
53 }
const Record * get_leaf_record(uint16_t record, uint16_t payload_size) const __attribute__((always_inline))
void init_snapshot(SnapshotPagePointer page_id, StorageId storage_id, PageType page_type) __attribute__((always_inline))
Definition: page.hpp:301
#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
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
Definition: storage_id.hpp:45

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::storage::array::ArrayPage::initialize_volatile_page ( Epoch  initial_epoch,
StorageId  storage_id,
VolatilePagePointer  page_id,
uint16_t  payload_size,
uint8_t  level,
const ArrayRange array_range 
)

Definition at line 55 of file array_page_impl.cpp.

References ASSERT_ND, get_leaf_record(), get_leaf_record_count(), foedus::storage::PageHeader::init_volatile(), is_leaf(), foedus::Epoch::is_valid(), foedus::storage::kArrayPageType, and foedus::storage::kPageSize.

Referenced by foedus::storage::array::array_volatile_page_init(), and foedus::storage::array::ArrayStoragePimpl::load_empty().

61  {
62  ASSERT_ND(initial_epoch.is_valid());
63  std::memset(this, 0, kPageSize);
64  header_.init_volatile(page_id, storage_id, kArrayPageType);
65  payload_size_ = payload_size;
66  level_ = level;
67  array_range_ = array_range;
68  if (is_leaf()) {
69  uint16_t records = get_leaf_record_count();
70  for (uint16_t i = 0; i < records; ++i) {
71  auto* rec = get_leaf_record(i, payload_size);
72  rec->owner_id_.lock_.reset();
73  rec->owner_id_.xct_id_.set_epoch(initial_epoch);
74  }
75  }
76 }
void init_volatile(VolatilePagePointer page_id, StorageId storage_id, PageType page_type) __attribute__((always_inline))
Definition: page.hpp:284
const Record * get_leaf_record(uint16_t record, uint16_t payload_size) const __attribute__((always_inline))
#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
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
Definition: storage_id.hpp:45

Here is the call graph for this function:

Here is the caller graph for this function:

ArrayPage& foedus::storage::array::ArrayPage::operator= ( const ArrayPage other)
delete
uint8_t foedus::storage::array::ArrayPage::unused_dummy_func_reserved1 ( ) const
inline

Definition at line 114 of file array_page_impl.hpp.

114 { return reserved1_; }
uint32_t foedus::storage::array::ArrayPage::unused_dummy_func_reserved2 ( ) const
inline

Definition at line 115 of file array_page_impl.hpp.

115 { return reserved2_; }

The documentation for this class was generated from the following files: