rippled
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ripple::NodeStore::DatabaseShard_test Class Reference
Inheritance diagram for ripple::NodeStore::DatabaseShard_test:
Inheritance graph
[legend]
Collaboration diagram for ripple::NodeStore::DatabaseShard_test:
Collaboration graph
[legend]

Classes

struct  TestData
 

Public Member Functions

 DatabaseShard_test ()
 
void run () override
 
void storeBatch (Backend &backend, Batch const &batch)
 
void fetchCopyOfBatch (Backend &backend, Batch *pCopy, Batch const &batch)
 
void fetchMissing (Backend &backend, Batch const &batch)
 

Static Public Member Functions

static Batch createPredictableBatch (int numObjects, std::uint64_t seed)
 
static bool areBatchesEqual (Batch const &lhs, Batch const &rhs)
 
static void storeBatch (Database &db, Batch const &batch)
 
static void fetchCopyOfBatch (Database &db, Batch *pCopy, Batch const &batch)
 

Static Public Attributes

static const std::size_t minPayloadBytes = 1
 
static const std::size_t maxPayloadBytes = 2000
 
static const int numObjectsToTest = 2000
 

Private Member Functions

void testLedgerData (TestData &data, std::shared_ptr< Ledger > ledger, std::uint32_t seq)
 
bool saveLedger (Database &db, Ledger const &ledger, std::shared_ptr< Ledger const > const &next={})
 
void checkLedger (TestData &data, DatabaseShard &db, Ledger const &ledger)
 
std::string bitmask2Rangeset (std::uint64_t bitmask)
 
std::unique_ptr< ConfigtestConfig (std::string const &shardDir, std::string const &nodeDir=std::string())
 
std::optional< std::uint32_twaitShard (DatabaseShard &shardStore, std::uint32_t shardIndex, std::chrono::seconds timeout=shardStoreTimeout)
 
std::optional< std::uint32_tcreateShard (TestData &data, DatabaseShard &shardStore, int maxShardIndex=1, int shardOffset=0)
 
void testStandalone ()
 
void testCreateShard (std::uint64_t const seedValue)
 
void testReopenDatabase (std::uint64_t const seedValue)
 
void testGetFinalShards (std::uint64_t const seedValue)
 
void testPrepareShards (std::uint64_t const seedValue)
 
void testImportShard (std::uint64_t const seedValue)
 
void testCorruptedDatabase (std::uint64_t const seedValue)
 
void testIllegalFinalKey (std::uint64_t const seedValue)
 
std::string ripemd160File (std::string filename)
 
void testDeterministicShard (std::uint64_t const seedValue)
 
void testImportNodeStore (std::uint64_t const seedValue)
 
void testImportWithOnlineDelete (std::uint64_t const seedValue)
 
void testImportWithHistoricalPaths (std::uint64_t const seedValue)
 
void testPrepareWithHistoricalPaths (std::uint64_t const seedValue)
 
void testOpenShardManagement (std::uint64_t const seedValue)
 
void testShardInfo (std::uint64_t const seedValue)
 
void testSQLiteDatabase (std::uint64_t const seedValue)
 

Private Attributes

test::SuiteJournal journal_
 
beast::temp_dir defNodeDir
 

Static Private Attributes

static constexpr std::uint32_t maxSizeGb = 10
 
static constexpr std::uint32_t maxHistoricalShards = 100
 
static constexpr std::uint32_t ledgersPerShard = 256
 
static constexpr std::uint32_t earliestSeq = ledgersPerShard + 1
 
static constexpr std::uint32_t dataSizeMax = 4
 
static constexpr std::uint32_t iniAmount = 1000000
 
static constexpr std::uint32_t nTestShards = 4
 
static constexpr std::chrono::seconds shardStoreTimeout
 

Detailed Description

Definition at line 168 of file DatabaseShard_test.cpp.

Constructor & Destructor Documentation

◆ DatabaseShard_test()

ripple::NodeStore::DatabaseShard_test::DatabaseShard_test ( )

Definition at line 1859 of file DatabaseShard_test.cpp.

Member Function Documentation

◆ testLedgerData()

void ripple::NodeStore::DatabaseShard_test::testLedgerData ( TestData data,
std::shared_ptr< Ledger ledger,
std::uint32_t  seq 
)
private

Definition at line 318 of file DatabaseShard_test.cpp.

◆ saveLedger()

bool ripple::NodeStore::DatabaseShard_test::saveLedger ( Database db,
Ledger const &  ledger,
std::shared_ptr< Ledger const > const &  next = {} 
)
private

Definition at line 402 of file DatabaseShard_test.cpp.

◆ checkLedger()

