CCF
|
#include <base_endpoint_registry.h>
Inherits ccf::endpoints::EndpointRegistry.
Inherited by ccf::CommonEndpointRegistry, and nobuiltins::NoBuiltinsRegistry.
Protected Attributes | |
ccf::AbstractNodeContext & | context |
![]() | |
EndpointPtr | default_endpoint |
std::map< std::string, std::map< RESTVerb, EndpointPtr > > | fully_qualified_endpoints |
std::map< std::string, std::map< RESTVerb, std::shared_ptr< PathTemplatedEndpoint > > > | templated_endpoints |
ccf::kv::Consensus * | consensus = nullptr |
ccf::kv::TxHistory * | history = nullptr |
Additional Inherited Members | |
![]() | |
enum | ReadWrite { Read , Write } |
![]() | |
const std::string | method_prefix |
struct ccf::endpoints::EndpointRegistry::OpenApiInfo | openapi_info |
Extends the basic ccf::endpoints::EndpointRegistry with helper API methods for retrieving core CCF properties.
The API methods are versioned with a _vN
suffix. App developers should use the latest version which provides the values they need. Note that the N
in these versions is specific to each method name, and is not related to a specific CCF release version. These APIs will be stable and supported for several CCF releases.
The methods have a consistent calling pattern, taking their arguments first and setting results to the later out-parameters, passed by reference. All return an ApiResult, with value OK if the call succeeded.
ccf::BaseEndpointRegistry::BaseEndpointRegistry | ( | const std::string & | method_prefix_, |
ccf::AbstractNodeContext & | context_ | ||
) |
ApiResult ccf::BaseEndpointRegistry::generate_openapi_document_v1 | ( | ccf::kv::ReadOnlyTx & | tx, |
const std::string & | title, | ||
const std::string & | description, | ||
const std::string & | document_version, | ||
nlohmann::json & | document | ||
) |
Generate an OpenAPI document describing the currently installed endpoints.
The document is compatible with OpenAPI version 3.0.0 - the _v1 suffix describes the version of this API, not the returned document format. Similarly, the document_version argument should be used to version the returned document itself as the set of endpoints or their APIs change, it does not affect the OpenAPI version of the format of the document.
Get the id of the currently executing node.
ApiResult ccf::BaseEndpointRegistry::get_last_committed_txid_v1 | ( | ccf::View & | view, |
ccf::SeqNo & | seqno | ||
) |
Get the ID of latest transaction known to be committed.
ApiResult ccf::BaseEndpointRegistry::get_member_cert_v1 | ( | ccf::kv::ReadOnlyTx & | tx, |
const MemberId & | member_id, | ||
ccf::crypto::Pem & | member_cert_pem | ||
) |
Get the certificate (PEM) of a given member id.
ApiResult ccf::BaseEndpointRegistry::get_member_data_v1 | ( | ccf::kv::ReadOnlyTx & | tx, |
const MemberId & | member_id, | ||
nlohmann::json & | member_data | ||
) |
Get the member data associated with a given member id.
ApiResult ccf::BaseEndpointRegistry::get_quote_for_this_node_v1 | ( | ccf::kv::ReadOnlyTx & | tx, |
QuoteInfo & | quote_info | ||
) |
Get a quote attesting to the hardware this node is running on.
ApiResult ccf::BaseEndpointRegistry::get_quotes_for_all_trusted_nodes_v1 | ( | ccf::kv::ReadOnlyTx & | tx, |
std::map< NodeId, QuoteInfo > & | quotes | ||
) |
Get quotes attesting to the hardware that each node in the service is running on.
ApiResult ccf::BaseEndpointRegistry::get_status_for_txid_v1 | ( | ccf::View | view, |
ccf::SeqNo | seqno, | ||
ccf::TxStatus & | tx_status | ||
) |
Get the status of a transaction by ID, provided as a view+seqno pair.
Note that this value is the node's local understanding of the status of that transaction in the network at call time. For a given TxID, the initial status is always UNKNOWN, and eventually becomes COMMITTED or INVALID. See the documentation section titled "Verifying Transactions" for more detail.
UNKNOWN [Initial status] v ^ PENDING v v
COMMITTED INVALID [Final statuses]
This status is not sampled atomically per handler: if this is called multiple times in a transaction handler, later calls may see more up to date values than earlier calls. Once a final state (COMMITTED or INVALID) has been reached, no further changes are possible.
ApiResult ccf::BaseEndpointRegistry::get_untrusted_host_time_v1 | ( | ::timespec & | time | ) |
Get untrusted time from the host of the currently executing node.
ApiResult ccf::BaseEndpointRegistry::get_user_cert_v1 | ( | ccf::kv::ReadOnlyTx & | tx, |
const UserId & | user_id, | ||
ccf::crypto::Pem & | user_cert_pem | ||
) |
Get the certificate (PEM) of a given user id.
ApiResult ccf::BaseEndpointRegistry::get_user_data_v1 | ( | ccf::kv::ReadOnlyTx & | tx, |
const UserId & | user_id, | ||
nlohmann::json & | user_data | ||
) |
Get the user data associated with a given user id.
ApiResult ccf::BaseEndpointRegistry::get_view_for_seqno_v1 | ( | ccf::SeqNo | seqno, |
ccf::View & | view | ||
) |
Get the view associated with a given seqno, to construct a valid TxID.
ApiResult ccf::BaseEndpointRegistry::get_view_history_v1 | ( | std::vector< ccf::TxID > & | history, |
ccf::View | since = 1 |
||
) |
Get the history of the consensus view changes.
Returns the history of view changes since the given view, which defaults to the start of time.
A view change is characterised by the first sequence number in the new view.
ApiResult ccf::BaseEndpointRegistry::get_view_history_v2 | ( | std::vector< ccf::TxID > & | history, |
ccf::View | since, | ||
ccf::InvalidArgsReason & | reason | ||
) |
Get the history of the consensus view changes.
Returns the history of view changes since the given view, which defaults to the start of time.
A view change is characterised by the first sequence number in the new view.
|
protected |