OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
cbdc::config Namespace Reference

Namespaces

namespace  defaults
 

Data Structures

struct  options
 Project-wide configuration options. More...
 
class  parser
 Reads configuration parameters line-by-line from a file. More...
 

Typedefs

using shard_range_t = std::pair<uint8_t, uint8_t>
 [start, end] inclusive.
 

Functions

auto parse_ip_port (const std::string &in_str) -> network::endpoint_t
 
void get_shard_key_prefix (std::stringstream &ss, size_t shard_id)
 
auto get_shard_endpoint_key (size_t shard_id) -> std::string
 
auto get_atomizer_endpoint_key (size_t atomizer_id) -> std::string
 
auto get_atomizer_raft_endpoint_key (size_t atomizer_id) -> std::string
 
auto get_atomizer_loglevel_key (size_t atomizer_id) -> std::string
 
auto get_sentinel_endpoint_key (size_t sentinel_id) -> std::string
 
auto get_shard_db_key (size_t shard_id) -> std::string
 
auto get_shard_end_key (size_t shard_id) -> std::string
 
auto get_shard_start_key (size_t shard_id) -> std::string
 
void get_archiver_key_prefix (std::stringstream &ss, size_t archiver_id)
 
auto get_archiver_endpoint_key (size_t archiver_id) -> std::string
 
auto get_archiver_loglevel_key (size_t archiver_id) -> std::string
 
auto get_archiver_db_key (size_t archiver_id) -> std::string
 
auto get_shard_loglevel_key (size_t shard_id) -> std::string
 
void get_sentinel_key_prefix (std::stringstream &ss, size_t sentinel_id)
 
auto get_sentinel_loglevel_key (size_t sentinel_id) -> std::string
 
void get_watchtower_key_prefix (std::stringstream &ss, size_t watchtower_id)
 
auto get_watchtower_client_endpoint_key (size_t watchtower_id) -> std::string
 
auto get_watchtower_internal_endpoint_key (size_t watchtower_id) -> std::string
 
auto get_watchtower_loglevel_key (size_t watchtower_id) -> std::string
 
auto get_shard_node_count_key (size_t shard_id) -> std::string
 
auto get_shard_raft_endpoint_key (size_t shard_id, size_t node_id) -> std::string
 
auto get_shard_endpoint_key (size_t shard_id, size_t node_id) -> std::string
 
auto get_shard_readonly_endpoint_key (size_t shard_id, size_t node_id) -> std::string
 
void get_coordinator_key_prefix (std::stringstream &ss, size_t coordinator_id)
 
auto get_coordinator_endpoint_key (size_t coordinator_id, size_t node_id) -> std::string
 
auto get_coordinator_raft_endpoint_key (size_t coordinator_id, size_t node_id) -> std::string
 
auto get_coordinator_node_count_key (size_t coordinator_id) -> std::string
 
auto get_coordinator_loglevel_key (size_t coordinator_id) -> std::string
 
auto get_sentinel_private_key_key (size_t sentinel_id) -> std::string
 
auto get_sentinel_public_key_key (size_t sentinel_id) -> std::string
 
auto read_shard_endpoints (options &opts, const parser &cfg) -> std::optional< std::string >
 
auto read_shard_options (options &opts, const parser &cfg) -> std::optional< std::string >
 
auto read_coordinator_options (options &opts, const parser &cfg) -> std::optional< std::string >
 
auto read_sentinel_options (options &opts, const parser &cfg) -> std::optional< std::string >
 
auto read_atomizer_options (options &opts, const parser &cfg) -> std::optional< std::string >
 
auto read_archiver_options (options &opts, const parser &cfg) -> std::optional< std::string >
 
auto read_watchtower_options (options &opts, const parser &cfg) -> std::optional< std::string >
 
void read_raft_options (options &opts, const parser &cfg)
 
void read_loadgen_options (options &opts, const parser &cfg)
 
auto read_options (const std::string &config_file) -> std::variant< options, std::string >
 Read options from the given config file without checking invariants.
 
auto load_options (const std::string &config_file) -> std::variant< options, std::string >
 Loads options from the given config file and check for invariants.
 
auto check_options (const options &opts) -> std::optional< std::string >
 Checks a fully populated options struct for invariants.
 
auto hash_in_shard_range (const shard_range_t &range, const hash_t &val) -> bool
 Checks if a hash is in the given range handled.
 
auto loadgen_seed_range (const options &opts, size_t gen_id) -> std::pair< size_t, size_t >
 Calculates the sub-range of total seeded outputs for a particular load generator ID.
 
auto get_args (int argc, char **argv) -> std::vector< std::string >
 Converts c-args from an executable's main function into a vector of strings.
 

Typedef Documentation

◆ shard_range_t

using cbdc::config::shard_range_t = std::pair<uint8_t, uint8_t>

[start, end] inclusive.

Definition at line 129 of file config.hpp.

Function Documentation

◆ check_options()

auto cbdc::config::check_options ( const options & opts) -> std::optional< std::string >

Checks a fully populated options struct for invariants.

Assumes struct contains all required options.

Parameters
optsoptions struct to check.
Returns
std::nullopt if the struct satisfies all invariants. Error string otherwise.

Definition at line 680 of file config.cpp.

Referenced by load_options().

◆ get_archiver_db_key()

auto cbdc::config::get_archiver_db_key ( size_t archiver_id) -> std::string

Definition at line 110 of file config.cpp.

References get_archiver_key_prefix().

Referenced by read_archiver_options().

Here is the call graph for this function:

◆ get_archiver_endpoint_key()

auto cbdc::config::get_archiver_endpoint_key ( size_t archiver_id) -> std::string

Definition at line 96 of file config.cpp.

References get_archiver_key_prefix().

Referenced by read_archiver_options().

Here is the call graph for this function:

◆ get_archiver_key_prefix()

void cbdc::config::get_archiver_key_prefix ( std::stringstream & ss,
size_t archiver_id )

◆ get_archiver_loglevel_key()

auto cbdc::config::get_archiver_loglevel_key ( size_t archiver_id) -> std::string

Definition at line 103 of file config.cpp.

References get_archiver_key_prefix().

Referenced by read_archiver_options().

Here is the call graph for this function:

◆ get_args()

auto cbdc::config::get_args ( int argc,
char ** argv ) -> std::vector< std::string >

Converts c-args from an executable's main function into a vector of strings.

Definition at line 751 of file config.cpp.

Referenced by main(), and cbdc::parsec::parse_args().

◆ get_atomizer_endpoint_key()

auto cbdc::config::get_atomizer_endpoint_key ( size_t atomizer_id) -> std::string

Definition at line 43 of file config.cpp.

Referenced by read_atomizer_options().

◆ get_atomizer_loglevel_key()

auto cbdc::config::get_atomizer_loglevel_key ( size_t atomizer_id) -> std::string

Definition at line 57 of file config.cpp.

Referenced by read_atomizer_options().

◆ get_atomizer_raft_endpoint_key()

auto cbdc::config::get_atomizer_raft_endpoint_key ( size_t atomizer_id) -> std::string

Definition at line 50 of file config.cpp.

Referenced by read_atomizer_options().

◆ get_coordinator_endpoint_key()

auto cbdc::config::get_coordinator_endpoint_key ( size_t coordinator_id,
size_t node_id ) -> std::string

Definition at line 200 of file config.cpp.

References get_coordinator_key_prefix().

Referenced by read_coordinator_options().

Here is the call graph for this function:

◆ get_coordinator_key_prefix()

void cbdc::config::get_coordinator_key_prefix ( std::stringstream & ss,
size_t coordinator_id )

◆ get_coordinator_loglevel_key()

auto cbdc::config::get_coordinator_loglevel_key ( size_t coordinator_id) -> std::string

Definition at line 223 of file config.cpp.

Referenced by read_coordinator_options().

◆ get_coordinator_node_count_key()

auto cbdc::config::get_coordinator_node_count_key ( size_t coordinator_id) -> std::string

Definition at line 216 of file config.cpp.

References get_coordinator_key_prefix().

Referenced by read_coordinator_options().

Here is the call graph for this function:

◆ get_coordinator_raft_endpoint_key()

auto cbdc::config::get_coordinator_raft_endpoint_key ( size_t coordinator_id,
size_t node_id ) -> std::string

Definition at line 208 of file config.cpp.

References get_coordinator_key_prefix().

Referenced by read_coordinator_options().

Here is the call graph for this function:

◆ get_sentinel_endpoint_key()

auto cbdc::config::get_sentinel_endpoint_key ( size_t sentinel_id) -> std::string

Definition at line 64 of file config.cpp.

Referenced by read_sentinel_options().

◆ get_sentinel_key_prefix()

void cbdc::config::get_sentinel_key_prefix ( std::stringstream & ss,
size_t sentinel_id )

◆ get_sentinel_loglevel_key()

auto cbdc::config::get_sentinel_loglevel_key ( size_t sentinel_id) -> std::string

Definition at line 128 of file config.cpp.

References get_sentinel_key_prefix().

Referenced by read_sentinel_options().

Here is the call graph for this function:

◆ get_sentinel_private_key_key()

auto cbdc::config::get_sentinel_private_key_key ( size_t sentinel_id) -> std::string

Definition at line 230 of file config.cpp.

References get_sentinel_key_prefix().

Referenced by read_sentinel_options().

Here is the call graph for this function:

◆ get_sentinel_public_key_key()

auto cbdc::config::get_sentinel_public_key_key ( size_t sentinel_id) -> std::string

Definition at line 237 of file config.cpp.

References get_sentinel_key_prefix().

Referenced by read_sentinel_options().

Here is the call graph for this function:

◆ get_shard_db_key()

auto cbdc::config::get_shard_db_key ( size_t shard_id) -> std::string

Definition at line 71 of file config.cpp.

References get_shard_key_prefix().

Referenced by read_shard_options().

Here is the call graph for this function:

◆ get_shard_end_key()

auto cbdc::config::get_shard_end_key ( size_t shard_id) -> std::string

Definition at line 78 of file config.cpp.

References get_shard_key_prefix().

Referenced by read_shard_options().

Here is the call graph for this function:

◆ get_shard_endpoint_key() [1/2]

auto cbdc::config::get_shard_endpoint_key ( size_t shard_id) -> std::string

Definition at line 36 of file config.cpp.

References get_shard_key_prefix().

Referenced by read_shard_endpoints(), and read_shard_options().

Here is the call graph for this function:

◆ get_shard_endpoint_key() [2/2]

auto cbdc::config::get_shard_endpoint_key ( size_t shard_id,
size_t node_id ) -> std::string

Definition at line 178 of file config.cpp.

References get_shard_key_prefix().

Here is the call graph for this function:

◆ get_shard_key_prefix()

◆ get_shard_loglevel_key()

auto cbdc::config::get_shard_loglevel_key ( size_t shard_id) -> std::string

Definition at line 117 of file config.cpp.

References get_shard_key_prefix().

Referenced by read_shard_options().

Here is the call graph for this function:

◆ get_shard_node_count_key()

auto cbdc::config::get_shard_node_count_key ( size_t shard_id) -> std::string

Definition at line 163 of file config.cpp.

References get_shard_key_prefix().

Referenced by read_shard_endpoints().

Here is the call graph for this function:

◆ get_shard_raft_endpoint_key()

auto cbdc::config::get_shard_raft_endpoint_key ( size_t shard_id,
size_t node_id ) -> std::string

Definition at line 170 of file config.cpp.

References get_shard_key_prefix().

Referenced by read_shard_endpoints().

Here is the call graph for this function:

◆ get_shard_readonly_endpoint_key()

auto cbdc::config::get_shard_readonly_endpoint_key ( size_t shard_id,
size_t node_id ) -> std::string

Definition at line 186 of file config.cpp.

References get_shard_key_prefix().

Referenced by read_shard_endpoints().

Here is the call graph for this function:

◆ get_shard_start_key()

auto cbdc::config::get_shard_start_key ( size_t shard_id) -> std::string

Definition at line 85 of file config.cpp.

References get_shard_key_prefix().

Referenced by read_shard_options().

Here is the call graph for this function:

◆ get_watchtower_client_endpoint_key()

auto cbdc::config::get_watchtower_client_endpoint_key ( size_t watchtower_id) -> std::string

Definition at line 140 of file config.cpp.

References get_watchtower_key_prefix().

Referenced by read_watchtower_options().

Here is the call graph for this function:

◆ get_watchtower_internal_endpoint_key()

auto cbdc::config::get_watchtower_internal_endpoint_key ( size_t watchtower_id) -> std::string

Definition at line 148 of file config.cpp.

References get_watchtower_key_prefix().

Referenced by read_watchtower_options().

Here is the call graph for this function:

◆ get_watchtower_key_prefix()

void cbdc::config::get_watchtower_key_prefix ( std::stringstream & ss,
size_t watchtower_id )

◆ get_watchtower_loglevel_key()

auto cbdc::config::get_watchtower_loglevel_key ( size_t watchtower_id) -> std::string

Definition at line 156 of file config.cpp.

References get_watchtower_key_prefix().

Referenced by read_watchtower_options().

Here is the call graph for this function:

◆ hash_in_shard_range()

auto cbdc::config::hash_in_shard_range ( const shard_range_t & range,
const hash_t & val ) -> bool

Checks if a hash is in the given range handled.

Parameters
rangeshard hash prefix range.
valhash to check.
Returns
true if the hash prefix is within the inclusive range.

Definition at line 736 of file config.cpp.

