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
42 uint32_t maxAge = 5000;
43
44 auto
45 operator<=>(CacheFileSettings const&) const = default;
46 };
47
48 size_t numCacheDiffs = 32;
49 size_t numCacheMarkers = 48;
51 512;
52 size_t numThreads = 2;
55
56 LoadStyle loadStyle = LoadStyle::ASYNC;
57 std::optional<CacheFileSettings>
59
60 auto
61 operator<=>(CacheLoaderSettings const&) const = default;
62
64 [[nodiscard]] bool
65 isSync() const;
66
68 [[nodiscard]] bool
69 isAsync() const;
70
72 [[nodiscard]] bool
73 isDisabled() const;
74};
75
82[[nodiscard]] CacheLoaderSettings
83makeCacheLoaderSettings(util::config::ClioConfigDefinition const& config);
84
85} // 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:41
uint32_t maxAge
Definition CacheLoaderSettings.hpp:42
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:49
std::optional< CacheFileSettings > cacheFileSettings
Definition CacheLoaderSettings.hpp:58
size_t numCacheCursorsFromAccount
Definition CacheLoaderSettings.hpp:54
LoadStyle loadStyle
Definition CacheLoaderSettings.hpp:56
LoadStyle
Ways to load the cache.
Definition CacheLoaderSettings.hpp:36
size_t numThreads
Definition CacheLoaderSettings.hpp:52
size_t cachePageFetchSize
Definition CacheLoaderSettings.hpp:50
size_t numCacheDiffs
Definition CacheLoaderSettings.hpp:48
bool isAsync() const
Definition CacheLoaderSettings.cpp:40
size_t numCacheCursorsFromDiff
Definition CacheLoaderSettings.hpp:53