Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
data Namespace Reference

This namespace implements the data access layer and related components. More...

Namespaces

namespace  cassandra
 This namespace implements a wrapper for the Cassandra C++ driver.

Classes

struct  Amendments
 List of supported amendments. More...
class  AmendmentCenter
 Knowledge center for amendments within XRPL. More...
class  AmendmentCenterInterface
 The interface of an amendment center. More...
class  BackendCounters
 Holds statistics about the backend. More...
class  DatabaseError
 Represents a transient database error that the caller should retry. More...
class  BackendInterface
 The interface to the database used by Clio. More...
class  LedgerCache
 Cache for an entire ledger. More...
class  LedgerCacheInterface
 Cache for an entire ledger. More...
class  LedgerCacheLoadingStateInterface
 Interface for coordinating cache loading permissions across a cluster. More...
class  LedgerCacheLoadingState
 Concrete implementation of LedgerCacheLoadingStateInterface. More...
class  LedgerCacheSaver
 Manages asynchronous saving of ledger cache to a file. More...
class  FetchLedgerCache
 A simple cache holding one xrpl::LedgerHeader to reduce DB lookups. More...
struct  LedgerObject
 Represents an object in the ledger. More...
struct  LedgerPage
 Represents a page of LedgerObjects. More...
struct  BookOffersPage
 Represents a page of book offer objects. More...
 Represents a transaction and its metadata bundled together. More...
struct  TransactionsCursor
 Represents a cursor into the transactions table. More...
struct  TransactionsAndCursor
 Represests a bundle of transactions with metadata and a cursor to the next page. More...
struct  NFT
 Represents a NFToken. More...
struct  NFTsAndCursor
 Represents a bundle of NFTs with a cursor to the next page. More...
struct  MPTHoldersAndCursor
 Represents an array of MPTokens. More...
struct  LedgerRange
 Stores a range of sequences as a min and max pair. More...
struct  Amendment
 Represents an amendment in the XRPL. More...
struct  AmendmentKey
 A helper for amendment name to feature conversions. More...

Concepts

concept  SomeBackendCounters
 A concept for a class that can be used to count backend operations.
concept  SomeLedgerCacheSaver
 A concept for a class that can save ledger cache asynchronously.

Typedefs

using Blob = std::vector<unsigned char>

Functions

std::shared_ptr< BackendInterfacemakeBackend (util::config::ClioConfigDefinition const &config, data::LedgerCacheInterface &cache)
 A factory function that creates the backend based on a config.
template<typename FnType>
auto retryOnTimeout (FnType func, boost::asio::yield_context yield, util::Retry::Delays delays=kDefaultRetryDelays)
 Retry func while it throws DatabaseError, suspending the calling coroutine in between.
template<typename FnType>
auto retryOnTimeout (FnType func, util::Retry::Delays delays=kDefaultRetryDelays)
 Retry func while it throws DatabaseError, blocking the calling thread in between.
template<typename FnType>
auto synchronous (FnType &&func)
 Synchronously executes the given function object inside a coroutine.
template<typename FnType>
auto synchronousAndRetryOnTimeout (FnType &&func, util::Retry::Delays delays=kDefaultRetryDelays)
 Synchronously execute the given function object and retry until no DatabaseError is thrown.

Variables

static constexpr std::chrono::milliseconds kDefaultWaitBetweenRetry {500}
 Delay before the first retry in retryOnTimeout().
static constexpr std::chrono::milliseconds kMaxWaitBetweenRetry {5'000}
 Default upper bound for the exponential backoff in retryOnTimeout().
static constexpr util::Retry::Delays kDefaultRetryDelays
 Default delays for retryOnTimeout().
constexpr xrpl::uint256 kFirstKey
constexpr xrpl::uint256 kLastKey
constexpr xrpl::uint256 kHi192 {"0000000000000000000000000000000000000000000000001111111111111111"}

Detailed Description

This namespace implements the data access layer and related components.

The data layer is responsible for fetching and storing data from the database. Cassandra and ScyllaDB are currently supported via the CassandraBackend implementation.

Function Documentation

◆ makeBackend()

std::shared_ptr< BackendInterface > data::makeBackend ( util::config::ClioConfigDefinition const & config,
data::LedgerCacheInterface & cache )
inline

A factory function that creates the backend based on a config.

Parameters
configThe clio config to use
cacheThe ledger cache to use
Returns
A shared_ptr<BackendInterface> with the selected implementation

◆ retryOnTimeout() [1/2]

template<typename FnType>
auto data::retryOnTimeout ( FnType func,
boost::asio::yield_context yield,
util::Retry::Delays delays = kDefaultRetryDelays )

Retry func while it throws DatabaseError, suspending the calling coroutine in between.

Template Parameters
FnTypeThe type of function object to execute
Parameters
funcThe function object to execute
yieldThe coroutine to suspend between attempts
delaysThe delays to use between attempts
Returns
The same as the return type of func

◆ retryOnTimeout() [2/2]

template<typename FnType>
auto data::retryOnTimeout ( FnType func,
util::Retry::Delays delays = kDefaultRetryDelays )

Retry func while it throws DatabaseError, blocking the calling thread in between.

Warning
Blocks the calling thread; from a coroutine use the yield_context overload instead.
Template Parameters
FnTypeThe type of function object to execute
Parameters
funcThe function object to execute
delaysThe delays to use between attempts
Returns
The same as the return type of func

◆ synchronous()

template<typename FnType>
auto data::synchronous ( FnType && func)

Synchronously executes the given function object inside a coroutine.

Template Parameters
FnTypeThe type of function object to execute
Parameters
funcThe function object to execute
Returns
The same as the return type of func

◆ synchronousAndRetryOnTimeout()

template<typename FnType>
auto data::synchronousAndRetryOnTimeout ( FnType && func,
util::Retry::Delays delays = kDefaultRetryDelays )

Synchronously execute the given function object and retry until no DatabaseError is thrown.

Warning
Blocks the calling thread while backing off.
Template Parameters
FnTypeThe type of function object to execute
Parameters
funcThe function object to execute
delaysThe delays to use between attempts
Returns
The same as the return type of func

Variable Documentation

◆ kDefaultRetryDelays

util::Retry::Delays data::kDefaultRetryDelays
staticconstexpr
Initial value:
{
}
static constexpr std::chrono::milliseconds kDefaultWaitBetweenRetry
Delay before the first retry in retryOnTimeout().
Definition BackendInterface.hpp:69

Default delays for retryOnTimeout().

◆ kFirstKey

xrpl::uint256 data::kFirstKey
constexpr
Initial value:
{
"0000000000000000000000000000000000000000000000000000000000000000"
}

◆ kLastKey

xrpl::uint256 data::kLastKey
constexpr
Initial value:
{
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
}