xrpld
Loading...
Searching...
No Matches
xrpl::node_store Namespace Reference

Classes

class  Backend
 A backend used for the NodeStore. More...
class  Database
 Persistency layer for NodeObject. More...
class  DatabaseRotating
class  BatchWriter
 Batch-writing assist logic. More...
class  DatabaseNodeImp
class  DatabaseRotatingImp
class  DecodedBlob
 Parsed key/value blob into NodeObject components. More...
class  EncodedBlob
 Convert a NodeObject from in-memory to database format. More...
class  ManagerImp
struct  VarintTraits
struct  VarintTraits< T, true >
class  DummyScheduler
 Simple NodeStore Scheduler that just performs the tasks synchronously. More...
class  Factory
 Base class for backend factories. More...
class  Manager
 Singleton for managing NodeStore factories and back ends. More...
struct  FetchReport
 Contains information about a fetch operation. More...
struct  BatchWriteReport
 Contains information about a batch write operation. More...
class  Scheduler
 Scheduling for asynchronous backend activity. More...
struct  Task
 Derived classes perform scheduled tasks. More...
class  Sequence
 Deterministic generator of a reproducible sequence of random NodeObjects. More...
struct  BackendHarness
 RAII owner of a NodeStore Backend opened on a private temporary directory. More...
struct  DatabaseHarness
 RAII owner of a NodeStore Database - the application-facing wrapper around a Backend, which adds fetch/store accounting and the async read-thread pool. More...
struct  BackendConfig
struct  MemoryDB
class  MemoryFactory
class  MemoryBackend
class  NuDBBackend
class  NuDBFactory
class  NullBackend
class  NullFactory
class  DatabaseConfig_test
class  Progress
class  BackendTypeTest
class  NodeStoreDatabaseTestBase
class  NodeStoreDatabaseTest
class  NodeStoreDatabasePersistenceTest
class  DatabaseImportTest
struct  LessThan

Typedefs

using Batch = std::vector<std::shared_ptr<NodeObject>>
 A batch of NodeObjects to write at once.

Enumerations

enum class  FetchType { Synchronous , Async }
enum class  Status {
  Ok = 0 , NotFound = 1 , DataCorrupt = 2 , Unknown = 3 ,
  BackendError = 4 , CustomCode = 100
}
 Return codes from Backend operations. More...

Functions

template<class BufferFactory>
std::pair< void const *, std::size_tlz4Decompress (void const *in, std::size_t inSize, BufferFactory &&bf)
template<class BufferFactory>
std::pair< void const *, std::size_tlz4Compress (void const *in, std::size_t inSize, BufferFactory &&bf)
template<class BufferFactory>
std::pair< void const *, std::size_tnodeobjectDecompress (void const *in, std::size_t inSize, BufferFactory &&bf)
template<class = void>
void const * zero32 ()
template<class BufferFactory>
std::pair< void const *, std::size_tnodeobjectCompress (void const *in, std::size_t inSize, BufferFactory &&bf)
template<class = void>
void filterInner (void *in, std::size_t inSize)
template<class = void>
std::size_t readVarint (void const *buf, std::size_t buflen, std::size_t &t)
template<class T>
requires (std::is_unsigned_v<T>)
std::size_t sizeVarint (T v)
template<class = void>
std::size_t writeVarint (void *p0, std::size_t v)
template<class T>
requires (std::is_same_v<T, Varint>)
void read (nudb::detail::istream &is, std::size_t &u)
template<class T>
requires (std::is_same_v<T, Varint>)
void write (nudb::detail::ostream &os, std::size_t t)
template<class Generator>
void rngcpy (void *buffer, std::size_t bytes, Generator &g)
Section parseConfig (std::string const &s)
Batch makePool (std::uint8_t prefix, std::size_t count, std::size_t start=0)
std::vector< uint256makeMissingKeys (std::size_t count)
std::size_t averagePayload (Batch const &pool)
void prepopulate (Backend &backend, Batch const &objects)
std::vector< std::size_tmakeShuffle (std::size_t size, std::uint64_t seed)
std::vector< BatchsliceFixedBatches (Batch const &pool, std::size_t batchSize)
std::vector< BackendConfig > const & backendConfigs ()
void registerMemoryFactory (Manager &manager)
void registerNuDBFactory (Manager &manager)
void registerNullFactory (Manager &manager)
 BEAST_DEFINE_TESTSUITE (DatabaseConfig, nodestore, xrpl)
