Clio develop
The XRP Ledger API server.
|
This namespace contains various utilities. More...
Namespaces | |
namespace | async |
This namespace implements an async framework built on top of execution contexts. | |
Classes | |
class | Atomic |
Atomic wrapper for integral and floating point types. More... | |
class | BaseTagDecorator |
Represents any tag decorator. More... | |
class | Config |
Convenience wrapper to query a JSON configuration file. More... | |
class | ConfigReader |
Simple configuration file reader. More... | |
class | CoroutineGroup |
CoroutineGroup is a helper class to manage a group of coroutines. It allows to spawn multiple coroutines and wait for all of them to finish. More... | |
class | ExponentialBackoffStrategy |
A retry strategy that retries while exponentially increasing the delay between attempts. More... | |
class | LedgerTypes |
A helper class that provides lists of different ledger type catagory. More... | |
class | Lock |
A lock on a mutex that provides access to the protected data. More... | |
class | Logger |
A simple thread-safe logger for the channel specified in the constructor. More... | |
class | LogService |
A global logging service. More... | |
class | MoveTracker |
A base-class that can be used to check whether the current instance was moved from. More... | |
class | Mutex |
A container for data that is protected by a mutex. Inspired by Mutex in Rust. More... | |
struct | OverloadSet |
Overload set for lambdas. More... | |
class | Random |
Random number generator. More... | |
class | Repeat |
A class to repeat some action at a regular interval. More... | |
class | ResponseExpirationCache |
Cache of requests' responses with TTL support and configurable cachable commands. More... | |
class | Retry |
A retry mechanism. More... | |
class | RetryStrategy |
Interface for retry strategies. More... | |
class | SignalsHandler |
Class handling signals. More... | |
class | SourceLocation |
A class representing the source location of the current code. More... | |
class | StopHelper |
Helper class to stop a class asynchronously. More... | |
class | StrandedPriorityQueue |
A wrapper for std::priority_queue that serialises operations using a strand. More... | |
class | TagDecorator |
A decorator that decorates a string (log line) with a unique tag. More... | |
class | TagDecorator< impl::NullTagGenerator > |
Specialization for a nop/null decorator. More... | |
class | TagDecoratorFactory |
A factory for TagDecorator instantiation. More... | |
class | Taggable |
A base class that allows attaching a tag decorator to a subclass. More... | |
Concepts | |
concept | SomeNumberType |
Specifies a number type. | |
Typedefs | |
template<SomeNumberType NumberType> | |
using | AtomicPtr = std::unique_ptr<Atomic<NumberType>> |
using | RetryStrategyPtr = std::unique_ptr<RetryStrategy> |
using | SourceLocationType = SourceLocation |
Enumerations | |
enum class | Severity { TRC , DBG , NFO , WRN , ERR , FTL } |
Custom severity levels for util::Logger. | |
Functions | |
template<class T > | |
std::optional< T > | parseBase58Wrapper (std::string const &str) |
A wrapper of parseBase58 function. It adds the check if all characters in the input string are alphanumeric. If not, it returns an empty optional, instead of calling the parseBase58 function. | |
template<class T > | |
std::optional< T > | parseBase58Wrapper (ripple::TokenType type, std::string const &str) |
A wrapper of parseBase58 function. It add the check if all characters in the input string are alphanumeric. If not, it returns an empty optional, instead of calling the parseBase58 function. | |
template<typename... Args> | |
constexpr void | assertImpl (SourceLocationType const location, char const *expression, bool const condition, fmt::format_string< Args... > format, Args &&... args) |
Assert that a condition is true. | |
void | forEachBatch (std::ranges::forward_range auto &&container, std::size_t batchSize, auto &&fn) |
Iterate over a container in batches. | |
constexpr std::uint64_t | mbToBytes (std::uint32_t mb) |
Convert megabytes to bytes. | |
static consteval auto | hasNoDuplicates (auto &&... values) |
Checks that the list of given values contains no duplicates. | |
template<typename... Types> | |
constexpr bool | hasNoDuplicateNames () |
Checks that the list of given type contains no duplicates. | |
std::string | toLower (std::string str) |
Convert a string to lowercase. | |
std::string | toUpper (std::string str) |
Convert a string to uppercase. | |
boost::json::object | removeSecret (boost::json::object const &object) |
Removes any detected secret information from a response JSON object. | |
ripple::LedgerHeader | deserializeHeader (ripple::Slice data) |
Deserializes a ripple::LedgerHeader from ripple::Slice of data. | |
std::string | toString (ripple::LedgerHeader const &info) |
A helper function that converts a ripple::LedgerHeader to a string representation. | |
std::ostream & | operator<< (std::ostream &stream, Severity sev) |
Custom labels for Severity in log output. | |
static Severity | getSeverityLevel (std::string_view logLevel) |
converts the loglevel to string to a corresponding Severity enum value. | |
template<class... Ts> | |
OverloadSet (Ts...) -> OverloadSet< Ts... > | |
Deduction guide for OverloadSet. | |
template<typename U = std::chrono::milliseconds, typename FnType > | |
auto | timed (FnType &&func) |
Profiler function to measure the time a function execution consumes. | |
Retry | makeRetryExponentialBackoff (std::chrono::steady_clock::duration delay, std::chrono::steady_clock::duration maxDelay, boost::asio::strand< boost::asio::io_context::executor_type > strand) |
Create a retry mechanism with exponential backoff strategy. | |
void | setTerminationHandler () |
Set a termination handler that logs a backtrace on termination. | |
std::optional< std::chrono::system_clock::time_point > | systemTpFromUtcStr (std::string const &dateStr, std::string const &format) |
Convert a UTC date string to a system_clock::time_point if possible. | |
std::chrono::system_clock::time_point | systemTpFromLedgerCloseTime (ripple::NetClock::time_point closeTime) |
Convert a ledger close time which is XRPL network clock to a system_clock::time_point. | |
std::unordered_set< std::string > const & | getTxTypesInLowercase () |
Get the transaction types in lowercase. | |
template<typename Operation > | |
boost::system::error_code | withTimeout (Operation &&operation, boost::asio::yield_context yield, std::chrono::steady_clock::duration timeout) |
Perform a coroutine operation with a timeout. | |
Variables | |
static constexpr std::size_t | kMILLISECONDS_PER_SECOND = 1000 |
template<typename > | |
static constexpr bool | Unsupported = false |
used for compile time checking of unsupported types | |
This namespace contains various utilities.
|
constexpr |
Assert that a condition is true.
Args | The format argument types |
location | The location of the assertion |
expression | The expression to assert |
condition | The condition to assert |
format | The format string |
args | The format arguments |
|
inline |
Deserializes a ripple::LedgerHeader from ripple::Slice of data.
data | The slice to deserialize |
void util::forEachBatch | ( | std::ranges::forward_range auto && | container, |
std::size_t | batchSize, | ||
auto && | fn ) |
Iterate over a container in batches.
container | The container to iterate over |
batchSize | The size of each batch |
fn | The function to call for each batch |
|
static |
converts the loglevel to string to a corresponding Severity enum value.
logLevel | A string representing the log level |
|
nodiscard |
Get the transaction types in lowercase.
|
constexpr |
Checks that the list of given type contains no duplicates.
Types | The types to check |
|
staticconsteval |
Checks that the list of given values contains no duplicates.
values | The list of values to check |
Retry util::makeRetryExponentialBackoff | ( | std::chrono::steady_clock::duration | delay, |
std::chrono::steady_clock::duration | maxDelay, | ||
boost::asio::strand< boost::asio::io_context::executor_type > | strand ) |
Create a retry mechanism with exponential backoff strategy.
delay | The initial delay value |
maxDelay | The maximum delay value |
strand | The strand to use for async operations |
|
constexpr |
Convert megabytes to bytes.
mb | Number of megabytes to convert |
std::ostream & util::operator<< | ( | std::ostream & | stream, |
Severity | sev ) |
Custom labels for Severity in log output.
stream | std::ostream The output stream |
sev | Severity The severity to output to the ostream |
util::OverloadSet | ( | Ts... | ) | -> OverloadSet< Ts... > |
Deduction guide for OverloadSet.
Ts | Types of lambdas |
|
nodiscard |
A wrapper of parseBase58 function. It add the check if all characters in the input string are alphanumeric. If not, it returns an empty optional, instead of calling the parseBase58 function.
T | The type of the value to parse to. |
type | The type of the token to parse. |
str | The string to parse. |
|
nodiscard |
A wrapper of parseBase58 function. It adds the check if all characters in the input string are alphanumeric. If not, it returns an empty optional, instead of calling the parseBase58 function.
T | The type of the value to parse to. |
str | The string to parse. |
|
inline |
Removes any detected secret information from a response JSON object.
object | The JSON object to remove secrets from |
|
nodiscard |
Convert a ledger close time which is XRPL network clock to a system_clock::time_point.
closeTime | The ledger close time to convert. |
|
nodiscard |
Convert a UTC date string to a system_clock::time_point if possible.
dateStr | The UTC date string to convert. |
format | The format of the date string. |
|
nodiscard |
Profiler function to measure the time a function execution consumes.
U | The duration measurement to use; defaults to milliseconds |
FnType | The type of the function object |
func | Any function object |
|
inline |
Convert a string to lowercase.
str | The string to convert |
|
inline |
A helper function that converts a ripple::LedgerHeader to a string representation.
info | The ledger header |
|
inline |
Convert a string to uppercase.
str | The string to convert |
boost::system::error_code util::withTimeout | ( | Operation && | operation, |
boost::asio::yield_context | yield, | ||
std::chrono::steady_clock::duration | timeout ) |
Perform a coroutine operation with a timeout.
Operation | The operation type to perform. Must be a callable accepting yield context with bound cancellation token. |
operation | The operation to perform. |
yield | The yield context. |
timeout | The timeout duration. |