|
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 | BlockingCache |
| A thread-safe cache that blocks getting operations until the cache is updated. More... | |
| class | Coroutine |
| Manages a coroutine execution context, allowing for cooperative multitasking and cancellation. 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 | LedgerTypes |
| A helper class that provides lists of different ledger type category. More... | |
| class | Logger |
| A simple thread-safe logger for the channel specified in the constructor. More... | |
| class | LogServiceState |
| Base state management class for the logging service. 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... | |
| class | Lock |
| A lock on a mutex that provides access to the protected data. More... | |
| struct | OverloadSet |
| Overload set for lambdas. More... | |
| class | RandomGeneratorInterface |
| Random number generator interface. More... | |
| class | MTRandomGenerator |
| Mersenne Twister 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 cacheable commands. More... | |
| class | RetryStrategy |
| Interface for retry strategies. More... | |
| class | Retry |
| A retry mechanism. More... | |
| class | ExponentialBackoffStrategy |
| A retry strategy that retries while exponentially increasing the delay between attempts. More... | |
| class | ScopeGuard |
| Run a function when the scope is exited. 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... | |
| struct | StringHash |
| A string hash functor that provides transparent hash operations for various string types. More... | |
| class | BaseTagDecorator |
| Represents any tag decorator. 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. | |
| concept | CoroutineFunction |
| Concept for functions that can be used as coroutine bodies. Such functions must be invocable with a Coroutine& argument. | |
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. | |
| 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. | |
| template<std::integral Type> | |
| Type | integralValueAs (boost::json::value const &value) |
| Detects the type of number stored in value and casts it back to the requested Type. | |
| 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. | |
| static Severity | getSeverityLevel (std::string_view logLevel) |
| converts the loglevel to string to a corresponding Severity enum value. | |
| static std::vector< spdlog::sink_ptr > | createConsoleSinks (bool logToConsole, std::string const &format) |
| Initializes console logging. | |
| static std::expected< std::unordered_map< std::string_view, Severity >, std::string > | getMinSeverity (config::ClioConfigDefinition const &config, Severity defaultSeverity) |
| Gets the minimum severity levels for each log channel from the configuration. | |
| std::string_view | prettyPath (std::string_view filePath, size_t maxDepth=3) |
| Get a pretty version of the path from the source location. | |
| 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. | |
| ripple::uint256 | sha256sum (std::string_view s) |
| Calculates the SHA256 sum of a string. | |
| std::string | sha256sumString (std::string_view s) |
| Calculates the SHA256 sum of a string and returns it as a hex string. | |
| template<typename Ctx, typename F> requires std::is_invocable_r_v<void, F, boost::asio::yield_context> | |
| void | spawn (Ctx &&ctx, F &&func) |
| Spawns a coroutine using boost::asio::spawn. | |
| 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::string | systemTpToUtcStr (std::chrono::system_clock::time_point const &tp, std::string const &format) |
| Converts a system_clock time_point to a formatted UTC string. | |
| 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. | |
This namespace contains various utilities.
|
static |
Initializes console logging.
| logToConsole | A boolean indicating whether to log to console. |
| format | A string representing the log format. |
|
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 |
Gets the minimum severity levels for each log channel from the configuration.
| config | The configuration object containing log settings. |
| defaultSeverity | The default severity level to use if not overridden. |
|
static |
|
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 |
| Type util::integralValueAs | ( | boost::json::value const & | value | ) |
Detects the type of number stored in value and casts it back to the requested Type.
| Type | The type to cast to |
| value | The JSON value to cast |
| logic_error | if the underlying number is neither int64 nor uint64 |
| 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 |
| 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. |
|
nodiscard |
Get a pretty version of the path from the source location.
This will return the file path up to maxDepth parent directories.
| filePath | The source file path |
| maxDepth | The maximum depth of directories to include |
|
inline |
Removes any detected secret information from a response JSON object.
| object | The JSON object to remove secrets from |
| ripple::uint256 util::sha256sum | ( | std::string_view | s | ) |
Calculates the SHA256 sum of a string.
| s | The string to hash. |
| std::string util::sha256sumString | ( | std::string_view | s | ) |
Calculates the SHA256 sum of a string and returns it as a hex string.
| s | The string to hash. |
| void util::spawn | ( | Ctx && | ctx, |
| F && | func ) |
Spawns a coroutine using boost::asio::spawn.
| Ctx | The type of the context/strand |
| F | The type of the function to execute |
| ctx | The execution context |
| func | The function to execute. Must return void |
|
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 |
Converts a system_clock time_point to a formatted UTC string.
| tp | The time_point to convert. Must be a valid std::chrono::system_clock::time_point. |
| format | The format string that specifies the desired output format. |
|
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. |