Storage configuration. More...
#include <storage.h>
Public Member Functions | |
| StorageConfig () | |
Public Attributes | |
| std::string | data_directory |
| std::string | database_name |
| bool | enable_sync |
| uint32_t | compaction_threshold |
| uint32_t | max_value_size |
| bool | persist_to_disk |
| uint32_t | sync_batch_bytes |
| Target payload size of one snapshot chunk. | |
| uint32_t | sync_min_interval_ms |
| Minimum gap between two snapshots served to the same peer. | |
Static Public Attributes | |
| static constexpr uint32_t | kMaxValueSize = 2 * 1024 * 1024 |
| Ceiling on max_value_size: the default connection low-water mark. | |
| static constexpr uint32_t | kMaxSyncBatchBytes = 2 * 1024 * 1024 |
| Ceiling on sync_batch_bytes, for the same reason. | |
| static constexpr uint32_t | kMinSyncBatchBytes = 16 * 1024 |
| Floor on sync_batch_bytes: below this a snapshot costs more in per-message framing and round trips than it saves in queue occupancy. | |
Storage configuration.
The two size limits are not free parameters: both are bounded by what one peer's send queue can hold. A connection drops its peer as a slow consumer past its high-water mark (8 MiB by default, NodeConfig::send_queue_limit) and reports "no room" at a quarter of it, so a single value — and a single snapshot chunk — must stay well inside that quarter, or the very first one would kill the link it travels on. Both are clamped to kMaxValueSize / kMaxSyncBatchBytes on construction and in set_config().
|
inline |
Definition at line 214 of file storage.h.
References compaction_threshold, data_directory, database_name, enable_sync, max_value_size, persist_to_disk, sync_batch_bytes, and sync_min_interval_ms.
| uint32_t librats::StorageConfig::compaction_threshold |
Definition at line 202 of file storage.h.
Referenced by StorageConfig().
| std::string librats::StorageConfig::data_directory |
Definition at line 199 of file storage.h.
Referenced by StorageConfig().
| std::string librats::StorageConfig::database_name |
Definition at line 200 of file storage.h.
Referenced by StorageConfig().
| bool librats::StorageConfig::enable_sync |
Definition at line 201 of file storage.h.
Referenced by StorageConfig().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
| uint32_t librats::StorageConfig::max_value_size |
Definition at line 203 of file storage.h.
Referenced by StorageConfig().
| bool librats::StorageConfig::persist_to_disk |
Definition at line 204 of file storage.h.
Referenced by StorageConfig().
| uint32_t librats::StorageConfig::sync_batch_bytes |
Target payload size of one snapshot chunk.
The walk stops at the first entry that takes the buffer past this, so a chunk is this size plus at most one entry — which is why max_value_size shares the same ceiling.
Definition at line 208 of file storage.h.
Referenced by StorageConfig().
| uint32_t librats::StorageConfig::sync_min_interval_ms |
Minimum gap between two snapshots served to the same peer.
Bounds what a peer can make us spend by asking, and paces the re-sync a peer is owed after it has been congested.
Definition at line 212 of file storage.h.
Referenced by StorageConfig().