Redesign stoppable object pattern

This commit is contained in:
John Freeman
2021-05-26 17:45:41 -05:00
committed by manojsdoshi
parent c10c0be11b
commit a2a37a928a
92 changed files with 781 additions and 2460 deletions

View File

@@ -450,7 +450,6 @@ public:
std::int64_t seedValue)
{
DummyScheduler scheduler;
RootStoppable parent("TestRootStoppable");
beast::temp_dir node_db;
Section srcParams;
@@ -463,13 +462,7 @@ public:
// Write to source db
{
std::unique_ptr<Database> src = Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
srcParams,
journal_);
megabytes(4), scheduler, 2, srcParams, journal_);
storeBatch(*src, batch);
}
@@ -478,13 +471,7 @@ public:
{
// Re-open the db
std::unique_ptr<Database> src = Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
srcParams,
journal_);
megabytes(4), scheduler, 2, srcParams, journal_);
// Set up the destination database
beast::temp_dir dest_db;
@@ -493,13 +480,7 @@ public:
destParams.set("path", dest_db.path());
std::unique_ptr<Database> dest = Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
destParams,
journal_);
megabytes(4), scheduler, 2, destParams, journal_);
testcase(
"import into '" + destBackendType + "' from '" +
@@ -528,7 +509,6 @@ public:
int numObjsToTest = 2000)
{
DummyScheduler scheduler;
RootStoppable parent("TestRootStoppable");
std::string s = "NodeStore backend '" + type + "'";
@@ -547,13 +527,7 @@ public:
{
// Open the database
std::unique_ptr<Database> db = Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
nodeParams,
journal_);
megabytes(4), scheduler, 2, nodeParams, journal_);
// Write the batch
storeBatch(*db, batch);
@@ -578,13 +552,7 @@ public:
{
// Re-open the database without the ephemeral DB
std::unique_ptr<Database> db = Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
nodeParams,
journal_);
megabytes(4), scheduler, 2, nodeParams, journal_);
// Read it back in
Batch copy;
@@ -603,13 +571,7 @@ public:
// Verify default earliest ledger sequence
std::unique_ptr<Database> db =
Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
nodeParams,
journal_);
megabytes(4), scheduler, 2, nodeParams, journal_);
BEAST_EXPECT(
db->earliestLedgerSeq() == XRP_LEDGER_EARLIEST_SEQ);
}
@@ -620,13 +582,7 @@ public:
nodeParams.set("earliest_seq", "0");
std::unique_ptr<Database> db =
Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
nodeParams,
journal_);
megabytes(4), scheduler, 2, nodeParams, journal_);
}
catch (std::runtime_error const& e)
{
@@ -639,13 +595,7 @@ public:
nodeParams.set("earliest_seq", "1");
std::unique_ptr<Database> db =
Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
nodeParams,
journal_);
megabytes(4), scheduler, 2, nodeParams, journal_);
// Verify database uses the earliest ledger sequence setting
BEAST_EXPECT(db->earliestLedgerSeq() == 1);
@@ -659,13 +609,7 @@ public:
"earliest_seq", std::to_string(XRP_LEDGER_EARLIEST_SEQ));
std::unique_ptr<Database> db2 =
Manager::instance().make_Database(
"test",
megabytes(4),
scheduler,
2,
parent,
nodeParams,
journal_);
megabytes(4), scheduler, 2, nodeParams, journal_);
}
catch (std::runtime_error const& e)
{