Tkrzw
|
Sorter for a large amound of records based on merge sort on files. More...
#include <tkrzw_dbm_skip_impl.h>
Public Member Functions | |
RecordSorter (const std::string &base_path, int64_t max_mem_size) | |
Constructor. More... | |
~RecordSorter () | |
Destructor. More... | |
Status | Add (std::string_view key, std::string_view value) |
Adds a record. More... | |
void | AddSkipRecord (SkipRecord *rec, int64_t record_base) |
Adds a file of SkipRecord. More... | |
void | TakeFileOwnership (std::unique_ptr< File > &&file) |
Takes ownership of a file object. More... | |
bool | IsUpdated () const |
Checks whether the sorter is updated. More... | |
Status | Finish () |
Finishes adding records and allows getting them. More... | |
Status | Get (std::string *key, std::string *value) |
Gets the minimum record. More... | |
Sorter for a large amound of records based on merge sort on files.
tkrzw::RecordSorter::RecordSorter | ( | const std::string & | base_path, |
int64_t | max_mem_size | ||
) |
Constructor.
base_path | The base path of the temporary files. |
max_mem_size | The maximum memory size to use. |
tkrzw::RecordSorter::~RecordSorter | ( | ) |
Destructor.
Status tkrzw::RecordSorter::Add | ( | std::string_view | key, |
std::string_view | value | ||
) |
Adds a record.
key | The key string. |
value | The key string. |
void tkrzw::RecordSorter::AddSkipRecord | ( | SkipRecord * | rec, |
int64_t | record_base | ||
) |
Adds a file of SkipRecord.
rec | The pointer to a skip record, whose ownership is taken. |
record_base | The record base offset. |
void tkrzw::RecordSorter::TakeFileOwnership | ( | std::unique_ptr< File > && | file | ) |
Takes ownership of a file object.
file | The unique pointer of the file object. |
bool tkrzw::RecordSorter::IsUpdated | ( | ) | const |
Checks whether the sorter is updated.
Status tkrzw::RecordSorter::Finish | ( | ) |
Finishes adding records and allows getting them.
Status tkrzw::RecordSorter::Get | ( | std::string * | key, |
std::string * | value | ||
) |
Gets the minimum record.
key | The pointer to a string object to contain the record key. |
value | The pointer to a string object to contain the record value. |