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