std::map< std::string, std::string, boost::beast::iless > parseArgs (std::string const &s)
 TEST_P (BackendTypeTest, store_and_fetch)
 TEST_P (BackendTypeTest, persists_after_reopen)
 TEST_P (BackendTypeTest, fetch_missing)
 TEST_P (BackendTypeTest, concurrent_store_and_fetch)
 INSTANTIATE_TEST_SUITE_P (BackendTypes, BackendTypeTest, ::testing::ValuesIn(backendTypes()), [](::testing::TestParamInfo< std::string > const &info) { return info.param;})
 TEST (NodeStoreBasics, predictable_batches)
 TEST (NodeStoreBasics, blob_encoding)
 TEST_P (NodeStoreDatabaseTest, store_and_fetch)
 TEST_P (NodeStoreDatabasePersistenceTest, round_trip)
 TEST_P (NodeStoreDatabaseTest, fetch_missing)
 INSTANTIATE_TEST_SUITE_P (NodeStoreBackends, NodeStoreDatabaseTest, ::testing::ValuesIn(allBackends()), [](::testing::TestParamInfo< std::string > const &info) { return info.param;})
 INSTANTIATE_TEST_SUITE_P (PersistentBackends, NodeStoreDatabasePersistenceTest, ::testing::ValuesIn(persistentBackends()), [](::testing::TestParamInfo< std::string > const &info) { return info.param;})
 TEST (NodeStoreDatabase, memory_earliest_seq)
 TEST_P (DatabaseImportTest, same_backend)
 INSTANTIATE_TEST_SUITE_P (ImportBackends, DatabaseImportTest, ::testing::ValuesIn(importBackends()), [](::testing::TestParamInfo< std::string > const &info) { return info.param;})
 TEST (NuDBFactory, default_block_size)
 TEST (NuDBFactory, valid_block_sizes)
 TEST (NuDBFactory, invalid_block_sizes)
 TEST (NuDBFactory, log_messages)
 TEST (NuDBFactory, power_of_two_validation)
 TEST (NuDBFactory, both_constructor_variants)
 TEST (NuDBFactory, configuration_parsing)
 TEST (NuDBFactory, data_persistence)
bool isSame (std::shared_ptr< NodeObject > const &lhs, std::shared_ptr< NodeObject > const &rhs)
Batch createPredictableBatch (std::size_t numObjects, std::uint64_t seed)
void storeBatch (Backend &backend, Batch const &batch)
Batch fetchCopyOfBatch (Backend &backend, Batch const &batch)
void fetchMissing (Backend &backend, Batch const &batch)
void storeBatch (Database &db, Batch const &batch)
Batch fetchCopyOfBatch (Database &db, Batch const &batch)
void fetchMissing (Database &db, Batch const &batch)

Variables

static constexpr auto kBatchWritePreallocationSize = 256
static constexpr auto kBatchWriteLimitSize = 65536
MemoryFactorygMemoryFactory = nullptr
constexpr std::size_t kMinPayloadBytes = 1
constexpr std::size_t kMaxPayloadBytes = 2000
constexpr int kNumObjectsToTest = 2000
constexpr int kNumObjects = 2000
constexpr std::uint64_t kSeedValue = 50

Typedef Documentation

◆ Batch

A batch of NodeObjects to write at once.

Definition at line 37 of file nodestore/Types.h.

Enumeration Type Documentation

◆ FetchType

enum class xrpl::node_store::FetchType
strong
Enumerator
Synchronous 
Async 

Definition at line 9 of file include/xrpl/nodestore/Scheduler.h.

◆ Status

enum class xrpl::node_store::Status
strong

Return codes from Backend operations.

Enumerator
Ok 
NotFound 
DataCorrupt 
Unknown 
BackendError 
CustomCode 

Definition at line 24 of file nodestore/Types.h.

Function Documentation

◆ lz4Decompress()

template<class BufferFactory>
std::pair< void const *, std::size_t > xrpl::node_store::lz4Decompress ( void const * in,
std::size_t inSize,
BufferFactory && bf )

Definition at line 28 of file codec.h.

