mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-22 23:00:55 +00:00
This change renames all occurrences of `namespace ripple` and `ripple::` to `namespace xrpl` and `xrpl::`, respectively, as well as the names of test suites. It also provides a script to allow developers to replicate the changes in their local branch or fork to avoid conflicts.
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include <xrpld/app/main/NodeStoreScheduler.h>
|
|
|
|
namespace xrpl {
|
|
|
|
NodeStoreScheduler::NodeStoreScheduler(JobQueue& jobQueue) : jobQueue_(jobQueue)
|
|
{
|
|
}
|
|
|
|
void
|
|
NodeStoreScheduler::scheduleTask(NodeStore::Task& task)
|
|
{
|
|
if (jobQueue_.isStopped())
|
|
return;
|
|
|
|
if (!jobQueue_.addJob(jtWRITE, "NodeObject::store", [&task]() {
|
|
task.performScheduledTask();
|
|
}))
|
|
{
|
|
// Job not added, presumably because we're shutting down.
|
|
// Recover by executing the task synchronously.
|
|
task.performScheduledTask();
|
|
}
|
|
}
|
|
|
|
void
|
|
NodeStoreScheduler::onFetch(NodeStore::FetchReport const& report)
|
|
{
|
|
if (jobQueue_.isStopped())
|
|
return;
|
|
|
|
jobQueue_.addLoadEvents(
|
|
report.fetchType == NodeStore::FetchType::async ? jtNS_ASYNC_READ
|
|
: jtNS_SYNC_READ,
|
|
1,
|
|
report.elapsed);
|
|
}
|
|
|
|
void
|
|
NodeStoreScheduler::onBatchWrite(NodeStore::BatchWriteReport const& report)
|
|
{
|
|
if (jobQueue_.isStopped())
|
|
return;
|
|
|
|
jobQueue_.addLoadEvents(jtNS_WRITE, report.writeCount, report.elapsed);
|
|
}
|
|
|
|
} // namespace xrpl
|