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 &testName, std::string const &backendType, std::string const &shardDir, std::string const &nodeDir=std::string())
 
std::optional< int > waitShard (DatabaseShard &db, int shardNumber, std::chrono::seconds timeout=shardStoreTimeout)
 
std::optional< int > createShard (TestData &data, DatabaseShard &db, int maxShardNumber)
 
void testStandalone (std::string const &backendType)
 
void testCreateShard (std::string const &backendType, std::uint64_t const seedValue)
 
void testReopenDatabase (std::string const &backendType, std::uint64_t const seedValue)
 
void testGetCompleteShards (std::string const &backendType, std::uint64_t const seedValue)
 
void testPrepareShard (std::string const &backendType, std::uint64_t const seedValue)
 
void testImportShard (std::string const &backendType, std::uint64_t const seedValue)
 
void testCorruptedDatabase (std::string const &backendType, std::uint64_t const seedValue)
 
void testIllegalFinalKey (std::string const &backendType, std::uint64_t const seedValue)
 
void testImport (std::string const &backendType, std::uint64_t const seedValue)
 
void testAll (std::string const &backendType)
 

Private Attributes

test::SuiteJournal journal_
 
beast::temp_dir defNodeDir
 

Static Private Attributes

static constexpr std::uint32_t maxSizeGb = 10
 
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 39 of file DatabaseShard_test.cpp.

Constructor & Destructor Documentation

◆ DatabaseShard_test()

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

Definition at line 997 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 179 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 263 of file DatabaseShard_test.cpp.

◆ checkLedger()

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

Definition at line 333 of file DatabaseShard_test.cpp.

◆ bitmask2Rangeset()

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

Definition at line 405 of file DatabaseShard_test.cpp.

◆ testConfig()

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

Definition at line 429 of file DatabaseShard_test.cpp.

◆ waitShard()

std::optional<int> ripple::NodeStore::DatabaseShard_test::waitShard ( DatabaseShard db,
int  shardNumber,
std::chrono::seconds  timeout = shardStoreTimeout 
)
private

Definition at line 478 of file DatabaseShard_test.cpp.

◆ createShard()

std::optional<int> ripple::NodeStore::DatabaseShard_test::createShard ( TestData data,
DatabaseShard db,
int  maxShardNumber 
)
private

Definition at line 498 of file DatabaseShard_test.cpp.

◆ testStandalone()

void ripple::NodeStore::DatabaseShard_test::testStandalone ( std::string const &  backendType)
private

Definition at line 529 of file DatabaseShard_test.cpp.

◆ testCreateShard()

void ripple::NodeStore::DatabaseShard_test::testCreateShard ( std::string const &  backendType,
std::uint64_t const  seedValue 
)
private

Definition at line 556 of file DatabaseShard_test.cpp.

◆ testReopenDatabase()

void ripple::NodeStore::DatabaseShard_test::testReopenDatabase ( std::string const &  backendType,
std::uint64_t const  seedValue 
)
private

Definition at line 579 of file DatabaseShard_test.cpp.

◆ testGetCompleteShards()

void ripple::NodeStore::DatabaseShard_test::testGetCompleteShards ( std::string const &  backendType,
std::uint64_t const  seedValue 
)
private

Definition at line 619 of file DatabaseShard_test.cpp.

◆ testPrepareShard()

void ripple::NodeStore::DatabaseShard_test::testPrepareShard ( std::string const &  backendType,
std::uint64_t const  seedValue 
)
private

Definition at line 651 of file DatabaseShard_test.cpp.

◆ testImportShard()

void ripple::NodeStore::DatabaseShard_test::testImportShard ( std::string const &  backendType,
std::uint64_t const  seedValue 
)
private

Definition at line 720 of file DatabaseShard_test.cpp.

◆ testCorruptedDatabase()

void ripple::NodeStore::DatabaseShard_test::testCorruptedDatabase ( std::string const &  backendType,
std::uint64_t const  seedValue 
)
private

Definition at line 776 of file DatabaseShard_test.cpp.

◆ testIllegalFinalKey()

void ripple::NodeStore::DatabaseShard_test::testIllegalFinalKey ( std::string const &  backendType,
std::uint64_t const  seedValue 
)
private

Definition at line 833 of file DatabaseShard_test.cpp.

◆ testImport()

void ripple::NodeStore::DatabaseShard_test::testImport ( std::string const &  backendType,
std::uint64_t const  seedValue 
)
private

Definition at line 934 of file DatabaseShard_test.cpp.

◆ testAll()

void ripple::NodeStore::DatabaseShard_test::testAll ( std::string const &  backendType)
private

Definition at line 982 of file DatabaseShard_test.cpp.

◆ run()

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

Definition at line 1002 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 41 of file DatabaseShard_test.cpp.

◆ ledgersPerShard

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

Definition at line 42 of file DatabaseShard_test.cpp.

◆ earliestSeq

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

Definition at line 43 of file DatabaseShard_test.cpp.

◆ dataSizeMax

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

Definition at line 44 of file DatabaseShard_test.cpp.

◆ iniAmount

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

Definition at line 45 of file DatabaseShard_test.cpp.

◆ nTestShards

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

Definition at line 46 of file DatabaseShard_test.cpp.

◆ shardStoreTimeout

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

Definition at line 47 of file DatabaseShard_test.cpp.

◆ journal_

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

Definition at line 49 of file DatabaseShard_test.cpp.

◆ defNodeDir

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

Definition at line 50 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