CCF
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ccf::indexing::Strategy Class Referenceabstract

#include <strategy.h>

Inherited by ccf::indexing::strategies::VisitEachEntryInMap, and loggingapp::CommittedRecords.

Public Member Functions

 Strategy (const std::string &name)
 
virtual ~Strategy ()=default
 
std::string get_name () const
 
virtual void handle_committed_transaction (const ccf::TxID &tx_id, const ccf::kv::ReadOnlyStorePtr &store)=0
 
virtual void tick ()
 
virtual std::optional< ccf::SeqNonext_requested ()=0
 
virtual nlohmann::json describe ()
 

Detailed Description

The base class for all indexing strategies.

Sub-class this and override handle_committed_transaction to implement your own indexing strategy. Create an instance of this on each node, and then install it with context.get_indexing_strategies().install_strategy(). It will then be given each committed transaction shortly after commit. You should build some aggregate/summary from these transactions, and return that to endpoint handlers in an efficient format.

Constructor & Destructor Documentation

◆ Strategy()

ccf::indexing::Strategy::Strategy ( const std::string &  name)
inline

◆ ~Strategy()

virtual ccf::indexing::Strategy::~Strategy ( )
virtualdefault

Member Function Documentation

◆ describe()

virtual nlohmann::json ccf::indexing::Strategy::describe ( )
inlinevirtual

◆ get_name()

std::string ccf::indexing::Strategy::get_name ( ) const
inline

◆ handle_committed_transaction()

virtual void ccf::indexing::Strategy::handle_committed_transaction ( const ccf::TxID tx_id,
const ccf::kv::ReadOnlyStorePtr store 
)
pure virtual

Receives every committed transaction, in-order, shortly after commit.

The given store contains only the changes that occured in the current transaction.

Implemented in ccf::indexing::strategies::VisitEachEntryInMap, and loggingapp::CommittedRecords.

◆ next_requested()

virtual std::optional< ccf::SeqNo > ccf::indexing::Strategy::next_requested ( )
pure virtual

Returns next tx for which this index should be populated, or nullopt if it wants none. Allows indexes to be populated lazily on-demand, or out-of-order, or reset

Implemented in ccf::indexing::strategies::VisitEachEntryInMap, and loggingapp::CommittedRecords.

◆ tick()

virtual void ccf::indexing::Strategy::tick ( )
inlinevirtual

The documentation for this class was generated from the following file: