CCF
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
ccf::historical Namespace Reference

Classes

class  AbstractStateCache
 
struct  State
 
class  StateCache
 
class  StateCacheImpl
 

Typedefs

using CheckAvailability = std::function< bool(ccf::View view, ccf::SeqNo seqno, std::string &error_reason)>
 
using HandleReadWriteHistoricalQuery = std::function< void(ccf::endpoints::EndpointContext &args, StatePtr state)>
 
using HandleReadOnlyHistoricalQuery = std::function< void(ccf::endpoints::ReadOnlyEndpointContext &args, StatePtr state)>
 
using HandleHistoricalQuery = HandleReadWriteHistoricalQuery
 
using CommandTxIDExtractor = std::function< std::optional< ccf::TxID >(endpoints::CommandEndpointContext &args)>
 
using ReadOnlyTxIDExtractor = std::function< std::optional< ccf::TxID >(endpoints::ReadOnlyEndpointContext &args)>
 
using TxIDExtractor = std::function< std::optional< ccf::TxID >(endpoints::EndpointContext &args)>
 
using ErrorHandler = std::function< void(HistoricalQueryErrorCode err, std::string reason, endpoints::EndpointContext &args)>
 
using ReadOnlyErrorHandler = std::function< void(HistoricalQueryErrorCode err, std::string reason, endpoints::ReadOnlyEndpointContext &args)>
 
using CheckHistoricalTxStatus = std::function< HistoricalTxStatus(ccf::View view, ccf::SeqNo seqno, std::string &error_reason)>
 
using StatePtr = std::shared_ptr< State >
 
using RequestHandle = size_t
 
using ExpiryDuration = std::chrono::seconds
 
using CacheSize = size_t
 
using CompoundHandle = std::pair< RequestNamespace, RequestHandle >
 

Enumerations

enum class  HistoricalQueryErrorCode {
  InternalError , TransactionPending , TransactionInvalid , TransactionIdMissing ,
  TransactionPartiallyReady
}
 
enum class  HistoricalTxStatus { Error , PendingOrUnknown , Invalid , Valid }
 
enum class  RequestNamespace : uint8_t { Application , System }
 

Functions

std::optional< ccf::TxIDtxid_from_header (endpoints::CommandEndpointContext &args)
 
void default_error_handler (HistoricalQueryErrorCode err, std::string reason, endpoints::CommandEndpointContext &args)
 
HistoricalTxStatus is_tx_committed_v2 (ccf::kv::Consensus *consensus, ccf::View view, ccf::SeqNo seqno, std::string &error_reason)
 
ccf::endpoints::EndpointFunction adapter_v3 (const HandleHistoricalQuery &f, ccf::AbstractNodeContext &node_context, const CheckHistoricalTxStatus &available, const TxIDExtractor &extractor=txid_from_header)
 
ccf::endpoints::ReadOnlyEndpointFunction read_only_adapter_v3 (const HandleReadOnlyHistoricalQuery &f, ccf::AbstractNodeContext &node_context, const CheckHistoricalTxStatus &available, const ReadOnlyTxIDExtractor &extractor=txid_from_header)
 
ccf::endpoints::EndpointFunction read_write_adapter_v3 (const HandleReadWriteHistoricalQuery &f, ccf::AbstractNodeContext &node_context, const CheckHistoricalTxStatus &available, const TxIDExtractor &extractor=txid_from_header)
 
ccf::endpoints::ReadOnlyEndpointFunction read_only_adapter_v4 (const HandleReadOnlyHistoricalQuery &f, ccf::AbstractNodeContext &node_context, const CheckHistoricalTxStatus &available, const ReadOnlyTxIDExtractor &extractor=txid_from_header, const ReadOnlyErrorHandler &ehandler=default_error_handler)
 
ccf::endpoints::EndpointFunction read_write_adapter_v4 (const HandleReadWriteHistoricalQuery &f, ccf::AbstractNodeContext &node_context, const CheckHistoricalTxStatus &available, const TxIDExtractor &extractor=txid_from_header, const ErrorHandler &ehandler=default_error_handler)
 
