mirror of
https://github.com/XRPLF/clio.git
synced 2026-06-07 02:36:43 +00:00
@@ -19,11 +19,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rpc/common/Types.h"
|
||||
#include "util/Expected.h"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
#include <boost/json/object.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace rpc {
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
#include "rpc/common/Types.h"
|
||||
#include "rpc/common/impl/Processors.h"
|
||||
|
||||
#include <boost/json/value.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace rpc {
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
|
||||
#include "rpc/common/Types.h"
|
||||
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_from.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace rpc {
|
||||
|
||||
46
src/rpc/common/HandlerProvider.h
Normal file
46
src/rpc/common/HandlerProvider.h
Normal file
@@ -0,0 +1,46 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of clio: https://github.com/XRPLF/clio
|
||||
Copyright (c) 2024, the clio developers.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rpc/common/AnyHandler.h"
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace rpc {
|
||||
|
||||
/**
|
||||
* @brief Interface for the provider of RPC handlers.
|
||||
*/
|
||||
class HandlerProvider {
|
||||
public:
|
||||
virtual ~HandlerProvider() = default;
|
||||
|
||||
virtual bool
|
||||
contains(std::string const& method) const = 0;
|
||||
|
||||
virtual std::optional<AnyHandler>
|
||||
getHandler(std::string const& command) const = 0;
|
||||
|
||||
virtual bool
|
||||
isClioOnly(std::string const& command) const = 0;
|
||||
};
|
||||
|
||||
} // namespace rpc
|
||||
@@ -1,7 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of clio: https://github.com/XRPLF/clio
|
||||
Copyright (c) 2023, the clio developers.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <boost/json/conversion.hpp>
|
||||
#include <boost/json/kind.hpp>
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace rpc {
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "rpc/Errors.h"
|
||||
#include "rpc/common/Concepts.h"
|
||||
#include "rpc/common/Specs.h"
|
||||
#include "rpc/common/Types.h"
|
||||
#include "rpc/common/Validators.h"
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rpc/common/Concepts.h"
|
||||
#include "rpc/common/Specs.h"
|
||||
#include "rpc/common/Types.h"
|
||||
#include "util/JsonUtils.h"
|
||||
|
||||
#include <boost/json/value.hpp>
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace rpc::modifiers {
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
#include "rpc/common/Types.h"
|
||||
#include "rpc/common/impl/Factories.h"
|
||||
|
||||
#include <boost/json/value.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -23,9 +23,17 @@
|
||||
#include "util/Expected.h"
|
||||
|
||||
#include <boost/asio/spawn.hpp>
|
||||
#include <boost/json/conversion.hpp>
|
||||
#include <boost/json/object.hpp>
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_from.hpp>
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
namespace etl {
|
||||
class LoadBalancer;
|
||||
@@ -42,7 +50,6 @@ namespace rpc {
|
||||
class Counters;
|
||||
struct RpcSpec;
|
||||
struct FieldSpec;
|
||||
class AnyHandler;
|
||||
|
||||
/**
|
||||
* @brief Return type used for Validators that can return error but don't have
|
||||
@@ -112,23 +119,6 @@ struct AccountCursor {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Interface for the provider of RPC handlers.
|
||||
*/
|
||||
class HandlerProvider {
|
||||
public:
|
||||
virtual ~HandlerProvider() = default;
|
||||
|
||||
virtual bool
|
||||
contains(std::string const& method) const = 0;
|
||||
|
||||
virtual std::optional<AnyHandler>
|
||||
getHandler(std::string const& command) const = 0;
|
||||
|
||||
virtual bool
|
||||
isClioOnly(std::string const& command) const = 0;
|
||||
};
|
||||
|
||||
inline void
|
||||
tag_invoke(boost::json::value_from_tag, boost::json::value& jv, VoidOutput const&)
|
||||
{
|
||||
|
||||
@@ -19,13 +19,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rpc/common/Concepts.h"
|
||||
#include "rpc/common/Specs.h"
|
||||
#include "rpc/Errors.h"
|
||||
#include "rpc/common/Types.h"
|
||||
|
||||
#include <boost/json/array.hpp>
|
||||
#include <boost/json/object.hpp>
|
||||
#include <boost/json/value.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace rpc::validation {
|
||||
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
#include "util/config/Config.h"
|
||||
#include "util/log/Logger.h"
|
||||
|
||||
#include <boost/json/object.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace rpc::detail {
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rpc/Errors.h"
|
||||
#include "rpc/common/Concepts.h"
|
||||
#include "rpc/common/Types.h"
|
||||
|
||||
#include <boost/json/value.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace rpc::detail {
|
||||
|
||||
|
||||
@@ -19,16 +19,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "etl/LoadBalancer.h"
|
||||
#include "etl/Source.h"
|
||||
#include "rpc/Counters.h"
|
||||
#include "rpc/Errors.h"
|
||||
#include "rpc/RPCHelpers.h"
|
||||
#include "rpc/common/Types.h"
|
||||
#include "util/log/Logger.h"
|
||||
#include "web/Context.h"
|
||||
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace rpc::detail {
|
||||
|
||||
|
||||
@@ -22,8 +22,11 @@
|
||||
#include "data/BackendInterface.h"
|
||||
#include "feed/SubscriptionManager.h"
|
||||
#include "rpc/common/AnyHandler.h"
|
||||
#include "rpc/common/HandlerProvider.h"
|
||||
#include "rpc/common/Types.h"
|
||||
#include "util/config/Config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
Reference in New Issue
Block a user