◆ lz4Compress()

template<class BufferFactory>
std::pair< void const *, std::size_t > xrpl::node_store::lz4Compress ( void const * in,
std::size_t inSize,
BufferFactory && bf )

Definition at line 57 of file codec.h.

◆ nodeobjectDecompress()

template<class BufferFactory>
std::pair< void const *, std::size_t > xrpl::node_store::nodeobjectDecompress ( void const * in,
std::size_t inSize,
BufferFactory && bf )

Definition at line 89 of file codec.h.

◆ zero32()

template<class = void>
void const * xrpl::node_store::zero32 ( )

Definition at line 193 of file codec.h.

◆ nodeobjectCompress()

template<class BufferFactory>
std::pair< void const *, std::size_t > xrpl::node_store::nodeobjectCompress ( void const * in,
std::size_t inSize,
BufferFactory && bf )

Definition at line 201 of file codec.h.

◆ filterInner()

template<class = void>
void xrpl::node_store::filterInner ( void * in,
std::size_t inSize )

Definition at line 293 of file codec.h.

◆ readVarint()

template<class = void>
std::size_t xrpl::node_store::readVarint ( void const * buf,
std::size_t buflen,
std::size_t & t )

Definition at line 37 of file Varint.h.

◆ sizeVarint()

template<class T>
requires (std::is_unsigned_v<T>)
std::size_t xrpl::node_store::sizeVarint ( T v)

Definition at line 73 of file Varint.h.

◆ writeVarint()

template<class = void>
std::size_t xrpl::node_store::writeVarint ( void * p0,
std::size_t v )

Definition at line 87 of file Varint.h.

◆ read()

template<class T>
requires (std::is_same_v<T, Varint>)
void xrpl::node_store::read ( nudb::detail::istream & is,
std::size_t & u )

Definition at line 106 of file Varint.h.

◆ write()

template<class T>
requires (std::is_same_v<T, Varint>)
void xrpl::node_store::write ( nudb::detail::ostream & os,
std::size_t t )

Definition at line 120 of file Varint.h.

◆ rngcpy()

template<class Generator>
void xrpl::node_store::rngcpy ( void * buffer,
std::size_t bytes,
Generator & g )

Definition at line 41 of file NodeStoreBench.h.

◆ parseConfig()

Section xrpl::node_store::parseConfig ( std::string const & s)

Definition at line 127 of file NodeStoreBench.h.

◆ makePool()

Batch xrpl::node_store::makePool ( std::uint8_t prefix,
std::size_t count,
std::size_t start = 0 )

Definition at line 139 of file NodeStoreBench.h.

◆ makeMissingKeys()

std::vector< uint256 > xrpl::node_store::makeMissingKeys ( std::size_t count)

Definition at line 152 of file NodeStoreBench.h.

◆ averagePayload()

std::size_t xrpl::node_store::averagePayload ( Batch const & pool)

Definition at line 164 of file NodeStoreBench.h.

◆ prepopulate()

void xrpl::node_store::prepopulate ( Backend & backend,
Batch const & objects )

Definition at line 186 of file NodeStoreBench.h.

◆ makeShuffle()

std::vector< std::size_t > xrpl::node_store::makeShuffle ( std::size_t size,
std::uint64_t seed )

Definition at line 202 of file NodeStoreBench.h.

◆ sliceFixedBatches()

std::vector< Batch > xrpl::node_store::sliceFixedBatches ( Batch const & pool,
std::size_t batchSize )

Definition at line 214 of file NodeStoreBench.h.

◆ backendConfigs()

std::vector< BackendConfig > const & xrpl::node_store::backendConfigs ( )

Definition at line 298 of file NodeStoreBench.h.

◆ registerMemoryFactory()

void xrpl::node_store::registerMemoryFactory ( Manager & manager)

Definition at line 75 of file MemoryFactory.cpp.

◆ registerNuDBFactory()

void xrpl::node_store::registerNuDBFactory ( Manager & manager)

Definition at line 440 of file libxrpl/nodestore/backend/NuDBFactory.cpp.

◆ registerNullFactory()

void xrpl::node_store::registerNullFactory ( Manager & manager)

Definition at line 123 of file NullFactory.cpp.

◆ BEAST_DEFINE_TESTSUITE()

