taco-db  0.1.0
Public Member Functions | List of all members
taco::ExternalSort::OutputIterator Class Reference

The output operator that can used to scan through the output of this ExternalSort instance in ascending order defined by comp. More...

Inheritance diagram for taco::ExternalSort::OutputIterator:
taco::ItemIterator

Public Member Functions

 OutputIterator (const File *tmpfile, PageNumber final_num_pages)
 Construct an iterator from the tmp file containing the final sorted items. More...
 
 ~OutputIterator () override
 Deconstructor to clean all the states. More...
 
bool Next () override
 Move the iterator to next output record. More...
 
const char * GetCurrentItem (FieldOffset &p_reclen) override
 Return the item pointed by this iterator. More...
 
bool SupportsRewind () const override
 Indicate if this iterator supports rewind. More...
 
uint64_t SavePosition () const override
 Save the position of current iterator so that later on can be rewind to this position. More...
 
void Rewind (uint64_t pos) override
 Rewind to a particular position saved before. More...
 
void EndScan () override
 Ends the scan. More...
 
- Public Member Functions inherited from taco::ItemIterator
virtual ~ItemIterator ()
 Destructor. More...
 

Detailed Description

The output operator that can used to scan through the output of this ExternalSort instance in ascending order defined by comp.

Constructor & Destructor Documentation

◆ OutputIterator()

taco::ExternalSort::OutputIterator::OutputIterator ( const File tmpfile,
PageNumber  final_num_pages 
)

Construct an iterator from the tmp file containing the final sorted items.

You also want to remember which is the page to stop for this tmp file.

◆ ~OutputIterator()

taco::ExternalSort::OutputIterator::~OutputIterator ( )
override

Deconstructor to clean all the states.

Member Function Documentation

◆ EndScan()

void taco::ExternalSort::OutputIterator::EndScan ( )
overridevirtual

Ends the scan.

Implements taco::ItemIterator.

◆ GetCurrentItem()

const char * taco::ExternalSort::OutputIterator::GetCurrentItem ( FieldOffset p_reclen)
overridevirtual

Return the item pointed by this iterator.

It returns the buffer location through return value and update p_reclen to be the length of this item.

Implements taco::ItemIterator.

◆ Next()

bool taco::ExternalSort::OutputIterator::Next ( )
overridevirtual

Move the iterator to next output record.

Returns true if there is such a record. The current record of this iterator stores the page and sid information in its state. Even this tmp file is not managed by the buffer manager. You should manage something more like a single-page buffer manager inside the state of this iterator.

Implements taco::ItemIterator.

◆ Rewind()

void taco::ExternalSort::OutputIterator::Rewind ( uint64_t  pos)
overridevirtual

Rewind to a particular position saved before.

Specifically, if pos equals to 0, it rewinds to the state as if the iterator just been constructed.

pos must be a number returned by SavePosition() by the same iterator before. Otherwise, the behavior of this function is undefined.

Implements taco::ItemIterator.

◆ SavePosition()

uint64_t taco::ExternalSort::OutputIterator::SavePosition ( ) const
inlineoverridevirtual

Save the position of current iterator so that later on can be rewind to this position.

Implements taco::ItemIterator.

◆ SupportsRewind()

bool taco::ExternalSort::OutputIterator::SupportsRewind ( ) const
inlineoverridevirtual

Indicate if this iterator supports rewind.

As the output iterator of sorting, it should be true;

Implements taco::ItemIterator.


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