bool populate_service_endorsements (ccf::kv::ReadOnlyTx &tx, ccf::historical::StatePtr &state, AbstractStateCache &state_cache, std::shared_ptr< NetworkIdentitySubsystemInterface > network_identity_subsystem)
 
bool populate_cose_service_endorsements (ccf::kv::ReadOnlyTx &tx, ccf::historical::StatePtr &state, AbstractStateCache &state_cache)
 
template<class TQueryHandler , class TEndpointFunction , class TEndpointContext , class TTxIDExtractor >
TEndpointFunction _adapter_v3 (const TQueryHandler &f, ccf::AbstractNodeContext &node_context, const CheckHistoricalTxStatus &available, const TTxIDExtractor &extractor)
 
template<class TQueryHandler , class TEndpointFunction , class TEndpointContext , class TTxIDExtractor , class TErrorHandler >
TEndpointFunction _adapter_v4 (const TQueryHandler &f, ccf::AbstractNodeContext &node_context, const CheckHistoricalTxStatus &available, const TTxIDExtractor &extractor, const TErrorHandler &ehandler)
 
std::optional< ServiceInfofind_previous_service_identity (ccf::kv::ReadOnlyTx &tx, ccf::historical::StatePtr &state, AbstractStateCache &state_cache)
 

Typedef Documentation

◆ CacheSize

using ccf::historical::CacheSize = typedef size_t

◆ CheckAvailability

using ccf::historical::CheckAvailability = typedef std::function<bool( ccf::View view, ccf::SeqNo seqno, std::string& error_reason)>

◆ CheckHistoricalTxStatus

using ccf::historical::CheckHistoricalTxStatus = typedef std::function<HistoricalTxStatus( ccf::View view, ccf::SeqNo seqno, std::string& error_reason)>

◆ CommandTxIDExtractor

using ccf::historical::CommandTxIDExtractor = typedef std::function<std::optional<ccf::TxID>( endpoints::CommandEndpointContext& args)>

◆ CompoundHandle

◆ ErrorHandler

using ccf::historical::ErrorHandler = typedef std::function<void( HistoricalQueryErrorCode err, std::string reason, endpoints::EndpointContext& args)>

◆ ExpiryDuration

using ccf::historical::ExpiryDuration = typedef std::chrono::seconds

◆ HandleHistoricalQuery

◆ HandleReadOnlyHistoricalQuery

◆ HandleReadWriteHistoricalQuery

◆ ReadOnlyErrorHandler

using ccf::historical::ReadOnlyErrorHandler = typedef std::function<void( HistoricalQueryErrorCode err, std::string reason, endpoints::ReadOnlyEndpointContext& args)>

◆ ReadOnlyTxIDExtractor

using ccf::historical::ReadOnlyTxIDExtractor = typedef std::function<std::optional<ccf::TxID>( endpoints::ReadOnlyEndpointContext& args)>

◆ RequestHandle

using ccf::historical::RequestHandle = typedef size_t

This is a caller-defined key for each historical query request. For instance, you may wish to use callerID or sessionID to allow a single active request per caller or session, or maintain an LRU to cap the total number of active requests.

◆ StatePtr

typedef std::shared_ptr< State > ccf::historical::StatePtr

◆ TxIDExtractor

using ccf::historical::TxIDExtractor = typedef std::function<std::optional<ccf::TxID>(endpoints::EndpointContext& args)>

Enumeration Type Documentation

◆ HistoricalQueryErrorCode

Enumerator
InternalError 
TransactionPending 
TransactionInvalid 
TransactionIdMissing 
TransactionPartiallyReady 

◆ HistoricalTxStatus

Enumerator
Error 
PendingOrUnknown 
Invalid 
Valid 

◆ RequestNamespace

enum class ccf::historical::RequestNamespace : uint8_t
strong
Enumerator
Application 
System 

