libfoedus-core
FOEDUS Core Library
foedus::storage::masstree::RecordLocation Struct Reference

return value of MasstreeStoragePimpl::locate_record()/reserve_record(). More...

Detailed Description

return value of MasstreeStoragePimpl::locate_record()/reserve_record().

See foedus::storage::hash::RecordLocation regarding observed_. Masstree's locate_record() is also now a logical operation.

See also
foedus::storage::hash::RecordLocation

Definition at line 39 of file masstree_record_location.hpp.

#include <masstree_record_location.hpp>

Collaboration diagram for foedus::storage::masstree::RecordLocation:

Public Member Functions

bool is_found () const
 
void clear ()
 
ErrorCode populate_logical (xct::Xct *cur_xct, MasstreeBorderPage *page, SlotIndex index, bool intended_for_write)
 Populates the result with XID and possibly readset. More...
 

Public Attributes

MasstreeBorderPagepage_
 The border page containing the record. More...
 
SlotIndex index_
 Index of the record in the page. More...
 
xct::XctId observed_
 TID as of locate_record() identifying the record. More...
 
xct::ReadXctAccessreadset_
 If this method took a read-set on the returned record, points to the corresponding read-set. More...
 

Member Function Documentation

void foedus::storage::masstree::RecordLocation::clear ( )
inline

Definition at line 57 of file masstree_record_location.hpp.

References CXX11_NULLPTR, foedus::xct::XctId::data_, and foedus::storage::masstree::kBorderPageMaxSlots.

Referenced by foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized(), foedus::storage::masstree::MasstreeCursor::MasstreeCursor(), foedus::storage::masstree::MasstreeStoragePimpl::reserve_record(), and foedus::storage::masstree::MasstreeStoragePimpl::reserve_record_normalized().

57  {
60  observed_.data_ = 0;
62  }
#define CXX11_NULLPTR
Used in public headers in place of "nullptr" of C++11.
Definition: cxx11.hpp:132
xct::ReadXctAccess * readset_
If this method took a read-set on the returned record, points to the corresponding read-set...
const SlotIndex kBorderPageMaxSlots
Maximum number of slots in one MasstreeBorderPage.
SlotIndex index_
Index of the record in the page.
MasstreeBorderPage * page_
The border page containing the record.
xct::XctId observed_
TID as of locate_record() identifying the record.

Here is the caller graph for this function:

bool foedus::storage::masstree::RecordLocation::is_found ( ) const
inline
ErrorCode foedus::storage::masstree::RecordLocation::populate_logical ( xct::Xct cur_xct,
MasstreeBorderPage page,
SlotIndex  index,
bool  intended_for_write 
)

Populates the result with XID and possibly readset.

This is a logical operation that might take a readset.

Definition at line 27 of file masstree_record_location.cpp.

References ASSERT_ND, CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeBorderPage::get_owner_id(), index_, foedus::xct::XctId::is_being_written(), foedus::xct::XctId::is_moved(), foedus::xct::XctId::is_next_layer(), foedus::xct::XctId::is_valid(), foedus::kErrorCodeOk, observed_, foedus::xct::Xct::on_record_read(), page_, and readset_.

Referenced by foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized(), foedus::storage::masstree::MasstreeStoragePimpl::reserve_record(), and foedus::storage::masstree::MasstreeStoragePimpl::reserve_record_normalized().

31  {
32  page_ = page;
33  index_ = index;
34  readset_ = nullptr;
35 
36  // [Logical check]: Read XID in a finalized fashion. If we found it "moved",
37  // then we don't need to remember it as read-set.
38  CHECK_ERROR_CODE(cur_xct->on_record_read(
39  intended_for_write,
40  page->get_owner_id(index),
41  &observed_,
42  &readset_,
43  true, // no_readset_if_moved. see below
44  true)); // no_readset_if_next_layer. see below
47 
49  // Once it becomes a next-layer or moved pointer, it never goes back to a normal record.
50  // so, there is no point to keep the read-set acquired in on_record_read().
51  // We thus give parameters above that tell on_record_read() to not take read-set in the case.
52  ASSERT_ND(readset_ == nullptr); // let's confirm it
53  }
54  return kErrorCodeOk;
55 }
bool is_valid() const __attribute__((always_inline))
Definition: xct_id.hpp:973
0 means no-error.
Definition: error_code.hpp:87
xct::ReadXctAccess * readset_
If this method took a read-set on the returned record, points to the corresponding read-set...
bool is_next_layer() const __attribute__((always_inline))
Definition: xct_id.hpp:1042
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
Definition: error_code.hpp:155
SlotIndex index_
Index of the record in the page.
bool is_being_written() const __attribute__((always_inline))
Definition: xct_id.hpp:1038
MasstreeBorderPage * page_
The border page containing the record.
bool is_moved() const __attribute__((always_inline))
Definition: xct_id.hpp:1041
#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
xct::XctId observed_
TID as of locate_record() identifying the record.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

xct::ReadXctAccess* foedus::storage::masstree::RecordLocation::readset_

If this method took a read-set on the returned record, points to the corresponding read-set.

Otherwise nullptr.

Definition at line 54 of file masstree_record_location.hpp.

Referenced by populate_logical(), and foedus::storage::masstree::MasstreeStoragePimpl::register_record_write_log().


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