libfoedus-core
FOEDUS Core Library
foedus::snapshot::MergeSort::AdjustComparatorMasstree Struct Referencefinal

Used in batch_sort_adjust_sort if the storage is a masstree storage. More...

Detailed Description

Used in batch_sort_adjust_sort if the storage is a masstree storage.

This comparator is actually a valid comparator for any case. But, it's slower, so used only where we need to.

Definition at line 258 of file merge_sort.hpp.

#include <merge_sort.hpp>

Collaboration diagram for foedus::snapshot::MergeSort::AdjustComparatorMasstree:

Public Member Functions

 AdjustComparatorMasstree (PositionEntry *position_entries, InputStatus *inputs_status)
 
bool operator() (const SortEntry &left, const SortEntry &right) const __attribute__((always_inline))
 

Public Attributes

PositionEntryposition_entries_
 
InputStatusinputs_status_
 

Constructor & Destructor Documentation

foedus::snapshot::MergeSort::AdjustComparatorMasstree::AdjustComparatorMasstree ( PositionEntry position_entries,
InputStatus inputs_status 
)
inline

Definition at line 259 of file merge_sort.hpp.

Member Function Documentation

bool foedus::snapshot::MergeSort::AdjustComparatorMasstree::operator() ( const SortEntry left,
const SortEntry right 
) const
inline

Definition at line 261 of file merge_sort.hpp.

References ASSERT_ND, foedus::storage::masstree::MasstreeCommonLogType::compare_logs(), foedus::snapshot::MergeSort::InputStatus::from_compact_pos(), foedus::snapshot::MergeSort::PositionEntry::input_index_, foedus::snapshot::MergeSort::PositionEntry::input_position_, inputs_status_, and position_entries_.

261  {
262  ASSERT_ND(left.get_key() <= right.get_key());
263  if (left.get_key() < right.get_key()) {
264  return true;
265  }
266  MergedPosition left_index = left.get_position();
267  MergedPosition right_index = right.get_position();
268  const PositionEntry& left_pos = position_entries_[left_index];
269  const PositionEntry& right_pos = position_entries_[right_index];
270  const storage::masstree::MasstreeCommonLogType* left_casted
271  = reinterpret_cast<const storage::masstree::MasstreeCommonLogType*>(
272  inputs_status_[left_pos.input_index_].from_compact_pos(left_pos.input_position_));
273  const storage::masstree::MasstreeCommonLogType* right_casted
274  = reinterpret_cast<const storage::masstree::MasstreeCommonLogType*>(
275  inputs_status_[right_pos.input_index_].from_compact_pos(right_pos.input_position_));
276  int cmp = storage::masstree::MasstreeCommonLogType::compare_logs(left_casted, right_casted);
277  return cmp < 0 || (cmp == 0 && left_index < right_index);
278  }
static int compare_logs(const MasstreeCommonLogType *left, const MasstreeCommonLogType *right) __attribute__((always_inline))
Returns -1, 0, 1 when left is less than, same, larger than right in terms of key and xct_id...
const log::RecordLogType * from_compact_pos(BufferPosition pos) const __attribute__((always_inline))
Definition: merge_sort.hpp:214
uint32_t MergedPosition
Position in MergeSort's buffer.
Definition: merge_sort.hpp:83
#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:

Member Data Documentation

InputStatus* foedus::snapshot::MergeSort::AdjustComparatorMasstree::inputs_status_

Definition at line 280 of file merge_sort.hpp.

Referenced by operator()().

PositionEntry* foedus::snapshot::MergeSort::AdjustComparatorMasstree::position_entries_

Definition at line 279 of file merge_sort.hpp.

Referenced by operator()().


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