Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
AmendmentCenterInterface.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 "data/Types.hpp"
23
24#include <boost/asio/spawn.hpp>
25
26#include <cstdint>
27#include <map>
28#include <string>
29#include <vector>
30
31namespace data {
32
37public:
38 virtual ~AmendmentCenterInterface() = default;
39
46 [[nodiscard]] virtual bool
47 isSupported(AmendmentKey const& key) const = 0;
48
54 [[nodiscard]] virtual std::map<std::string, Amendment> const&
55 getSupported() const = 0;
56
62 [[nodiscard]] virtual std::vector<Amendment> const&
63 getAll() const = 0;
64
72 [[nodiscard]] virtual bool
73 isEnabled(AmendmentKey const& key, uint32_t seq) const = 0;
74
83 [[nodiscard]] virtual bool
84 isEnabled(boost::asio::yield_context yield, AmendmentKey const& key, uint32_t seq) const = 0;
85
94 [[nodiscard]] virtual std::vector<bool>
95 isEnabled(boost::asio::yield_context yield, std::vector<AmendmentKey> const& keys, uint32_t seq) const = 0;
96
103 [[nodiscard]] virtual Amendment const&
104 getAmendment(AmendmentKey const& key) const = 0;
105
112 [[nodiscard]] virtual Amendment const&
113 operator[](AmendmentKey const& key) const = 0;
114};
115
116} // namespace data
The interface of an amendment center.
Definition AmendmentCenterInterface.hpp:36
virtual Amendment const & operator[](AmendmentKey const &key) const =0
Get an amendment by its key.
virtual std::map< std::string, Amendment > const & getSupported() const =0
Get all supported amendments as a map.
virtual std::vector< bool > isEnabled(boost::asio::yield_context yield, std::vector< AmendmentKey > const &keys, uint32_t seq) const =0
Check whether an amendment was/is enabled for a given sequence.
virtual std::vector< Amendment > const & getAll() const =0
Get all known amendments.
virtual Amendment const & getAmendment(AmendmentKey const &key) const =0
Get an amendment.
virtual bool isEnabled(AmendmentKey const &key, uint32_t seq) const =0
Check whether an amendment was/is enabled for a given sequence.
virtual bool isSupported(AmendmentKey const &key) const =0
Check whether an amendment is supported by Clio.
virtual bool isEnabled(boost::asio::yield_context yield, AmendmentKey const &key, uint32_t seq) const =0
Check whether an amendment was/is enabled for a given sequence.
This namespace implements the data access layer and related components.
Definition AmendmentCenter.cpp:70
A helper for amendment name to feature conversions.
Definition Types.hpp:286
Represents an amendment in the XRPL.
Definition Types.hpp:255