xrpld
Loading...
Searching...
No Matches
DatabaseRotatingImp.h
1#pragma once
2
3#include <xrpl/nodestore/DatabaseRotating.h>
4
5#include <mutex>
6
7namespace xrpl::NodeStore {
8
10{
11public:
16
18 Scheduler& scheduler,
19 int readThreads,
20 std::shared_ptr<Backend> writableBackend,
21 std::shared_ptr<Backend> archiveBackend,
22 Section const& config,
24
26 {
27 stop();
28 }
29
30 void
31 rotate(
33 std::function<void(std::string const& writableName, std::string const& archiveName)> const&
34 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
58 void
59 sweep() override;
60
61private:
65
67 fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate)
68 override;
69
70 void
72};
73
74} // namespace xrpl::NodeStore
A generic endpoint for log messages.
Definition Journal.h:38
std::shared_ptr< Backend > archiveBackend_
bool isSameDB(std::uint32_t, std::uint32_t) override
void forEach(std::function< void(std::shared_ptr< NodeObject >)> f) override
Visit every object in the database This is usually called during import.
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.
void sweep() override
Remove expired entries from the positive and negative caches.
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.
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.
DatabaseRotating(Scheduler &scheduler, int readThreads, Section const &config, beast::Journal journal)
Persistency layer for NodeObject.
Definition Database.h:32
Scheduling for asynchronous backend activity.
Holds a collection of configuration values.
Definition BasicConfig.h:24
NodeObjectType
The types of node objects.
Definition NodeObject.h:12
std::vector< unsigned char > Blob
Storage for linear binary data.
Definition Blob.h:10
BaseUInt< 256 > uint256
Definition base_uint.h:562
Contains information about a fetch operation.