#include <hash0hash.h>
◆ hash_table_t()
hash_table_t::hash_table_t |
( |
size_t |
n | ) |
|
|
inline |
◆ ~hash_table_t()
hash_table_t::~hash_table_t |
( |
| ) |
|
|
inline |
◆ get_n_cells()
size_t hash_table_t::get_n_cells |
( |
| ) |
|
|
inline |
Returns number of cells in cells[] array.
If type==HASH_TABLE_SYNC_RW_LOCK it can be used:
- without any latches to peek a value, before hash_lock_[sx]_confirm
- when holding S-latch for at least one n_sync_obj to get the "real" value
- Returns
- value of n_cells
◆ get_n_cells_fast_modulo()
Returns a helper class for calculating fast modulo n_cells.
If type==HASH_TABLE_SYNC_RW_LOCK it can be used:
- without any latches to peek a value, before hash_lock_[sx]_confirm
- when holding S-latch for at least one n_sync_obj to get the "real" value
◆ set_n_cells()
void hash_table_t::set_n_cells |
( |
size_t |
n | ) |
|
|
inline |
Sets the number of n_cells, to the provided one.
If type==HASH_TABLE_SYNC_RW_LOCK it can be used only when holding x-latches on all shards.
- Parameters
-
[in] | n | The new size of cells[] array |
◆ adaptive
bool hash_table_t::adaptive = false |
◆ cells
The pointer to the array of cells.
If type==HASH_TABLE_SYNC_RW_LOCK it is:
- modified when holding X-latches on all n_sync_obj
- read when holding an S-latch for at least one n_sync_obj
◆ HASH_TABLE_MAGIC_N
constexpr uint32_t hash_table_t::HASH_TABLE_MAGIC_N = 76561114 |
|
staticconstexpr |
◆ heap
◆ magic_n
◆ n_cells
std::atomic<size_t> hash_table_t::n_cells |
|
private |
The number of cells in the hash table.
If type==HASH_TABLE_SYNC_RW_LOCK it is:
- modified when holding X-latches on all n_sync_obj
- read
- without any latches to peek a value, before hash_lock_[sx]_confirm
- when holding S-latch for at least one n_sync_obj to get the "real" value
◆ n_cells_fast_modulo
Utility to calculate the modulo n_cells fast.
It is set together with n_cells. It can be read without latches in parallel to set_n_cells, and as it is a complex object, it is not set atomically. Because of this the multi-threaded version is used.
◆ n_sync_obj
size_t hash_table_t::n_sync_obj = 0 |
if rw_locks != nullptr, then it's their number (must be a power of two).
Otherwise, 0. Is zero iff the type is HASH_TABLE_SYNC_NONE.
◆ rw_locks
nullptr, or an array of n_sync_obj rw_locks used to protect segments of the hash table.
Is nullptr iff the type is HASH_TABLE_SYNC_NONE.
◆ type
Either: a) HASH_TABLE_SYNC_NONE in which case n_sync_obj is 0 and rw_locks is nullptr or b) HASH_TABLE_SYNC_RW_LOCK in which case n_sync_obj > 0 is the number of rw_locks elements, each of which protects a disjoint fraction of cells.
The default type of hash_table is HASH_TABLE_SYNC_NONE i.e.: the caller is responsible for access control to the table.
The documentation for this class was generated from the following file: