rippled
Loading...
Searching...
No Matches
NodeStoreScheduler.cpp
1#include <xrpld/app/main/NodeStoreScheduler.h>
2
3namespace xrpl {
4
5NodeStoreScheduler::NodeStoreScheduler(JobQueue& jobQueue) : jobQueue_(jobQueue)
6{
7}
8
9void
11{
12 if (jobQueue_.isStopped())
13 return;
14
15 if (!jobQueue_.addJob(jtWRITE, "NObjStore", [&task]() { task.performScheduledTask(); }))
16 {
17 // Job not added, presumably because we're shutting down.
18 // Recover by executing the task synchronously.
20 }
21}
22
23void
32
33void
41
42} // namespace xrpl
A pool of threads to perform work.
Definition JobQueue.h:37
bool isStopped() const
Definition JobQueue.cpp:271
bool addJob(JobType type, std::string const &name, JobHandler &&jobHandler)
Adds a job to the JobQueue.
Definition JobQueue.h:145
void addLoadEvents(JobType t, int count, std::chrono::milliseconds elapsed)
Add multiple load events.
Definition JobQueue.cpp:155
NodeStoreScheduler(JobQueue &jobQueue)
void onBatchWrite(NodeStore::BatchWriteReport const &report) override
Reports the completion of a batch write Allows the scheduler to monitor the node store's performance.
void scheduleTask(NodeStore::Task &task) override
Schedules a task.
void onFetch(NodeStore::FetchReport const &report) override
Reports completion of a fetch Allows the scheduler to monitor the node store's performance.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
@ jtNS_SYNC_READ
Definition Job.h:69
@ jtWRITE
Definition Job.h:51
@ jtNS_ASYNC_READ
Definition Job.h:70
@ jtNS_WRITE
Definition Job.h:71
Contains information about a batch write operation.
Contains information about a fetch operation.
Derived classes perform scheduled tasks.
Definition Task.h:8
virtual void performScheduledTask()=0
Performs the task.