Referenced by cbdc::locking_shard::interface::hash_in_shard_range(), and cbdc::locking_shard::rpc::status_client::operator=().

◆ load_options()

auto cbdc::config::load_options ( const std::string & config_file) -> std::variant< options, std::string >

Loads options from the given config file and check for invariants.

Parameters
config_filethe path to the config file from which load options.
Returns
valid options struct, or string with error message on failure.

Definition at line 668 of file config.cpp.

References check_options(), and read_options().

Referenced by main().

Here is the call graph for this function:

◆ loadgen_seed_range()

auto cbdc::config::loadgen_seed_range ( const options & opts,
size_t gen_id ) -> std::pair< size_t, size_t >

Calculates the sub-range of total seeded outputs for a particular load generator ID.

Parameters
optsoptions struct from which to read seed data.
gen_idID of load generator for which to calculate the sub-range. Must be less than the load generator count.
Returns
pair representing start and end of the seed range.

Definition at line 741 of file config.cpp.

◆ parse_ip_port()

auto cbdc::config::parse_ip_port ( const std::string & in_str) -> network::endpoint_t

Definition at line 13 of file config.cpp.

Referenced by cbdc::config::parser::get_endpoint(), and cbdc::parsec::read_endpoints().

◆ read_archiver_options()

auto cbdc::config::read_archiver_options ( options & opts,
const parser & cfg ) -> std::optional<std::string>

Definition at line 498 of file config.cpp.

References get_archiver_db_key(), get_archiver_endpoint_key(), and get_archiver_loglevel_key().

Referenced by read_options().

Here is the call graph for this function:

◆ read_atomizer_options()

auto cbdc::config::read_atomizer_options ( options & opts,
const parser & cfg ) -> std::optional<std::string>

Definition at line 459 of file config.cpp.

References get_atomizer_endpoint_key(), get_atomizer_loglevel_key(), and get_atomizer_raft_endpoint_key().

Referenced by read_options().

Here is the call graph for this function:

◆ read_coordinator_options()

auto cbdc::config::read_coordinator_options ( options & opts,
const parser & cfg ) -> std::optional<std::string>

Definition at line 362 of file config.cpp.

References get_coordinator_endpoint_key(), get_coordinator_loglevel_key(), get_coordinator_node_count_key(), and get_coordinator_raft_endpoint_key().

Referenced by read_options().

Here is the call graph for this function:

◆ read_loadgen_options()

◆ read_options()

auto cbdc::config::read_options ( const std::string & config_file) -> std::variant< options, std::string >

Read options from the given config file without checking invariants.

Parameters
config_filethe path to the config file from which to load options.
Returns
options struct with all required values, or string with error message on failure.

Definition at line 619 of file config.cpp.

References read_archiver_options(), read_atomizer_options(), read_coordinator_options(), read_loadgen_options(), read_raft_options(), read_sentinel_options(), read_shard_endpoints(), read_shard_options(), and read_watchtower_options().

Referenced by load_options().

Here is the call graph for this function:

◆ read_raft_options()

◆ read_sentinel_options()

auto cbdc::config::read_sentinel_options ( options & opts,
const parser & cfg ) -> std::optional<std::string>

Definition at line 409 of file config.cpp.

References get_sentinel_endpoint_key(), get_sentinel_loglevel_key(), get_sentinel_private_key_key(), get_sentinel_public_key_key(), and cbdc::hash_from_hex().

Referenced by read_options().

Here is the call graph for this function:

◆ read_shard_endpoints()

auto cbdc::config::read_shard_endpoints ( options & opts,
const parser & cfg ) -> std::optional<std::string>

Definition at line 244 of file config.cpp.

References get_shard_endpoint_key(), get_shard_node_count_key(), get_shard_raft_endpoint_key(), and get_shard_readonly_endpoint_key().

Referenced by read_options().

Here is the call graph for this function:

◆ read_shard_options()

auto cbdc::config::read_shard_options ( options & opts,
const parser & cfg ) -> std::optional<std::string>

Definition at line 295 of file config.cpp.

References get_shard_db_key(), get_shard_end_key(), get_shard_endpoint_key(), get_shard_loglevel_key(), get_shard_start_key(), and cbdc::hash_from_hex().

Referenced by read_options().

Here is the call graph for this function:

◆ read_watchtower_options()

auto cbdc::config::read_watchtower_options ( options & opts,
const parser & cfg ) -> std::optional<std::string>

Definition at line 529 of file config.cpp.

References get_watchtower_client_endpoint_key(), get_watchtower_internal_endpoint_key(), and get_watchtower_loglevel_key().

Referenced by read_options().

Here is the call graph for this function: