OpenCBDC Transaction Processor
|
Interface for an agent. More...
#include <interface.hpp>
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. | |
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.
using cbdc::parsec::agent::interface::exec_callback_type = std::function<void(exec_return_type)> |
Callback function type with function execution result.
Definition at line 52 of file parsec/agent/interface.hpp.
using cbdc::parsec::agent::interface::exec_return_type = std::variant<return_type, error_code> |
Return type from function execution.
Either the committed state updates or an error code.
Definition at line 50 of file parsec/agent/interface.hpp.
|
strong |
Error codes returned by agent operations.
Definition at line 29 of file parsec/agent/interface.hpp.
|
virtualdefault |
|
delete |
|
delete |
cbdc::parsec::agent::interface::interface | ( | runtime_locking_shard::key_type | function, |
parameter_type | param, | ||
exec_callback_type | result_callback ) |
Constructor.
function | key where function bytecode is located. |
param | parameter to call function with. |
result_callback | function to call with execution result. |
Definition at line 9 of file parsec/agent/interface.cpp.
|
pure virtual |
Executes the function managed by this agent with the given parameter.
Implemented in cbdc::parsec::agent::impl.
|
nodiscard |
Return the key of the function bytecode managed by this agent.
Definition at line 16 of file parsec/agent/interface.cpp.
|
nodiscard |
Return the function parameter managed by this agent.
Definition at line 20 of file parsec/agent/interface.cpp.
|
nodiscard |
Return the result callback function stored by this agent.
Definition at line 24 of file parsec/agent/interface.cpp.