Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
util::config Namespace Reference

Clio configuration: definitions of the supported keys, their types, constraints and defaults, and views for reading the parsed values. More...

Classes

class  Array
 Array definition to store multiple values provided by the user from Json/Yaml. More...
class  ArrayView
 View for array structure for config. More...
class  ClioConfigDefinition
 All the config data will be stored and extracted from this class. More...
struct  ClioConfigDescription
 All the config description are stored and extracted from this class. More...
class  ConfigFileInterface
 The interface for configuration files. More...
class  ConfigFileJson
 Json representation of config. More...
class  ConfigValue
 Represents the config values for Json/Yaml config. More...
class  Constraint
 An interface to enforce constraints on certain values within ClioConfigDefinition. More...
struct  Error
 Displays the different errors when parsing user config. More...
class  NumberValueConstraint
 A constraint class to ensure an integer value is between two numbers (inclusive). More...
class  ObjectView
 Provides a view into a subset of configuration data defined by a prefix. More...
class  OneOf
 A constraint class to ensure the provided value is one of the specified values in an array. More...
class  PortConstraint
 A constraint to ensure the port number is within a valid range. More...
class  PositiveDouble
 A constraint to ensure a number (int or double) is non-negative. More...
class  RpcNameConstraint
 A constraint to ensure the value is a valid RPC command name. More...
class  ValidIPConstraint
 A constraint to ensure the value is a valid IP address or hostname. More...
class  ValueView
 Provides view into ConfigValues that represents values in Clio Config. More...

Typedefs

using Value = std::variant<int64_t, std::string, bool, double>
 Represents the supported Config Values.

Enumerations

enum class  ConfigType { Integer , String , Double , Boolean }
 Custom clio config types. More...

Functions

std::ostream & operator<< (std::ostream &stream, Array arr)
 Custom output stream for Array.
ClioConfigDefinition & getClioConfig ()
 Full Clio Configuration definition.
std::ostream & operator<< (std::ostream &stream, ConfigType type)
 Prints the specified config type to output stream.
std::ostream & operator<< (std::ostream &stream, Value value)
 Prints the specified value to output stream.
template<typename Type>
constexpr ConfigType getType ()
 Get the corresponding clio config type.

Variables

static constexpr std::array< std::string_view, 6 > kLogLevels
 specific values that are accepted for logger levels in config.
static constexpr std::array< std::string_view, 5 > kLogTags
 specific values that are accepted for logger tag style in config.
static constexpr std::array< std::string_view, 3 > kLoadCacheMode
 specific values that are accepted for cache loading in config.
static constexpr std::array< std::string_view, 1 > kDatabaseType = {"cassandra"}
 specific values that are accepted for database type in config.
static constexpr std::array< std::string_view, 2 > kProcessingPolicy = {"parallel", "sequent"}
 specific values that are accepted for server's processing_policy in config.
static constexpr std::array< std::string_view, 2 > kProvider = {"cassandra", "aws_keyspace"}
 specific values that are accepted for database provider in config.
static constinit PortConstraint gValidatePort {}
 Validates a network port number.
static constinit ValidIPConstraint gValidateIp {}
 Validates an IP address or hostname.
static constinit OneOf gValidateChannelName {"channel", Logger::kChannels}
 Validates a log channel name.
static constinit OneOf gValidateLogLevelName {"log.level", kLogLevels}
 Validates a log level name.
static constinit OneOf gValidateCassandraName {"database.type", kDatabaseType}
 Validates the database type.
static constinit OneOf gValidateLoadMode {"cache.load", kLoadCacheMode}
 Validates the cache load mode.
static constinit OneOf gValidateLogTag {"log.tag_style", kLogTags}
 Validates the log tag style.
static constinit OneOf gValidateProcessingPolicy {"server.processing_policy", kProcessingPolicy}
 Validates the server request processing policy.
static constinit OneOf gValidateProvider {"database.cassandra.provider", kProvider}
 Validates the Cassandra-compatible database provider.
static constinit PositiveDouble gValidatePositiveDouble {}
 Validates a number is non-negative.
static constinit NumberValueConstraint< uint16_t > gValidateNumMarkers {1, 256}
 Validates the number of markers used for the initial ledger load; must be in [1, 256].
static constinit NumberValueConstraint< uint16_t > gValidateNumCursors
 Validates a number of cache loading cursors; any uint16 value, including 0.
static constinit NumberValueConstraint< uint16_t > gValidateReplicationFactor
 Validates the database replication factor; 0 is allowed.
static constinit NumberValueConstraint< uint16_t > gValidateUint16
 Validates a positive (non-zero) uint16 value.
static constinit NumberValueConstraint< uint32_t > gValidateUint32
 Validates a positive (non-zero) uint32 value.
static constinit NumberValueConstraint< uint32_t > gValidateNonNegativeUint32
 Validates a non-negative uint32 value (0 is allowed).
static constinit NumberValueConstraint< uint32_t > gValidateApiVersion
 Validates an API version; must be within the supported range of API versions.
static constinit RpcNameConstraint gRpcNameConstraint {}
 Validates that a value is a valid RPC command name.

Detailed Description

Clio configuration: definitions of the supported keys, their types, constraints and defaults, and views for reading the parsed values.

Enumeration Type Documentation

◆ ConfigType

enum class util::config::ConfigType
strong

Custom clio config types.

Enumerator
Integer 

A signed 64-bit integer value.

String 

A string value.

Double 

A double precision floating point value.

Boolean 

A boolean value.

Function Documentation

◆ getClioConfig()

ClioConfigDefinition & util::config::getClioConfig ( )

Full Clio Configuration definition.

Specifies which keys are valid in Clio Config and provides default values if user's do not specify one. Those without default values must be present in the user's config file.

Returns
Reference to the global Clio config definition

◆ getType()

template<typename Type>
ConfigType util::config::getType ( )
constexpr

Get the corresponding clio config type.

Template Parameters
TypeThe type to get the corresponding ConfigType for
Returns
The corresponding ConfigType

◆ operator<<() [1/3]

std::ostream & util::config::operator<< ( std::ostream & stream,
Array arr )
inline

Custom output stream for Array.

Parameters
streamThe output stream
arrThe Array
Returns
The same ostream we were given

◆ operator<<() [2/3]

std::ostream & util::config::operator<< ( std::ostream & stream,
ConfigType type )

Prints the specified config type to output stream.

Parameters
streamThe output stream
typeThe config type
Returns
The same ostream we were given

◆ operator<<() [3/3]

std::ostream & util::config::operator<< ( std::ostream & stream,
Value value )

Prints the specified value to output stream.

Parameters
streamThe output stream
valueThe value type
Returns
The same ostream we were given

Variable Documentation

◆ gValidateApiVersion

NumberValueConstraint<uint32_t> util::config::gValidateApiVersion
staticconstinit
Initial value:
{
}
static constexpr uint32_t kApiVersionMin
Minimum API version supported by this build.
Definition APIVersion.hpp:19
static constexpr uint32_t kApiVersionMax
Maximum API version supported by this build.
Definition APIVersion.hpp:24

Validates an API version; must be within the supported range of API versions.

◆ gValidateNonNegativeUint32

NumberValueConstraint<uint32_t> util::config::gValidateNonNegativeUint32
staticconstinit
Initial value:
{
0,
std::numeric_limits<uint32_t>::max()
}

Validates a non-negative uint32 value (0 is allowed).

◆ gValidateNumCursors

NumberValueConstraint<uint16_t> util::config::gValidateNumCursors
staticconstinit
Initial value:
{
0,
std::numeric_limits<uint16_t>::max()
}

Validates a number of cache loading cursors; any uint16 value, including 0.

◆ gValidateReplicationFactor

NumberValueConstraint<uint16_t> util::config::gValidateReplicationFactor
staticconstinit
Initial value:
{
0,
std::numeric_limits<uint16_t>::max()
}

Validates the database replication factor; 0 is allowed.

◆ gValidateUint16

NumberValueConstraint<uint16_t> util::config::gValidateUint16
staticconstinit
Initial value:
{
1,
std::numeric_limits<uint16_t>::max()
}

Validates a positive (non-zero) uint16 value.

◆ gValidateUint32

NumberValueConstraint<uint32_t> util::config::gValidateUint32
staticconstinit
Initial value:
{
1,
std::numeric_limits<uint32_t>::max()
}

Validates a positive (non-zero) uint32 value.

◆ kLoadCacheMode

std::array<std::string_view, 3> util::config::kLoadCacheMode
staticconstexpr
Initial value:
= {
"sync",
"async",
"none",
}

specific values that are accepted for cache loading in config.

◆ kLogLevels

std::array<std::string_view, 6> util::config::kLogLevels
staticconstexpr
Initial value:
= {
"trace",
"debug",
"info",
"warning",
"error",
"fatal",
}

specific values that are accepted for logger levels in config.

◆ kLogTags

std::array<std::string_view, 5> util::config::kLogTags
staticconstexpr
Initial value:
= {
"int",
"uint",
"null",
"none",
"uuid",
}

specific values that are accepted for logger tag style in config.