xrpl::node_store::BEAST_DEFINE_TESTSUITE ( DatabaseConfig ,
nodestore ,
xrpl  )

◆ parseArgs()

std::map< std::string, std::string, boost::beast::iless > xrpl::node_store::parseArgs ( std::string const & s)

Definition at line 258 of file import_test.cpp.

◆ TEST_P() [1/8]

xrpl::node_store::TEST_P ( BackendTypeTest ,
store_and_fetch  )

Definition at line 93 of file tests/libxrpl/nodestore/Backend.cpp.

◆ TEST_P() [2/8]

xrpl::node_store::TEST_P ( BackendTypeTest ,
persists_after_reopen  )

Definition at line 113 of file tests/libxrpl/nodestore/Backend.cpp.

◆ TEST_P() [3/8]

xrpl::node_store::TEST_P ( BackendTypeTest ,
fetch_missing  )

Definition at line 131 of file tests/libxrpl/nodestore/Backend.cpp.

◆ TEST_P() [4/8]

xrpl::node_store::TEST_P ( BackendTypeTest ,
concurrent_store_and_fetch  )

Definition at line 142 of file tests/libxrpl/nodestore/Backend.cpp.

◆ INSTANTIATE_TEST_SUITE_P() [1/4]

xrpl::node_store::INSTANTIATE_TEST_SUITE_P ( BackendTypes ,
BackendTypeTest ,
::testing::ValuesIn(backendTypes()) ,
[] (::testing::TestParamInfo< std::string > const &info) { return info.param;}  )

◆ TEST() [1/11]

xrpl::node_store::TEST ( NodeStoreBasics ,
predictable_batches  )

Definition at line 14 of file Basics.cpp.

◆ TEST() [2/11]

xrpl::node_store::TEST ( NodeStoreBasics ,
blob_encoding  )

Definition at line 24 of file Basics.cpp.

◆ TEST_P() [5/8]

xrpl::node_store::TEST_P ( NodeStoreDatabaseTest ,
store_and_fetch  )

Definition at line 98 of file tests/libxrpl/nodestore/Database.cpp.

◆ TEST_P() [6/8]

xrpl::node_store::TEST_P ( NodeStoreDatabasePersistenceTest ,
round_trip  )

Definition at line 119 of file tests/libxrpl/nodestore/Database.cpp.

◆ TEST_P() [7/8]

xrpl::node_store::TEST_P ( NodeStoreDatabaseTest ,
fetch_missing  )

Definition at line 137 of file tests/libxrpl/nodestore/Database.cpp.

◆ INSTANTIATE_TEST_SUITE_P() [2/4]

xrpl::node_store::INSTANTIATE_TEST_SUITE_P ( NodeStoreBackends ,
NodeStoreDatabaseTest ,
::testing::ValuesIn(allBackends()) ,
[] (::testing::TestParamInfo< std::string > const &info) { return info.param;}  )

◆ INSTANTIATE_TEST_SUITE_P() [3/4]

xrpl::node_store::INSTANTIATE_TEST_SUITE_P ( PersistentBackends ,
NodeStoreDatabasePersistenceTest ,
::testing::ValuesIn(persistentBackends()) ,
[] (::testing::TestParamInfo< std::string > const &info) { return info.param;}  )

◆ TEST() [3/11]

xrpl::node_store::TEST ( NodeStoreDatabase ,
memory_earliest_seq  )

Definition at line 157 of file tests/libxrpl/nodestore/Database.cpp.

◆ TEST_P() [8/8]

xrpl::node_store::TEST_P ( DatabaseImportTest ,
same_backend  )

Definition at line 200 of file tests/libxrpl/nodestore/Database.cpp.

◆ INSTANTIATE_TEST_SUITE_P() [4/4]

xrpl::node_store::INSTANTIATE_TEST_SUITE_P ( ImportBackends ,
DatabaseImportTest ,
::testing::ValuesIn(importBackends()) ,
[] (::testing::TestParamInfo< std::string > const &info) { return info.param;}  )

◆ TEST() [4/11]

xrpl::node_store::TEST ( NuDBFactory ,
default_block_size  )

Definition at line 59 of file tests/libxrpl/nodestore/NuDBFactory.cpp.

◆ TEST() [5/11]

xrpl::node_store::TEST ( NuDBFactory ,
valid_block_sizes  )

Definition at line 66 of file tests/libxrpl/nodestore/NuDBFactory.cpp.

◆ TEST() [6/11]

xrpl::node_store::TEST ( NuDBFactory ,
invalid_block_sizes  )

Definition at line 85 of file tests/libxrpl/nodestore/NuDBFactory.cpp.

◆ TEST() [7/11]

xrpl::node_store::TEST ( NuDBFactory ,
log_messages  )

Definition at line 120 of file tests/libxrpl/nodestore/NuDBFactory.cpp.

◆ TEST() [8/11]

xrpl::node_store::TEST ( NuDBFactory ,
power_of_two_validation  )

Definition at line 178 of file tests/libxrpl/nodestore/NuDBFactory.cpp.

◆ TEST() [9/11]

xrpl::node_store::TEST ( NuDBFactory ,
both_constructor_variants  )

Definition at line 217 of file tests/libxrpl/nodestore/NuDBFactory.cpp.

◆ TEST() [10/11]

xrpl::node_store::TEST ( NuDBFactory ,
configuration_parsing  )

Definition at line 234 of file tests/libxrpl/nodestore/NuDBFactory.cpp.

◆ TEST() [11/11]

xrpl::node_store::TEST ( NuDBFactory ,
data_persistence  )

Definition at line 262 of file tests/libxrpl/nodestore/NuDBFactory.cpp.

◆ isSame()

bool xrpl::node_store::isSame ( std::shared_ptr< NodeObject > const & lhs,
std::shared_ptr< NodeObject > const & rhs )
nodiscard

Definition at line 41 of file TestBase.h.

◆ createPredictableBatch()

Batch xrpl::node_store::createPredictableBatch ( std::size_t numObjects,
std::uint64_t seed )
nodiscard

Definition at line 48 of file TestBase.h.

◆ storeBatch() [1/2]

void xrpl::node_store::storeBatch ( Backend & backend,
Batch const & batch )

Definition at line 85 of file TestBase.h.

◆ fetchCopyOfBatch() [1/2]

Batch xrpl::node_store::fetchCopyOfBatch ( Backend & backend,
Batch const & batch )
nodiscard

Definition at line 92 of file TestBase.h.

◆ fetchMissing() [1/2]

void xrpl::node_store::fetchMissing ( Backend & backend,
Batch const & batch )

Definition at line 113 of file TestBase.h.

◆ storeBatch() [2/2]

void xrpl::node_store::storeBatch ( Database & db,
Batch const & batch )

Definition at line 125 of file TestBase.h.

◆ fetchCopyOfBatch() [2/2]

Batch xrpl::node_store::fetchCopyOfBatch ( Database & db,
Batch const & batch )
nodiscard

Definition at line 135 of file TestBase.h.

◆ fetchMissing() [2/2]

void xrpl::node_store::fetchMissing ( Database & db,
Batch const & batch )

Definition at line 150 of file TestBase.h.

Variable Documentation

◆ kBatchWritePreallocationSize

auto xrpl::node_store::kBatchWritePreallocationSize = 256
staticconstexpr

Definition at line 13 of file nodestore/Types.h.

◆ kBatchWriteLimitSize

auto xrpl::node_store::kBatchWriteLimitSize = 65536
staticconstexpr

Definition at line 19 of file nodestore/Types.h.

◆ gMemoryFactory

MemoryFactory* xrpl::node_store::gMemoryFactory = nullptr

Definition at line 72 of file MemoryFactory.cpp.

◆ kMinPayloadBytes

std::size_t xrpl::node_store::kMinPayloadBytes = 1
constexpr

Definition at line 24 of file TestBase.h.

◆ kMaxPayloadBytes

std::size_t xrpl::node_store::kMaxPayloadBytes = 2000
constexpr

Definition at line 25 of file TestBase.h.

◆ kNumObjectsToTest

int xrpl::node_store::kNumObjectsToTest = 2000
constexpr

Definition at line 26 of file TestBase.h.

◆ kNumObjects

int xrpl::node_store::kNumObjects = 2000
constexpr

Definition at line 27 of file TestBase.h.

◆ kSeedValue

std::uint64_t xrpl::node_store::kSeedValue = 50
constexpr

Definition at line 28 of file TestBase.h.