OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
cbdc::coordinator::interface Class Referenceabstract

Interface for a coordinator. More...

#include <interface.hpp>

Inheritance diagram for cbdc::coordinator::interface:

Public Types

using callback_type = std::function<void(std::optional<bool>)>
 Signature of callback function for a transaction execution result.
 

Public Member Functions

virtual ~interface ()=default
 
 interface ()=default
 
 interface (const interface &)=delete
 
auto operator= (const interface &) -> interface &=delete
 
 interface (interface &&)=delete
 
auto operator= (interface &&) -> interface &=delete
 
virtual auto execute_transaction (transaction::compact_tx tx, callback_type result_callback) -> bool=0
 Execute the given compact transaction.
 

Detailed Description

Interface for a coordinator.

Provides consistent semantics whether using a remote coordinator via an RPC client, or a local implementation directly. An RPC server can use this interface to handle requests without knowing how the interface is implemented. Allows for easier mocking in test suites and swapping implementations without changing dependent components.

Definition at line 20 of file uhs/twophase/coordinator/interface.hpp.

Member Typedef Documentation

◆ callback_type

using cbdc::coordinator::interface::callback_type = std::function<void(std::optional<bool>)>

Signature of callback function for a transaction execution result.

Definition at line 30 of file uhs/twophase/coordinator/interface.hpp.

Constructor & Destructor Documentation

◆ ~interface()

virtual cbdc::coordinator::interface::~interface ( )
virtualdefault

◆ interface() [1/3]

cbdc::coordinator::interface::interface ( )
default

◆ interface() [2/3]

cbdc::coordinator::interface::interface ( const interface & )
delete

◆ interface() [3/3]

cbdc::coordinator::interface::interface ( interface && )
delete

Member Function Documentation

◆ execute_transaction()

virtual auto cbdc::coordinator::interface::execute_transaction ( transaction::compact_tx tx,
callback_type result_callback ) -> bool
pure virtual

Execute the given compact transaction.

An RPC client subclass would send a request to a remote coordinator and wait for the response. A coordinator implementation would coordinate the transaction between locking shards and return the execution result.

Parameters
txtransaction to execute.
result_callbackfunction to call when the transaction has executed to completion or failed.
Returns
true if the implementation started executing the transaction.

Implemented in cbdc::coordinator::controller, and cbdc::coordinator::rpc::client.

Referenced by cbdc::coordinator::rpc::server::server().

◆ operator=() [1/2]

auto cbdc::coordinator::interface::operator= ( const interface & ) -> interface &=delete
delete

◆ operator=() [2/2]

auto cbdc::coordinator::interface::operator= ( interface && ) -> interface &=delete
delete

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