|
CCF
|
#include <rpc_context_impl.h>
Inherits ccf::RpcContext.
Inherited by http::HttpRpcContext.
Classes | |
| struct | RespondOnCommitInfo |
Public Member Functions | |
| RpcContextImpl (const std::shared_ptr< SessionContext > &s, HttpVersion v=HttpVersion::HTTP1) | |
| std::shared_ptr< SessionContext > | get_session_context () const override |
| void | set_user_data (std::shared_ptr< void > data) override |
| void * | get_user_data () const override |
| void | set_claims_digest (ccf::ClaimsDigest::Digest &&digest) override |
| const ccf::PathParams & | get_request_path_params () override |
| const ccf::PathParams & | get_decoded_request_path_params () override |
| HttpVersion | get_http_version () const |
| void | set_error (ccf::http_status status, const std::string &code, std::string &&msg, const std::vector< nlohmann::json > &details={}) override |
| Construct error response, formatted as JSON OData. | |
| void | set_error (ccf::ErrorDetails &&error) override |
| Construct error response, formatted as JSON OData. | |
| void | set_response_json (const nlohmann::json &body, ccf::http_status status) override |
| void | set_consensus_committed_function (ccf::endpoints::ConsensusCommittedEndpointFunction func) override |
| virtual bool | should_apply_writes () const =0 |
| virtual void | reset_response ()=0 |
| virtual std::vector< uint8_t > | serialise_response () const =0 |
| virtual const std::vector< uint8_t > & | get_serialised_request ()=0 |
Public Member Functions inherited from ccf::RpcContext | |
| virtual | ~RpcContext ()=default |
| virtual const std::vector< uint8_t > & | get_request_body () const =0 |
| virtual const std::string & | get_request_query () const =0 |
| virtual const ccf::RESTVerb & | get_request_verb () const =0 |
| virtual std::string | get_request_path () const =0 |
| virtual std::string | get_method () const =0 |
| virtual const http::HeaderMap & | get_request_headers () const =0 |
| Returns map of all headers found in the request. | |
| virtual std::optional< std::string > | get_request_header (const std::string_view &name) const =0 |
| virtual const std::string & | get_request_url () const =0 |
| virtual ccf::FrameFormat | frame_format () const =0 |
| virtual void | set_response_body (const std::vector< uint8_t > &body)=0 |
| Sets the main body or payload of the response. | |
| virtual void | set_response_body (std::vector< uint8_t > &&body)=0 |
| Sets the main body or payload of the response. | |
| virtual void | set_response_body (std::string &&body)=0 |
| Sets the main body or payload of the response. | |
| virtual const std::vector< uint8_t > & | get_response_body () const =0 |
| virtual std::vector< uint8_t > && | take_response_body ()=0 |
| virtual void | set_response_status (int status)=0 |
| Sets initial status code summarising result of RPC. | |
| virtual int | get_response_status () const =0 |
| virtual void | set_response_header (const std::string_view &name, const std::string_view &value)=0 |
| virtual void | set_response_header (const std::string_view &name, size_t n) |
| virtual void | set_response_header (const http::HeaderKeyValue &kv) |
| virtual void | clear_response_headers ()=0 |
| virtual void | set_response_trailer (const std::string_view &name, const std::string_view &value)=0 |
| virtual void | set_response_trailer (const std::string_view &name, size_t n) |
| virtual void | set_response_trailer (const http::HeaderKeyValue &kv) |
| virtual void | set_apply_writes (bool apply)=0 |
Public Attributes | |
| ccf::ClaimsDigest | claims = ccf::empty_claims() |
| ccf::PathParams | path_params |
| ccf::PathParams | decoded_path_params |
| ccf::endpoints::ConsensusCommittedEndpointFunction | consensus_committed_func = nullptr |
| bool | response_is_pending = false |
| bool | terminate_session = false |
| std::optional< RespondOnCommitInfo > | respond_on_commit = std::nullopt |
Protected Attributes | |
| std::shared_ptr< SessionContext > | session |
| HttpVersion | http_version |
| std::shared_ptr< void > | user_data |
|
inline |
|
inlineoverridevirtual |
Decodes the path before returning a map of all PathParams. For example, if the endpoint was installed at /foo/{name}/{age}, and for the request path /foo/bob%3A/42, this would return the map: {"name": "bob:", "age": "42"}
Implements ccf::RpcContext.
|
inline |
|
inlineoverridevirtual |
Returns a map of all PathParams parsed out of the original query path. For instance if this endpoint was installed at /foo/{name}/{age}, and the request path /foo/bob/42, this would return the map: {"name": "bob", "age": "42"}
Implements ccf::RpcContext.
|
pure virtual |
Implemented in http::HttpRpcContext.
|
inlineoverridevirtual |
Return information about the persistent session which this request was received on. Allows correlation between multiple requests coming from the same long-lived session.
Implements ccf::RpcContext.
|
inlineoverridevirtual |
Implements ccf::RpcContext.
|
pure virtual |
Implemented in http::HttpRpcContext.
|
pure virtual |
Implemented in http::HttpRpcContext.
|
inlineoverridevirtual |
Sets the application claims digest associated with this transaction. This digest is used to construct the Merkle tree leaf representing this transaction. This allows a transaction to make specific, separately-revealable claims in each transaction, without being bound to the transaction serialisation format or what is stored in the KV. The digest will be included in receipts issued for that transaction.
Implements ccf::RpcContext.
|
inlineoverridevirtual |
Tells the framework to hold the response for this request until the transaction reaches a terminal consensus state (committed or invalidated). The provided callback will be invoked with a CommittedTxInfo describing the outcome, and may inspect or modify the response before it is sent to the client. If this method is not called during endpoint execution, the response is sent immediately after local commit.
Implements ccf::RpcContext.
|
inlineoverridevirtual |
Construct error response, formatted as JSON OData.
Implements ccf::RpcContext.
|
inlineoverridevirtual |
Construct error response, formatted as JSON OData.
Implements ccf::RpcContext.
|
inlineoverridevirtual |
Implements ccf::RpcContext.
|
inlineoverridevirtual |
Implements ccf::RpcContext.
|
pure virtual |
Implemented in http::HttpRpcContext.
| ccf::ClaimsDigest ccf::RpcContextImpl::claims = ccf::empty_claims() |
| ccf::endpoints::ConsensusCommittedEndpointFunction ccf::RpcContextImpl::consensus_committed_func = nullptr |
| ccf::PathParams ccf::RpcContextImpl::decoded_path_params |
|
protected |
| ccf::PathParams ccf::RpcContextImpl::path_params |
| std::optional<RespondOnCommitInfo> ccf::RpcContextImpl::respond_on_commit = std::nullopt |
| bool ccf::RpcContextImpl::response_is_pending = false |
|
protected |
| bool ccf::RpcContextImpl::terminate_session = false |
|
protected |