#include <endpoint_registry.h>
Inherits ccf::endpoints::Endpoint::Installer.
Inherited by ccf::BaseEndpointRegistry.
|
| template<typename T > |
| bool | get_path_param (const ccf::PathParams ¶ms, const std::string ¶m_name, T &value, std::string &error) |
| |
| template<> |
| bool | get_path_param (const ccf::PathParams ¶ms, const std::string ¶m_name, std::string &value, std::string &error) |
| |
| | EndpointRegistry (std::string method_prefix_) |
| |
| | ~EndpointRegistry () override=default |
| |
| virtual Endpoint | make_endpoint (const std::string &method, RESTVerb verb, const EndpointFunction &f, const AuthnPolicies &ap) |
| |
| virtual Endpoint | make_read_only_endpoint (const std::string &method, RESTVerb verb, const ReadOnlyEndpointFunction &f, const AuthnPolicies &ap) |
| |
| virtual Endpoint | make_command_endpoint (const std::string &method, RESTVerb verb, const CommandEndpointFunction &f, const AuthnPolicies &ap) |
| |
| void | install (Endpoint &endpoint) override |
| |
| void | set_default (EndpointFunction f, const AuthnPolicies &ap) |
| |
| virtual void | build_api (nlohmann::json &document, ccf::kv::ReadOnlyTx &tx) |
| |
| virtual void | init_handlers () |
| |
| virtual EndpointDefinitionPtr | find_endpoint (ccf::kv::Tx &tx, ccf::RpcContext &rpc_ctx) |
| |
| virtual void | execute_endpoint (EndpointDefinitionPtr e, EndpointContext &ctx) |
| |
| virtual void | execute_endpoint_locally_committed (EndpointDefinitionPtr e, CommandEndpointContext &ctx, const TxID &tx_id) |
| |
| virtual std::set< RESTVerb > | get_allowed_verbs (ccf::kv::Tx &tx, const ccf::RpcContext &rpc_ctx) |
| |
| virtual bool | request_needs_root (const ccf::RpcContext &rpc_ctx) |
| |
| virtual void | report_ambiguous_templated_path (const std::string &path, const std::vector< EndpointDefinitionPtr > &matches) |
| |
| virtual void | tick (std::chrono::milliseconds duration) |
| |
| void | set_consensus (ccf::kv::Consensus *c) |
| |
| void | set_history (ccf::kv::TxHistory *h) |
| |
| virtual void | handle_event_request_completed (const ccf::endpoints::RequestCompletedEvent &event) |
| |
| virtual void | handle_event_dispatch_failed (const ccf::endpoints::DispatchFailedEvent &event) |
| |
| virtual bool | apply_uncommitted_tx_backpressure () const |
| |
| virtual | ~Installer ()=default |
| |
The EndpointRegistry records the user-defined endpoints for a given CCF application.
This is the abstract base for several more complete registrys. For a versioned API wrapping access to common CCF properties, see BaseEndpointRegistry. For implementation of several common endpoints see CommonEndpointRegistry.
◆ ReadWrite
◆ EndpointRegistry()
| ccf::endpoints::EndpointRegistry::EndpointRegistry |
( |
std::string |
method_prefix_ | ) |
|
|
inline |
◆ ~EndpointRegistry()
| ccf::endpoints::EndpointRegistry::~EndpointRegistry |
( |
| ) |
|
|
overridedefault |
◆ apply_uncommitted_tx_backpressure()
| virtual bool ccf::endpoints::EndpointRegistry::apply_uncommitted_tx_backpressure |
( |
| ) |
const |
|
inlinevirtual |
◆ build_api()
| void ccf::endpoints::EndpointRegistry::build_api |
( |
nlohmann::json & |
document, |
|
|
ccf::kv::ReadOnlyTx & |
tx |
|
) |
| |
|
virtual |
Populate document with all supported methods
This is virtual since derived classes may do their own dispatch internally, so must be able to populate the document with the supported endpoints however it defines them.
Reimplemented in ccf::js::BaseDynamicJSEndpointRegistry.
◆ execute_endpoint()
◆ execute_endpoint_locally_committed()
◆ find_endpoint()
◆ get_allowed_verbs()
◆ get_path_param() [1/2]
template<>
| bool ccf::endpoints::EndpointRegistry::get_path_param |
( |
const ccf::PathParams & |
params, |
|
|
const std::string & |
param_name, |
|
|
std::string & |
value, |
|
|
std::string & |
error |
|
) |
| |
|
inline |
◆ get_path_param() [2/2]
template<typename T >
| bool ccf::endpoints::EndpointRegistry::get_path_param |
( |
const ccf::PathParams & |
params, |
|
|
const std::string & |
param_name, |
|
|
T & |
value, |
|
|
std::string & |
error |
|
) |
| |
|
inline |
◆ handle_event_dispatch_failed()
◆ handle_event_request_completed()
◆ init_handlers()
| void ccf::endpoints::EndpointRegistry::init_handlers |
( |
| ) |
|
|
virtual |
◆ install()
| void ccf::endpoints::EndpointRegistry::install |
( |
Endpoint & |
endpoint | ) |
|
|
overridevirtual |
Install the given endpoint, using its method and verb
If an implementation is already installed for this method and verb, it will be replaced.
- Parameters
-
| endpoint | Endpoint object describing the new resource to install |
Implements ccf::endpoints::Endpoint::Installer.
◆ make_command_endpoint()
Create a new command endpoint.
Commands are endpoints which do not read or write from the KV. See make_endpoint().
◆ make_endpoint()
Create a new endpoint.
Caller should set any additional properties on the returned Endpoint object, and finally call Endpoint::install() to install it.
- Parameters
-
| method | The URI at which this endpoint will be installed |
| verb | The HTTP verb which this endpoint will respond to |
| f | Functor which will be invoked for requests to VERB /method |
| ap | Policies which will be checked against each request before the endpoint is executed. |
- See also
- ccf::EndpointDefinition::authn_policies
- Returns
- The new Endpoint for further modification
◆ make_read_only_endpoint()
Create a read-only endpoint.
◆ report_ambiguous_templated_path()
| void ccf::endpoints::EndpointRegistry::report_ambiguous_templated_path |
( |
const std::string & |
path, |
|
|
const std::vector< EndpointDefinitionPtr > & |
matches |
|
) |
| |
|
virtual |
◆ request_needs_root()
| bool ccf::endpoints::EndpointRegistry::request_needs_root |
( |
const ccf::RpcContext & |
rpc_ctx | ) |
|
|
virtual |
◆ set_consensus()
◆ set_default()
Set a default EndpointFunction
The default EndpointFunction is only invoked if no specific EndpointFunction was found.
- Parameters
-
| f | Method implementation |
| ap | Authentication policy |
◆ set_history()
◆ tick()
| void ccf::endpoints::EndpointRegistry::tick |
( |
std::chrono::milliseconds |
duration | ) |
|
|
virtual |
◆ consensus
◆ default_endpoint
| EndpointPtr ccf::endpoints::EndpointRegistry::default_endpoint |
|
protected |
◆ fully_qualified_endpoints
| std::map<std::string, std::map<RESTVerb, EndpointPtr> > ccf::endpoints::EndpointRegistry::fully_qualified_endpoints |
|
protected |
◆ history
◆ method_prefix
| const std::string ccf::endpoints::EndpointRegistry::method_prefix |
◆ openapi_info
◆ templated_endpoints
The documentation for this class was generated from the following files: