Back to Site
Loading...
Searching...
No Matches
librats::StorageConfig Struct Reference

Storage configuration. More...

#include <storage.h>

Collaboration diagram for librats::StorageConfig:
[legend]

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.
 

Detailed Description

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().

Definition at line 188 of file storage.h.

Constructor & Destructor Documentation

◆ StorageConfig()

librats::StorageConfig::StorageConfig ( )
inline

Definition at line 214 of file storage.h.

Member Data Documentation

◆ compaction_threshold

uint32_t librats::StorageConfig::compaction_threshold

Definition at line 202 of file storage.h.

◆ data_directory

std::string librats::StorageConfig::data_directory

Definition at line 199 of file storage.h.

◆ database_name

std::string librats::StorageConfig::database_name

Definition at line 200 of file storage.h.

◆ enable_sync

bool librats::StorageConfig::enable_sync

Definition at line 201 of file storage.h.

◆ kMaxSyncBatchBytes

constexpr uint32_t librats::StorageConfig::kMaxSyncBatchBytes = 2 * 1024 * 1024
staticconstexpr

Ceiling on sync_batch_bytes, for the same reason.

Definition at line 194 of file storage.h.

◆ kMaxValueSize

constexpr uint32_t librats::StorageConfig::kMaxValueSize = 2 * 1024 * 1024
staticconstexpr

Ceiling on max_value_size: the default connection low-water mark.

One value at the ceiling makes a peer unwritable and is then waited out, rather than counting toward the high-water mark that drops it.

Definition at line 192 of file storage.h.

◆ kMinSyncBatchBytes

constexpr uint32_t librats::StorageConfig::kMinSyncBatchBytes = 16 * 1024
staticconstexpr

Floor on sync_batch_bytes: below this a snapshot costs more in per-message framing and round trips than it saves in queue occupancy.

Definition at line 197 of file storage.h.

◆ max_value_size

uint32_t librats::StorageConfig::max_value_size

Definition at line 203 of file storage.h.

◆ persist_to_disk

bool librats::StorageConfig::persist_to_disk

Definition at line 204 of file storage.h.

◆ sync_batch_bytes

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.

◆ sync_min_interval_ms

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.


The documentation for this struct was generated from the following file: