Fennel: SegPageEntryIter< EntryT > Class Template Reference (original) (raw)
SegPageEntryIter extends SegPageIter. More...
#include <[SegPageEntryIter.h](SegPageEntryIter%5F8h-source.html)>
Inheritance diagram for SegPageEntryIter< EntryT >:

| Public Member Functions | |
|---|---|
| SegPageEntryIter () | |
| Constructor: iterator starts out singular. | |
| SegPageEntryIter (uint nEntriesInit) | |
| Constructor: iterator starts out singular. | |
| void | resize (uint nEntries) |
| Resizes the object to allow for storage of N pre-fetch entries. | |
| void | setPrefetchSource (SegPageEntryIterSource< EntryT > &prefetchSource) |
| Sets the pre-fetch source for this iterator. | |
| void | mapRange (SegmentAccessor const &segmentAccessor, PageId beginPageId, PageId endPageId=NULL_PAGE_ID) |
| Begins a new iteration. | |
| std::pair< PageId, EntryT > & | operator * () |
| **Returns:**the current (PageId, EntryT) in the iteration | |
| void | operator++ () |
| Moves to the next prefetched PageId. | |
| void | makeSingular () |
| Aborts any iteration in progress and release all resources. | |
| bool | isSingular () const |
| **Returns:**true iff no iteration is in progress | |
| PageId | operator * () const |
| **Returns:**the current PageId in the iteration | |
| void | forcePrefetchReject () |
| Forces the next pre-fetch request to be rejected. | |
| Protected Member Functions | |
| void | initPrefetchQueue () |
| Reads the pre-fetch parameters, sizes the pre-fetch queue, and initializes various state variables related to the queue. | |
| void | prefetchPage (PageId pageId) |
| Pre-fetches a specified page. | |
| Protected Attributes | |
| SegmentAccessor | segmentAccessor |
| Accessor for the Segment containing the pages to be visited. | |
| PageId | endPageId |
| PageId at which to stop iteration. | |
| std::vector< PageId > | prefetchQueue |
| Fixed-size circular queue of prefetched PageIds, indexed by iFetch. | |
| uint | iFetch |
| Position in prefetchQueue. | |
| bool | atEnd |
| Whether end of iteration has been reached by prefetch (but not necessarily by fetch). | |
| uint | queueSize |
| Current size of the pre-fetch queue. | |
| int | nFreePageSlots |
| Number of slots available in the prefetchQueue. | |
| Private Member Functions | |
| void | init () |
| Initializes object. | |
| void | prefetchPages (PageId prevPageId, bool oneIter) |
| Determines a set of pages that should be pre-fetched and pre-fetches them. | |
| Private Attributes | |
| CircularBuffer< std::pair< PageId, EntryT > > | entryQueue |
| Circular vector with the context-specific information associated with each pre-fetched page. | |
| SegPageEntryIterSource< EntryT > * | pPrefetchSource |
| Pointer to the source that provides the callback method that determines which pages to pre-fetch. |
Detailed Description
template
class SegPageEntryIter< EntryT >
SegPageEntryIter extends SegPageIter.
Rather than pre-fetching successor pages, it takes a source parameter that provides a callback method that's used to determine which pages should be pre-fetched. The class is a template class, which allows context-specific information to be associated with each pre-fetched page.
Definition at line 42 of file SegPageEntryIter.h.
Constructor & Destructor Documentation
Member Function Documentation
template
| void SegPageEntryIter< EntryT >::prefetchPages | ( | PageId | prevPageId, |
|---|---|---|---|
| bool | oneIter | ||
| ) | [private] |
Determines a set of pages that should be pre-fetched and pre-fetches them.
Parameters:
| prevPageId | the id of the last page pre-fetched; only needed in the case where the entry queue is currently empty |
|---|---|
| oneIter | if true, pre-fetch no more than one page |
Definition at line 87 of file SegPageEntryIterImpl.h.
References SegPageIter::atEnd, CircularBuffer< T >::empty(), SegPageIter::endPageId, SegPageEntryIter< EntryT >::entryQueue, CircularBuffer< T >::getLastPos(), SegPageIter::nFreePageSlots, SegPageEntryIter< EntryT >::pPrefetchSource, SegPageIter::prefetchPage(), CircularBuffer< T >::push_back(), CircularBuffer< T >::reference_back(), and CircularBuffer< T >::spaceAvailable().
Referenced by SegPageEntryIter< EntryT >::mapRange(), and SegPageEntryIter< EntryT >::operator++().
Begins a new iteration.
Parameters:
| segmentAccessor | accessor for the segment containing the pages to visit |
|---|---|
| beginPageId | the ID of the first page to visit; always set to NULL_PAGE_ID for this class, as the initial page is provided by the source parameter |
| endPageId | the ID at which to end iteration; by default, this is NULL_PAGE_ID (representing the sentinel end of a chain) but the iteration (and prefetch) can be stopped earlier with some other known PageId; note that endPageId itself will not be prefetched |
Reimplemented from SegPageIter.
Definition at line 69 of file SegPageEntryIterImpl.h.
References CircularBuffer< T >::clear(), SegPageIter::endPageId, SegPageEntryIter< EntryT >::entryQueue, SegPageIter::initPrefetchQueue(), NULL_PAGE_ID, SegmentAccessor::pCacheAccessor, SegPageEntryIter< EntryT >::prefetchPages(), SegmentAccessor::pSegment, and SegPageIter::segmentAccessor.
Referenced by BTreePrefetchSearchExecStream::innerSearchLoop(), LcsClusterReader::position(), and SegPageEntryIterTest::testIter().
template
| std::pair<PageId, EntryT>& SegPageEntryIter< EntryT >::operator * | ( | | ) | [inline] | | ------------------------------------------------------------------------------------------------ | - | | - | ---------- |
Moves to the next prefetched PageId.
An assertion violation results if called when positioned on endPageId.
Reimplemented from SegPageIter.
Definition at line 128 of file SegPageEntryIterImpl.h.
References SegPageIter::atEnd, CircularBuffer< T >::empty(), SegPageIter::endPageId, SegPageEntryIter< EntryT >::entryQueue, SegPageIter::iFetch, SegPageEntryIter< EntryT >::isSingular(), SegPageIter::nFreePageSlots, NULL_PAGE_ID, CircularBuffer< T >::pop_front(), SegPageEntryIter< EntryT >::prefetchPages(), SegPageIter::queueSize, and CircularBuffer< T >::reference_front().
template
| void SegPageEntryIter< EntryT >::makeSingular | ( | | ) | [inline] | | --------------------------------------------------------------------------- | - | | - | ---------- |
template
| bool SegPageEntryIter< EntryT >::isSingular | ( | | ) | const [inline] | | ------------------------------------------------------------------------- | - | | - | ---------------- |
| void SegPageIter::initPrefetchQueue | ( | | ) | [protected, inherited] | | ----------------------------------- | - | | - | ------------------------ |
Reads the pre-fetch parameters, sizes the pre-fetch queue, and initializes various state variables related to the queue.
Definition at line 66 of file SegPageIter.cpp.
References SegPageIter::atEnd, SegPageIter::currPageSlot, SegPageIter::forceReject, SegPageIter::iFetch, SegPageIter::nFreePageSlots, SegPageIter::noPrefetch, SegmentAccessor::pCacheAccessor, SegPageIter::prefetchPagesMax, SegPageIter::prefetchQueue, SegPageIter::prefetchThrottleRate, SegPageIter::queueSize, SegPageIter::segmentAccessor, and SegPageIter::throttleCount.
Referenced by SegPageIter::mapRange(), and SegPageEntryIter< EntryT >::mapRange().
| void SegPageIter::prefetchPage | ( | PageId | pageId | ) | [protected, inherited] |
|---|
Pre-fetches a specified page.
Parameters:
| pageId | the id of the page to be pre-fetched |
|---|
Definition at line 110 of file SegPageIter.cpp.
References SegPageIter::atEnd, SegPageIter::currPageSlot, SegPageIter::endPageId, SegPageIter::forceReject, SegPageIter::iFetch, SegPageIter::nFreePageSlots, SegPageIter::noPrefetch, NULL_BLOCK_ID, SegmentAccessor::pCacheAccessor, SegPageIter::prefetchPagesMax, SegPageIter::prefetchQueue, SegPageIter::prefetchThrottleRate, SegmentAccessor::pSegment, SegPageIter::queueSize, SegPageIter::segmentAccessor, and SegPageIter::throttleCount.
Referenced by SegPageIter::mapRange(), SegPageIter::operator++(), and SegPageEntryIter< EntryT >::prefetchPages().
| PageId SegPageIter::operator * | ( | | ) | const [inline, inherited] | | ------------------------------- | - | | - | --------------------------- |
Returns:
the current PageId in the iteration
Definition at line 156 of file SegPageIter.h.
| void SegPageIter::forcePrefetchReject | ( | | ) | [inherited] | | ------------------------------------- | - | | - | ------------- |
Member Data Documentation
The documentation for this class was generated from the following files:
- /home/pub/open/dev/fennel/segment/SegPageEntryIter.h
- /home/pub/open/dev/fennel/segment/SegPageEntryIterImpl.h
