Tkrzw
Public Member Functions | Public Attributes | List of all members
tkrzw::HashDBM::TuningParameters Struct Reference

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...
 
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 fbp_capacity = -1
 The capacity of the free block pool. More...
 
bool lock_mem_buckets = false
 Whether to lock the memory for the hash buckets. More...
 

Detailed Description

Tuning parameters for the database.

Constructor & Destructor Documentation

◆ TuningParameters()

tkrzw::HashDBM::TuningParameters::TuningParameters ( )

Constructor.

Member Data Documentation

◆ update_mode

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.

◆ offset_width

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.

◆ align_pow

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.

◆ num_buckets

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.

◆ fbp_capacity

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.

◆ lock_mem_buckets

bool tkrzw::HashDBM::TuningParameters::lock_mem_buckets = false

Whether to lock the memory for the hash buckets.

If true and the underlying file class supports memory mapping, the memory region of the hash buckets is locked in order not to be swapped out. As this parameter is not saved as a metadata of the database, it should be set each time when opening the database.