rippled
Loading...
Searching...
No Matches
DatabaseRotatingImp.h
1#ifndef XRPL_NODESTORE_DATABASEROTATINGIMP_H_INCLUDED
2#define XRPL_NODESTORE_DATABASEROTATINGIMP_H_INCLUDED
3
4#include <xrpl/nodestore/DatabaseRotating.h>
5
6#include <mutex>
7
8namespace ripple {
9namespace NodeStore {
10
12{
13public:
18
20 Scheduler& scheduler,
21 int readThreads,
22 std::shared_ptr<Backend> writableBackend,
23 std::shared_ptr<Backend> archiveBackend,
24 Section const& config,
26
28 {
29 stop();
30 }
31
32 void
33 rotate(
35 std::function<void(
36 std::string const& writableName,
37 std::string const& archiveName)> const& f) override;
38
40 getName() const override;
41
43 getWriteLoad() const override;
44
45 void
46 importDatabase(Database& source) override;
47
48 bool
50 {
51 // rotating store acts as one logical database
52 return true;
53 }
54
55 void
56 store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t)
57 override;
58
59 void
60 sync() override;
61
62 void
63 sweep() override;
64
65private:
69
72 uint256 const& hash,
74 FetchReport& fetchReport,
75 bool duplicate) override;
76
77 void
79};
80
81} // namespace NodeStore
82} // namespace ripple
83
84#endif
A generic endpoint for log messages.
Definition Journal.h:41
std::int32_t getWriteLoad() const override
Retrieve the estimated number of pending write operations.
DatabaseRotatingImp(DatabaseRotatingImp const &)=delete
std::shared_ptr< Backend > archiveBackend_
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t, FetchReport &fetchReport, bool duplicate) override
void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t) override
Store the object.
void importDatabase(Database &source) override
Import objects from another database.
std::string getName() const override
Retrieve the name associated with this backend.
void sweep() override
Remove expired entries from the positive and negative caches.
bool isSameDB(std::uint32_t, std::uint32_t) override
std::shared_ptr< Backend > writableBackend_
void rotate(std::unique_ptr< NodeStore::Backend > &&newBackend, std::function< void(std::string const &writableName, std::string const &archiveName)> const &f) override
Rotates the backends.
DatabaseRotatingImp & operator=(DatabaseRotatingImp const &)=delete
void for_each(std::function< void(std::shared_ptr< NodeObject >)> f) override
Visit every object in the database This is usually called during import.
Persistency layer for NodeObject.
Definition Database.h:32
Scheduling for asynchronous backend activity.
Holds a collection of configuration values.
Definition BasicConfig.h:26
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
NodeObjectType
The types of node objects.
Definition NodeObject.h:13
Contains information about a fetch operation.