rippled
Loading...
Searching...
No Matches
BatchWriter.h
1#pragma once
2
3#include <xrpl/nodestore/Scheduler.h>
4#include <xrpl/nodestore/Task.h>
5#include <xrpl/nodestore/Types.h>
6
7#include <condition_variable>
8#include <mutex>
9
10namespace xrpl {
11namespace NodeStore {
12
21class BatchWriter : private Task
22{
23public:
25 struct Callback
26 {
27 virtual ~Callback() = default;
28 Callback() = default;
29 Callback(Callback const&) = delete;
31 operator=(Callback const&) = delete;
32
33 virtual void
34 writeBatch(Batch const& batch) = 0;
35 };
36
38 BatchWriter(Callback& callback, Scheduler& scheduler);
39
45
51 void
53
55 int
57
58private:
59 void
60 performScheduledTask() override;
61 void
62 writeBatch();
63 void
65
66private:
69
77};
78
79} // namespace NodeStore
80} // namespace xrpl
Batch-writing assist logic.
Definition BatchWriter.h:22
void store(std::shared_ptr< NodeObject > const &object)
Store the object.
void performScheduledTask() override
Performs the task.
~BatchWriter()
Destroy a batch writer.
int getWriteLoad()
Get an estimate of the amount of writing I/O pending.
Scheduling for asynchronous backend activity.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
This callback does the actual writing.
Definition BatchWriter.h:26
Callback & operator=(Callback const &)=delete
virtual void writeBatch(Batch const &batch)=0
Callback(Callback const &)=delete
Derived classes perform scheduled tasks.
Definition Task.h:8