Tkrzw
|
Tuning parameters for the database. More...
#include <tkrzw_dbm_hash.h>
Public Member Functions | |
TuningParameters () | |
Constructor. More... | |
Public Attributes | |
UpdateMode | update_mode = UPDATE_DEFAULT |
How to update the database file. More... | |
RecordCRCMode | record_crc_mode = RECORD_CRC_DEFAULT |
How to add the CRC data to the record. More... | |
RecordCompressionMode | record_comp_mode = RECORD_COMP_DEFAULT |
How to compress the value data of the record. More... | |
int32_t | offset_width = -1 |
The width to represent the offset of records. More... | |
int32_t | align_pow = -1 |
The power to align records. More... | |
int64_t | num_buckets = -1 |
The number of buckets for hashing. More... | |
int32_t | restore_mode = RESTORE_DEFAULT |
How to restore the broken database file. More... | |
int32_t | fbp_capacity = -1 |
The capacity of the free block pool. More... | |
int32_t | min_read_size = -1 |
The minimum reading size to read a record. More... | |
int32_t | cache_buckets = -1 |
Whether to cache the hash buckets on memory. More... | |
std::string | cipher_key = "" |
The encryption key for cipher compressors. More... | |
Tuning parameters for the database.
tkrzw::HashDBM::TuningParameters::TuningParameters | ( | ) |
Constructor.
UpdateMode tkrzw::HashDBM::TuningParameters::update_mode = UPDATE_DEFAULT |
How to update the database file.
In-place writing means that the data space of a existing records is modified when it is overwritten or removed. Appending writing means that modification is always done by appending new data at the end of the file. The default mode is in-place writing.
RecordCRCMode tkrzw::HashDBM::TuningParameters::record_crc_mode = RECORD_CRC_DEFAULT |
How to add the CRC data to the record.
The cyclic redundancy check detects corruption of record data. Although no CRC is added, corruption is detected at a certain probability. The more width the CRC has, the more likely corruption is detected.
RecordCompressionMode tkrzw::HashDBM::TuningParameters::record_comp_mode = RECORD_COMP_DEFAULT |
How to compress the value data of the record.
Because compression is done for each record, it is effective only if the record value is large. Because compression is implemented with external libraries, available algorithms are limited to the ones which were enabled when the database librarry was built.
int32_t tkrzw::HashDBM::TuningParameters::offset_width = -1 |
The width to represent the offset of records.
This determines the maximum size of the database and the footprint. -1 means that the default value 4 is set.
int32_t tkrzw::HashDBM::TuningParameters::align_pow = -1 |
The power to align records.
This determines the maximum size of the datbase and the unit size allotted to each record. -1 means that The default value 3 is set.
int64_t tkrzw::HashDBM::TuningParameters::num_buckets = -1 |
The number of buckets for hashing.
For good performance, the number of buckets should be larger than the number of records. -1 means that the default value 1048583 is set.
int32_t tkrzw::HashDBM::TuningParameters::restore_mode = RESTORE_DEFAULT |
How to restore the broken database file.
If the database file is not closed properly, when you open the file next time, it is considered broken. Then, restore operations are done implicitly. By default, the whole database is scanned to recover as many records as possible. As this parameter is not saved as a metadata of the database, it should be set each time when opening the database.
int32_t tkrzw::HashDBM::TuningParameters::fbp_capacity = -1 |
The capacity of the free block pool.
The free block pool is for reusing dead space of removed or moved records in the in-place updating mode. -1 means that the default value 2048 is set. As this parameter is not saved as a metadata of the database, it should be set each time when opening the database.
int32_t tkrzw::HashDBM::TuningParameters::min_read_size = -1 |
The minimum reading size to read a record.
When a record is read from the file, data of the specified size is read at once. If the record size including the footprint is larger than the read data size, another reading operation is done. -1 means that the larger value of the default value 48 and the alignemnt size is set. As this parameter is not saved as a metadata of the database, it should be set each time when opening the database.
int32_t tkrzw::HashDBM::TuningParameters::cache_buckets = -1 |
Whether to cache the hash buckets on memory.
If positive and the underlying file class supports caching, the file region of the hash buckets is cached in order to improve performance. As this parameter is not saved as a metadata of the database, it should be set each time when opening the database.
std::string tkrzw::HashDBM::TuningParameters::cipher_key = "" |
The encryption key for cipher compressors.
This key is passed as-is as a binary data to the cipher compressor. The database doesn't check whether the key is valid or not. Thus, a wrong key produces invalid record values. As this parameter is not saved as a metadata of the database, it should be set each time when opening the database.