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

Interface for an agent. More...

#include <interface.hpp>

Inheritance diagram for cbdc::parsec::agent::interface:

Public Types

enum class  error_code : uint8_t {
  broker_unreachable , ticket_number_assignment , function_retrieval , function_execution ,
  commit_error , finish_error , rollback_error , retry
}
 Error codes returned by agent operations. More...
 
using exec_return_type = std::variant<return_type, error_code>
 Return type from function execution.
 
using exec_callback_type = std::function<void(exec_return_type)>
 Callback function type with function execution result.
 

Public Member Functions

virtual ~interface ()=default
 
 interface (const interface &)=delete
 
auto operator= (const interface &) -> interface &=delete
 
 interface (interface &&)=delete
 
auto operator= (interface &&) -> interface &=delete
 
 interface (runtime_locking_shard::key_type function, parameter_type param, exec_callback_type result_callback)
 Constructor.
 
virtual auto exec () -> bool=0
 Executes the function managed by this agent with the given parameter.
 
auto get_function () const -> runtime_locking_shard::key_type
 Return the key of the function bytecode managed by this agent.
 
auto get_param () const -> parameter_type
 Return the function parameter managed by this agent.
 
auto get_result_callback () const -> exec_callback_type
 Return the result callback function stored by this agent.
 

Detailed Description

Interface for an agent.

Manages the lifetime of a single transaction/ function execution/ticket and communication with the broker.

Definition at line 19 of file parsec/agent/interface.hpp.

Member Typedef Documentation

◆ exec_callback_type

Callback function type with function execution result.

Definition at line 52 of file parsec/agent/interface.hpp.

◆ exec_return_type

Return type from function execution.

Either the committed state updates or an error code.

Definition at line 50 of file parsec/agent/interface.hpp.

Member Enumeration Documentation

◆ error_code

enum class cbdc::parsec::agent::interface::error_code : uint8_t
strong

Error codes returned by agent operations.

Enumerator
broker_unreachable 

Broker was unreachable.

ticket_number_assignment 

Ticket number assignment failed.

function_retrieval 

Error retrieving function bytecode.

function_execution 

Error during function execution.

commit_error 

Error committing the function state updates.

finish_error 

Error finishing the ticket.

rollback_error 

Error during rollback.

retry 

Transient error, execution should be retried.

Definition at line 29 of file parsec/agent/interface.hpp.

Constructor & Destructor Documentation

◆ ~interface()

virtual cbdc::parsec::agent::interface::~interface ( )
virtualdefault

◆ interface() [1/3]

cbdc::parsec::agent::interface::interface ( const interface & )
delete

◆ interface() [2/3]

cbdc::parsec::agent::interface::interface ( interface && )
delete

◆ interface() [3/3]

cbdc::parsec::agent::interface::interface ( runtime_locking_shard::key_type function,
parameter_type param,
exec_callback_type result_callback )

Constructor.

Parameters
functionkey where function bytecode is located.
paramparameter to call function with.
result_callbackfunction to call with execution result.

Definition at line 9 of file parsec/agent/interface.cpp.

Member Function Documentation

◆ exec()

virtual auto cbdc::parsec::agent::interface::exec ( ) -> bool
pure virtual

Executes the function managed by this agent with the given parameter.

Returns
true if function execution was intiated successfully.

Implemented in cbdc::parsec::agent::impl.

◆ get_function()

auto cbdc::parsec::agent::interface::get_function ( ) const -> runtime_locking_shard::key_type
nodiscard

Return the key of the function bytecode managed by this agent.

Returns
function bytecode key.

Definition at line 16 of file parsec/agent/interface.cpp.

◆ get_param()

auto cbdc::parsec::agent::interface::get_param ( ) const -> parameter_type
nodiscard

Return the function parameter managed by this agent.

Returns
function parameter.

Definition at line 20 of file parsec/agent/interface.cpp.

◆ get_result_callback()

auto cbdc::parsec::agent::interface::get_result_callback ( ) const -> exec_callback_type
nodiscard

Return the result callback function stored by this agent.

Returns
result callback function.

Definition at line 24 of file parsec/agent/interface.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

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