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