void ripple::NodeStore::DatabaseShard_test::checkLedger ( TestData data,
DatabaseShard db,
Ledger const &  ledger 
)
private

Definition at line 470 of file DatabaseShard_test.cpp.

◆ bitmask2Rangeset()

std::string ripple::NodeStore::DatabaseShard_test::bitmask2Rangeset ( std::uint64_t  bitmask)
private

Definition at line 540 of file DatabaseShard_test.cpp.

◆ testConfig()

std::unique_ptr<Config> ripple::NodeStore::DatabaseShard_test::testConfig ( std::string const &  shardDir,
std::string const &  nodeDir = std::string() 
)
private

Definition at line 564 of file DatabaseShard_test.cpp.

◆ waitShard()

std::optional<std::uint32_t> ripple::NodeStore::DatabaseShard_test::waitShard ( DatabaseShard shardStore,
std::uint32_t  shardIndex,
std::chrono::seconds  timeout = shardStoreTimeout 
)
private

Definition at line 604 of file DatabaseShard_test.cpp.

◆ createShard()

std::optional<std::uint32_t> ripple::NodeStore::DatabaseShard_test::createShard ( TestData data,
DatabaseShard shardStore,
int  maxShardIndex = 1,
int  shardOffset = 0 
)
private

Definition at line 623 of file DatabaseShard_test.cpp.

◆ testStandalone()

void ripple::NodeStore::DatabaseShard_test::testStandalone ( )
private

Definition at line 663 of file DatabaseShard_test.cpp.

◆ testCreateShard()

void ripple::NodeStore::DatabaseShard_test::testCreateShard ( std::uint64_t const  seedValue)
private

Definition at line 713 of file DatabaseShard_test.cpp.

◆ testReopenDatabase()

void ripple::NodeStore::DatabaseShard_test::testReopenDatabase ( std::uint64_t const  seedValue)
private

Definition at line 736 of file DatabaseShard_test.cpp.

◆ testGetFinalShards()

void ripple::NodeStore::DatabaseShard_test::testGetFinalShards ( std::uint64_t const  seedValue)
private

Definition at line 776 of file DatabaseShard_test.cpp.

◆ testPrepareShards()

void ripple::NodeStore::DatabaseShard_test::testPrepareShards ( std::uint64_t const  seedValue)
private

Definition at line 809 of file DatabaseShard_test.cpp.

◆ testImportShard()

void ripple::NodeStore::DatabaseShard_test::testImportShard ( std::uint64_t const  seedValue)
private

Definition at line 884 of file DatabaseShard_test.cpp.

◆ testCorruptedDatabase()

void ripple::NodeStore::DatabaseShard_test::testCorruptedDatabase ( std::uint64_t const  seedValue)
private

Definition at line 945 of file DatabaseShard_test.cpp.

◆ testIllegalFinalKey()

void ripple::NodeStore::DatabaseShard_test::testIllegalFinalKey ( std::uint64_t const  seedValue)
private

Definition at line 1000 of file DatabaseShard_test.cpp.

◆ ripemd160File()

std::string ripple::NodeStore::DatabaseShard_test::ripemd160File ( std::string  filename)
private

Definition at line 1099 of file DatabaseShard_test.cpp.

◆ testDeterministicShard()

void ripple::NodeStore::DatabaseShard_test::testDeterministicShard ( std::uint64_t const  seedValue)
private

Definition at line 1121 of file DatabaseShard_test.cpp.

◆ testImportNodeStore()

void ripple::NodeStore::DatabaseShard_test::testImportNodeStore ( std::uint64_t const  seedValue)
private

Definition at line 1175 of file DatabaseShard_test.cpp.

◆ testImportWithOnlineDelete()

void ripple::NodeStore::DatabaseShard_test::testImportWithOnlineDelete ( std::uint64_t const  seedValue)
private

Definition at line 1227 of file DatabaseShard_test.cpp.

◆ testImportWithHistoricalPaths()

void ripple::NodeStore::DatabaseShard_test::testImportWithHistoricalPaths ( std::uint64_t const  seedValue)
private

Definition at line 1334 of file DatabaseShard_test.cpp.

◆ testPrepareWithHistoricalPaths()

void ripple::NodeStore::DatabaseShard_test::testPrepareWithHistoricalPaths ( std::uint64_t const  seedValue)
private

Definition at line 1464 of file DatabaseShard_test.cpp.

◆ testOpenShardManagement()

void ripple::NodeStore::DatabaseShard_test::testOpenShardManagement ( std::uint64_t const  seedValue)
private

Definition at line 1582 of file DatabaseShard_test.cpp.

◆ testShardInfo()

void ripple::NodeStore::DatabaseShard_test::testShardInfo ( std::uint64_t const  seedValue)
private

