Registry of free blocks.
More...
#include <tkrzw_dbm_hash_impl.h>
◆ FreeBlockPool()
tkrzw::FreeBlockPool::FreeBlockPool |
( |
int32_t |
capacity | ) |
|
Constructor.
- Parameters
-
capacity | The capacity of the pool. |
◆ SetCapacity()
void tkrzw::FreeBlockPool::SetCapacity |
( |
int32_t |
capacity | ) |
|
Sets the capacity.
- Parameters
-
capacity | The capacity of the pool. |
◆ Clear()
void tkrzw::FreeBlockPool::Clear |
( |
| ) |
|
◆ InsertFreeBlock()
void tkrzw::FreeBlockPool::InsertFreeBlock |
( |
int64_t |
offset, |
|
|
int32_t |
size |
|
) |
| |
Inserts a free block.
- Parameters
-
offset | The offset in the file. |
size | The size of the block |
◆ FetchFreeBlock()
bool tkrzw::FreeBlockPool::FetchFreeBlock |
( |
int32_t |
min_size, |
|
|
FreeBlock * |
res |
|
) |
| |
Fetchs the minimum free block meeting the record size to fit it in.
- Parameters
-
min_size | The minimum size of the block to fetch. |
res | The pointer to a free block object to store the result. |
- Returns
- True on success or false on failure.
◆ Size()
int32_t tkrzw::FreeBlockPool::Size |
( |
| ) |
|
Gets the current number of free blocks.
- Returns
- The current number of free blocks.
◆ Serialize()
std::string tkrzw::FreeBlockPool::Serialize |
( |
int32_t |
offset_width, |
|
|
int32_t |
align_pow, |
|
|
int32_t |
size |
|
) |
| |
Serializes records into a string.
- Parameters
-
offset_width | The offset width. |
align_pow | The alignment power. |
size | The size of the result string. |
- Returns
- The result string.
◆ Deserialize()
void tkrzw::FreeBlockPool::Deserialize |
( |
std::string_view |
str, |
|
|
int32_t |
offset_width, |
|
|
int32_t |
align_pow |
|
) |
| |
Deserializes a string to set records.
- Parameters
-
str | The string to deserialize. |
offset_width | The offset width. |
align_pow | The alignment power. |