Function Documentation

◆ _adapter_v3()

template<class TQueryHandler , class TEndpointFunction , class TEndpointContext , class TTxIDExtractor >
TEndpointFunction ccf::historical::_adapter_v3 ( const TQueryHandler &  f,
ccf::AbstractNodeContext node_context,
const CheckHistoricalTxStatus available,
const TTxIDExtractor &  extractor 
)

◆ _adapter_v4()

template<class TQueryHandler , class TEndpointFunction , class TEndpointContext , class TTxIDExtractor , class TErrorHandler >
TEndpointFunction ccf::historical::_adapter_v4 ( const TQueryHandler &  f,
ccf::AbstractNodeContext node_context,
const CheckHistoricalTxStatus available,
const TTxIDExtractor &  extractor,
const TErrorHandler &  ehandler 
)

◆ adapter_v3()

ccf::endpoints::EndpointFunction ccf::historical::adapter_v3 ( const HandleHistoricalQuery f,
ccf::AbstractNodeContext node_context,
const CheckHistoricalTxStatus available,
const TxIDExtractor extractor = txid_from_header 
)

◆ default_error_handler()

void ccf::historical::default_error_handler ( HistoricalQueryErrorCode  err,
std::string  reason,
endpoints::CommandEndpointContext args 
)

◆ find_previous_service_identity()

std::optional< ServiceInfo > ccf::historical::find_previous_service_identity ( ccf::kv::ReadOnlyTx tx,
ccf::historical::StatePtr state,
AbstractStateCache state_cache 
)

◆ is_tx_committed_v2()

HistoricalTxStatus ccf::historical::is_tx_committed_v2 ( ccf::kv::Consensus consensus,
ccf::View  view,
ccf::SeqNo  seqno,
std::string &  error_reason 
)

◆ populate_cose_service_endorsements()

bool ccf::historical::populate_cose_service_endorsements ( ccf::kv::ReadOnlyTx tx,
ccf::historical::StatePtr state,
AbstractStateCache state_cache 
)

◆ populate_service_endorsements()

bool ccf::historical::populate_service_endorsements ( ccf::kv::ReadOnlyTx tx,
ccf::historical::StatePtr state,
AbstractStateCache state_cache,
std::shared_ptr< NetworkIdentitySubsystemInterface network_identity_subsystem 
)

◆ read_only_adapter_v3()

ccf::endpoints::ReadOnlyEndpointFunction ccf::historical::read_only_adapter_v3 ( const HandleReadOnlyHistoricalQuery f,
ccf::AbstractNodeContext node_context,
const CheckHistoricalTxStatus available,
const ReadOnlyTxIDExtractor extractor = txid_from_header 
)

◆ read_only_adapter_v4()

ccf::endpoints::ReadOnlyEndpointFunction ccf::historical::read_only_adapter_v4 ( const HandleReadOnlyHistoricalQuery f,
ccf::AbstractNodeContext node_context,
const CheckHistoricalTxStatus available,
const ReadOnlyTxIDExtractor extractor = txid_from_header,
const ReadOnlyErrorHandler ehandler = default_error_handler 
)

◆ read_write_adapter_v3()

ccf::endpoints::EndpointFunction ccf::historical::read_write_adapter_v3 ( const HandleReadWriteHistoricalQuery f,
ccf::AbstractNodeContext node_context,
const CheckHistoricalTxStatus available,
const TxIDExtractor extractor = txid_from_header 
)

◆ read_write_adapter_v4()

ccf::endpoints::EndpointFunction ccf::historical::read_write_adapter_v4 ( const HandleReadWriteHistoricalQuery f,
ccf::AbstractNodeContext node_context,
const CheckHistoricalTxStatus available,
const TxIDExtractor extractor = txid_from_header,
const ErrorHandler ehandler = default_error_handler 
)

◆ txid_from_header()

std::optional< ccf::TxID > ccf::historical::txid_from_header ( endpoints::CommandEndpointContext args)