OpenCBDC Transaction Processor
|
Interface for a contract runner. More...
#include <interface.hpp>
Public Types | |
enum class | error_code { result_value_type , result_key_type , result_type , result_count , exec_error , function_load , internal_error , yield_count , yield_type , lock_error , wounded } |
Error codes return during function execution. More... | |
using | ticket_number_type = parsec::ticket_machine::ticket_number_type |
Type alias for a ticket number. | |
using | run_return_type |
Return type from executing a function. | |
using | run_callback_type = std::function<void(run_return_type)> |
Callback type for function execution. | |
using | try_lock_callback_type |
Callback function type for acquiring locks during function execution. | |
using | factory_type |
Factory function type for instantiating new runners. | |
Public Member Functions | |
interface (std::shared_ptr< logging::log > logger, const cbdc::parsec::config &cfg, runtime_locking_shard::value_type function, parameter_type param, bool is_readonly_run, run_callback_type result_callback, try_lock_callback_type try_lock_callback, std::shared_ptr< secp256k1_context > secp, std::shared_ptr< thread_pool > t_pool, ticket_number_type ticket_number) | |
Constructor. | |
virtual | ~interface ()=default |
interface (const interface &)=delete | |
auto | operator= (const interface &) -> interface &=delete |
interface (interface &&)=delete | |
auto | operator= (interface &&) -> interface &=delete |
virtual auto | run () -> bool=0 |
Begins function execution. | |
Friends | |
class | lua_runner |
class | evm_runner |
Interface for a contract runner.
Subclasses should implement application logic to enforce specific transaction semantics.
Definition at line 21 of file parsec/agent/runners/interface.hpp.
Factory function type for instantiating new runners.
Definition at line 67 of file parsec/agent/runners/interface.hpp.
using cbdc::parsec::agent::runner::interface::run_callback_type = std::function<void(run_return_type)> |
Callback type for function execution.
Definition at line 57 of file parsec/agent/runners/interface.hpp.
Return type from executing a function.
Either the state updates committed after function execution or an error code.
Definition at line 54 of file parsec/agent/runners/interface.hpp.
using cbdc::parsec::agent::runner::interface::ticket_number_type = parsec::ticket_machine::ticket_number_type |
Type alias for a ticket number.
Definition at line 50 of file parsec/agent/runners/interface.hpp.
Callback function type for acquiring locks during function execution.
Accepts a key to lock and function to call with lock result. Returns true if request was initiated successfully.
Definition at line 62 of file parsec/agent/runners/interface.hpp.
|
strong |
Error codes return during function execution.
Definition at line 24 of file parsec/agent/runners/interface.hpp.
cbdc::parsec::agent::runner::interface::interface | ( | std::shared_ptr< logging::log > | logger, |
const cbdc::parsec::config & | cfg, | ||
runtime_locking_shard::value_type | function, | ||
parameter_type | param, | ||
bool | is_readonly_run, | ||
run_callback_type | result_callback, | ||
try_lock_callback_type | try_lock_callback, | ||
std::shared_ptr< secp256k1_context > | secp, | ||
std::shared_ptr< thread_pool > | t_pool, | ||
ticket_number_type | ticket_number ) |
Constructor.
logger | log instance. |
cfg | config reference. |
function | key of function bytecode to execute. |
param | parameter to pass to function. |
is_readonly_run | true if runner execution should not result in state changes. |
result_callback | function to call with function execution result. |
try_lock_callback | function to call for the function to request key locks. |
secp | shared context for libsecp256k1. |
t_pool | shared thread pool between agents. |
ticket_number | ticket number for the ticket managed by this runner instance. |
Definition at line 9 of file parsec/agent/runners/interface.cpp.
|
virtualdefault |
|
delete |
|
delete |
|
delete |
|
delete |
|
nodiscardpure virtual |
Begins function execution.
Retrieves the function bytecode using a read lock and executes it with the given parameter.
Implemented in cbdc::parsec::agent::runner::evm_runner, and cbdc::parsec::agent::runner::lua_runner.
|
friend |
Definition at line 118 of file parsec/agent/runners/interface.hpp.
|
friend |
Definition at line 117 of file parsec/agent/runners/interface.hpp.