Definition at line 1634 of file DatabaseShard_test.cpp.

◆ testSQLiteDatabase()

void ripple::NodeStore::DatabaseShard_test::testSQLiteDatabase ( std::uint64_t const  seedValue)
private

Definition at line 1765 of file DatabaseShard_test.cpp.

◆ run()

void ripple::NodeStore::DatabaseShard_test::run ( )
override

Definition at line 1864 of file DatabaseShard_test.cpp.

◆ createPredictableBatch()

static Batch ripple::NodeStore::TestBase::createPredictableBatch ( int  numObjects,
std::uint64_t  seed 
)
staticinherited

Definition at line 80 of file TestBase.h.

◆ areBatchesEqual()

static bool ripple::NodeStore::TestBase::areBatchesEqual ( Batch const &  lhs,
Batch const &  rhs 
)
staticinherited

Definition at line 120 of file TestBase.h.

◆ storeBatch() [1/2]

void ripple::NodeStore::TestBase::storeBatch ( Backend backend,
Batch const &  batch 
)
inherited

Definition at line 145 of file TestBase.h.

◆ storeBatch() [2/2]

static void ripple::NodeStore::TestBase::storeBatch ( Database db,
Batch const &  batch 
)
staticinherited

Definition at line 194 of file TestBase.h.

◆ fetchCopyOfBatch() [1/2]

void ripple::NodeStore::TestBase::fetchCopyOfBatch ( Backend backend,
Batch pCopy,
Batch const &  batch 
)
inherited

Definition at line 155 of file TestBase.h.

◆ fetchCopyOfBatch() [2/2]

static void ripple::NodeStore::TestBase::fetchCopyOfBatch ( Database db,
Batch pCopy,
Batch const &  batch 
)
staticinherited

Definition at line 212 of file TestBase.h.

◆ fetchMissing()

void ripple::NodeStore::TestBase::fetchMissing ( Backend backend,
Batch const &  batch 
)
inherited

Definition at line 179 of file TestBase.h.

Member Data Documentation

◆ maxSizeGb

constexpr std::uint32_t ripple::NodeStore::DatabaseShard_test::maxSizeGb = 10
staticconstexprprivate

Definition at line 170 of file DatabaseShard_test.cpp.

◆ maxHistoricalShards

constexpr std::uint32_t ripple::NodeStore::DatabaseShard_test::maxHistoricalShards = 100
staticconstexprprivate

Definition at line 171 of file DatabaseShard_test.cpp.

◆ ledgersPerShard

constexpr std::uint32_t ripple::NodeStore::DatabaseShard_test::ledgersPerShard = 256
staticconstexprprivate

Definition at line 172 of file DatabaseShard_test.cpp.

◆ earliestSeq

constexpr std::uint32_t ripple::NodeStore::DatabaseShard_test::earliestSeq = ledgersPerShard + 1
staticconstexprprivate

Definition at line 173 of file DatabaseShard_test.cpp.

◆ dataSizeMax

constexpr std::uint32_t ripple::NodeStore::DatabaseShard_test::dataSizeMax = 4
staticconstexprprivate

Definition at line 174 of file DatabaseShard_test.cpp.

◆ iniAmount

constexpr std::uint32_t ripple::NodeStore::DatabaseShard_test::iniAmount = 1000000
staticconstexprprivate

Definition at line 175 of file DatabaseShard_test.cpp.

◆ nTestShards

constexpr std::uint32_t ripple::NodeStore::DatabaseShard_test::nTestShards = 4
staticconstexprprivate

Definition at line 176 of file DatabaseShard_test.cpp.

◆ shardStoreTimeout

constexpr std::chrono::seconds ripple::NodeStore::DatabaseShard_test::shardStoreTimeout
staticconstexprprivate
Initial value:

Definition at line 177 of file DatabaseShard_test.cpp.

◆ journal_

test::SuiteJournal ripple::NodeStore::DatabaseShard_test::journal_
private

Definition at line 179 of file DatabaseShard_test.cpp.

◆ defNodeDir

beast::temp_dir ripple::NodeStore::DatabaseShard_test::defNodeDir
private

Definition at line 180 of file DatabaseShard_test.cpp.

◆ minPayloadBytes

const std::size_t ripple::NodeStore::TestBase::minPayloadBytes = 1
staticinherited

Definition at line 73 of file TestBase.h.

◆ maxPayloadBytes

const std::size_t ripple::NodeStore::TestBase::maxPayloadBytes = 2000
staticinherited

Definition at line 74 of file TestBase.h.

◆ numObjectsToTest

const int ripple::NodeStore::TestBase::numObjectsToTest = 2000
staticinherited

Definition at line 75 of file TestBase.h.

std::chrono::seconds