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(
16 jtWRITE, "NObjStore", [&task]() { task.performScheduledTask(); }))
17 {
18 // Job not added, presumably because we're shutting down.
19 // Recover by executing the task synchronously.
21 }
22}
23
24void
36
37void
45
46} // namespace xrpl
A pool of threads to perform work.
Definition JobQueue.h:38
bool isStopped() const
Definition JobQueue.cpp:301
bool addJob(JobType type, std::string const &name, JobHandler &&jobHandler)
Adds a job to the JobQueue.
Definition JobQueue.h:148
void addLoadEvents(JobType t, int count, std::chrono::milliseconds elapsed)
Add multiple load events.
Definition JobQueue.cpp:172
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:6
@ jtNS_SYNC_READ
Definition Job.h:70
@ jtWRITE
Definition Job.h:52
@ jtNS_ASYNC_READ
Definition Job.h:71
@ jtNS_WRITE
Definition Job.h:72
Contains information about a batch write operation.
Contains information about a fetch operation.
Derived classes perform scheduled tasks.
Definition Task.h:9
virtual void performScheduledTask()=0
Performs the task.