rippled
Loading...
Searching...
No Matches
NodeStoreScheduler.cpp
1#include <xrpld/app/main/NodeStoreScheduler.h>
2
3namespace ripple {
4
5NodeStoreScheduler::NodeStoreScheduler(JobQueue& jobQueue) : jobQueue_(jobQueue)
6{
7}
8
9void
11{
12 if (jobQueue_.isStopped())
13 return;
14
15 if (!jobQueue_.addJob(jtWRITE, "NodeObject::store", [&task]() {
16 task.performScheduledTask();
17 }))
18 {
19 // Job not added, presumably because we're shutting down.
20 // Recover by executing the task synchronously.
22 }
23}
24
25void
37
38void
46
47} // namespace ripple
A pool of threads to perform work.
Definition JobQueue.h:39
bool isStopped() const
Definition JobQueue.cpp:303
void addLoadEvents(JobType t, int count, std::chrono::milliseconds elapsed)
Add multiple load events.
Definition JobQueue.cpp:174
bool addJob(JobType type, std::string const &name, JobHandler &&jobHandler)
Adds a job to the JobQueue.
Definition JobQueue.h:149
void onFetch(NodeStore::FetchReport const &report) override
Reports completion of a fetch Allows the scheduler to monitor the node store's performance.
void scheduleTask(NodeStore::Task &task) override
Schedules a task.
void onBatchWrite(NodeStore::BatchWriteReport const &report) override
Reports the completion of a batch write Allows the scheduler to monitor the node store's performance.
NodeStoreScheduler(JobQueue &jobQueue)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
@ jtNS_WRITE
Definition Job.h:73
@ jtNS_SYNC_READ
Definition Job.h:71
@ jtNS_ASYNC_READ
Definition Job.h:72
@ jtWRITE
Definition Job.h:53
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.