Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
CacheLoaderSettings.hpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of clio: https://github.com/XRPLF/clio
4 Copyright (c) 2024, the clio developers.
5
6 Permission to use, copy, modify, and distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#pragma once
21
22#include "util/config/ConfigDefinition.hpp"
23
24#include <cstddef>
25#include <cstdint>
26#include <optional>
27#include <string>
28
29namespace etl {
30
36 enum class LoadStyle { ASYNC, SYNC, NONE };
37
40 std::string path;
41 uint32_t maxAge = 5000;
42
43 auto
44 operator<=>(CacheFileSettings const&) const = default;
45 };
46
47 size_t numCacheDiffs = 32;
48 size_t numCacheMarkers = 48;
49 size_t cachePageFetchSize = 512;
50 size_t numThreads = 2;
53
54 LoadStyle loadStyle = LoadStyle::ASYNC;
55 std::optional<CacheFileSettings> cacheFileSettings;
56
57 auto
58 operator<=>(CacheLoaderSettings const&) const = default;
59
61 [[nodiscard]] bool
62 isSync() const;
63
65 [[nodiscard]] bool
66 isAsync() const;
67
69 [[nodiscard]] bool
70 isDisabled() const;
71};
72
79[[nodiscard]] CacheLoaderSettings
80makeCacheLoaderSettings(util::config::ClioConfigDefinition const& config);
81
82} // namespace etl
All the config data will be stored and extracted from this class.
Definition ConfigDefinition.hpp:50
Settings for cache file operations.
Definition CacheLoaderSettings.hpp:39
std::string path
Definition CacheLoaderSettings.hpp:40
uint32_t maxAge
Definition CacheLoaderSettings.hpp:41
Settings for the cache loader.
Definition CacheLoaderSettings.hpp:34
bool isDisabled() const
Definition CacheLoaderSettings.cpp:46
bool isSync() const
Definition CacheLoaderSettings.cpp:34
size_t numCacheMarkers
Definition CacheLoaderSettings.hpp:48
std::optional< CacheFileSettings > cacheFileSettings
Definition CacheLoaderSettings.hpp:55
size_t numCacheCursorsFromAccount
Definition CacheLoaderSettings.hpp:52
LoadStyle loadStyle
Definition CacheLoaderSettings.hpp:54
LoadStyle
Ways to load the cache.
Definition CacheLoaderSettings.hpp:36
size_t numThreads
Definition CacheLoaderSettings.hpp:50
size_t cachePageFetchSize
Definition CacheLoaderSettings.hpp:49
size_t numCacheDiffs
Definition CacheLoaderSettings.hpp:47
bool isAsync() const
Definition CacheLoaderSettings.cpp:40
size_t numCacheCursorsFromDiff
Definition CacheLoaderSettings.hpp:51