Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
LedgerCacheFile.hpp
1#pragma once
2
3#include "data/LedgerCache.hpp"
4#include "data/impl/InputFile.hpp"
5#include "data/impl/OutputFile.hpp"
6
7#include <fmt/format.h>
8#include <xrpl/basics/base_uint.h>
9
10#include <cstddef>
11#include <cstdint>
12#include <cstring>
13#include <string>
14
15namespace data::impl {
16
17class LedgerCacheFile {
18public:
19 struct Header {
20 uint32_t version = kVERSION;
21 uint32_t latestSeq{};
22 uint64_t mapSize{};
23 uint64_t deletedSize{};
24 };
25
26private:
27 static constexpr uint32_t kVERSION = 1;
28
29 std::string path_;
30
31public:
32 template <typename T>
33 struct DataBase {
34 uint32_t latestSeq{0};
35 T map;
36 T deleted;
37 };
38
41
42 LedgerCacheFile(std::string path);
43
44 std::expected<void, std::string>
45 write(DataView dataView);
46
47 std::expected<Data, std::string>
48 read(uint32_t minLatestSequence);
49};
50
51} // namespace data::impl
Definition LedgerCacheFile.hpp:33
Definition LedgerCacheFile.hpp:19