#include <ExternalMergeSort.hpp>
Static Public Member Functions | |
template<typename Value > | |
static void | sort (Postlist< Value > &postlist, Quantile &quantile, Sorting mode) |
Static Public Attributes | |
static const size_t | max_memory = 100 * 1024 * 1024 |
Private Types | |
typedef Configuration::Sorting | Sorting |
Private Member Functions | |
ExternalMergeSort () | |
Static Private Member Functions | |
template<typename Value > | |
static void | partition (Postlist< Value > &postlist, Quantile &quantile, std::vector< FILE * > &buckets, Sorting mode) |
template<typename Value > | |
static void | merge (Postlist< Value > &postlist, std::vector< FILE * > &buckets, Sorting mode) |
template<typename Value > | |
static FILE * | swap_out (const std::vector< Value > &entries) |
A class that provides a static method to sort a huge postlist with an external n-merge-sort algorithm.
Created on Jun 22, 2008
Definition at line 21 of file ExternalMergeSort.hpp.
typedef Configuration::Sorting aitools::invertedindex::ExternalMergeSort::Sorting [private] |
Definition at line 13 of file ExternalMergeSort.hpp.
aitools::invertedindex::ExternalMergeSort::ExternalMergeSort | ( | ) | [private] |
void aitools::invertedindex::ExternalMergeSort::merge | ( | Postlist< Value > & | postlist, | |
std::vector< FILE * > & | buckets, | |||
Sorting | mode | |||
) | [inline, static, private] |
Definition at line 113 of file ExternalMergeSort.hpp.
References aitools::invertedindex::PostlistBuilder::append(), aitools::invertedindex::Configuration::ASCENDING, aitools::invertedindex::PostlistBuilder::build(), aitools::invertedindex::ByteBuffer::data(), aitools::util::fclose(), aitools::util::fread(), aitools::invertedindex::Postlist< Value >::iterator(), aitools::invertedindex::ByteBuffer::resize(), aitools::util::rewind(), and aitools::invertedindex::PostlistBuilder::set_checksum().
Referenced by sort().
void aitools::invertedindex::ExternalMergeSort::partition | ( | Postlist< Value > & | postlist, | |
Quantile & | quantile, | |||
std::vector< FILE * > & | buckets, | |||
Sorting | mode | |||
) | [inline, static, private] |
Definition at line 81 of file ExternalMergeSort.hpp.
References aitools::invertedindex::Quantile::clear(), aitools::invertedindex::Postlist< Value >::length(), max_memory, aitools::invertedindex::Postlist< Value >::next(), aitools::invertedindex::Postlist< Value >::payload(), sort(), and swap_out().
Referenced by sort().
void aitools::invertedindex::ExternalMergeSort::sort | ( | Postlist< Value > & | postlist, | |
Quantile & | quantile, | |||
Sorting | mode | |||
) | [inline, static] |
Definition at line 62 of file ExternalMergeSort.hpp.
References aitools::invertedindex::Configuration::DISABLED, max_memory, merge(), partition(), and aitools::invertedindex::Postlist< Value >::payload().
Referenced by partition(), and aitools::invertedindex::PostlistSorter::sort().
FILE * aitools::invertedindex::ExternalMergeSort::swap_out | ( | const std::vector< Value > & | entries | ) | [inline, static, private] |
Definition at line 163 of file ExternalMergeSort.hpp.
References aitools::invertedindex::ByteBuffer::data(), aitools::util::fwrite(), aitools::invertedindex::ByteBuffer::size(), and aitools::invertedindex::System::tmpfile().
Referenced by partition().
const size_t aitools::invertedindex::ExternalMergeSort::max_memory = 100 * 1024 * 1024 [static] |
Definition at line 17 of file ExternalMergeSort.hpp.
Referenced by partition(), aitools::invertedindex::PostlistSorter::sort(), and sort().