rippled
Loading...
Searching...
No Matches
DatabaseRotatingImp.h
1#pragma once
2
3#include <xrpl/nodestore/DatabaseRotating.h>
4
5#include <mutex>
6
7namespace xrpl {
8namespace NodeStore {
9
11{
12public:
17
19 Scheduler& scheduler,
20 int readThreads,
21 std::shared_ptr<Backend> writableBackend,
22 std::shared_ptr<Backend> archiveBackend,
23 Section const& config,
25
27 {
28 stop();
29 }
30
31 void
32 rotate(
34 std::function<void(std::string const& writableName, std::string const& archiveName)> const& f) override;
35
37 getName() const override;
38
40 getWriteLoad() const override;
41
42 void
43 importDatabase(Database& source) override;
44
45 bool
47 {
48 // rotating store acts as one logical database
49 return true;
50 }
51
52 void
53 store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t) override;
54
55 void
56 sync() override;
57
58private:
62
64 fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) override;
65
66 void
68};
69
70} // namespace NodeStore
71} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
std::shared_ptr< Backend > archiveBackend_
bool isSameDB(std::uint32_t, std::uint32_t) override
DatabaseRotatingImp(DatabaseRotatingImp const &)=delete
std::int32_t getWriteLoad() const override
Retrieve the estimated number of pending write operations.
void importDatabase(Database &source) override
Import objects from another database.
std::shared_ptr< Backend > writableBackend_
DatabaseRotatingImp & operator=(DatabaseRotatingImp const &)=delete
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.
std::string getName() const override
Retrieve the name associated with this backend.
void for_each(std::function< void(std::shared_ptr< NodeObject >)> f) override
Visit every object in the database This is usually called during import.
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.
Persistency layer for NodeObject.
Definition Database.h:31
Scheduling for asynchronous backend activity.
Holds a collection of configuration values.
Definition BasicConfig.h:24
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
NodeObjectType
The types of node objects.
Definition NodeObject.h:12
Contains information about a fetch operation.