6#ifndef OPENCBDC_TX_SRC_PARSEC_AGENT_RUNNERS_INTERFACE_H_
7#define OPENCBDC_TX_SRC_PARSEC_AGENT_RUNNERS_INTERFACE_H_
69 using factory_type = std::function<std::unique_ptr<interface>(
70 std::shared_ptr<logging::log> logger,
77 std::shared_ptr<secp256k1_context>,
78 std::shared_ptr<thread_pool> t_pool,
96 interface(std::shared_ptr<logging::log> logger,
100 bool is_readonly_run,
103 std::shared_ptr<secp256k1_context> secp,
104 std::shared_ptr<thread_pool> t_pool,
117 [[nodiscard]]
virtual auto run() ->
bool = 0;
123 std::shared_ptr<logging::log> m_log;
127 bool m_is_readonly_run;
130 std::shared_ptr<secp256k1_context> m_secp;
131 std::shared_ptr<thread_pool> m_threads;
144 create(std::shared_ptr<logging::log> logger,
148 bool is_readonly_run,
151 std::shared_ptr<secp256k1_context> secp,
152 std::shared_ptr<thread_pool> t_pool,
154 -> std::unique_ptr<runner::interface> {
155 return std::make_unique<T>(std::move(logger),
160 std::move(result_callback),
161 std::move(try_lock_callback),
Buffer to store and retrieve byte data.
Executes EVM transactions, implementing the runner interface.
Runner factory for agents to intiantiate new runners of a particular type while only worrying about t...
static auto create(std::shared_ptr< logging::log > logger, cbdc::parsec::config cfg, runtime_locking_shard::value_type function, parameter_type param, bool is_readonly_run, runner::interface::run_callback_type result_callback, runner::interface::try_lock_callback_type try_lock_callback, std::shared_ptr< secp256k1_context > secp, std::shared_ptr< thread_pool > t_pool, runner::interface::ticket_number_type ticket_number) -> std::unique_ptr< runner::interface >
Construct a new runner of type T.
Interface for a contract runner.
virtual ~interface()=default
std::function< void(run_return_type)> run_callback_type
Callback type for function execution.
interface(interface &&)=delete
std::function< std::unique_ptr< 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, runner::interface::run_callback_type result_callback, runner::interface::try_lock_callback_type try_lock_callback, std::shared_ptr< secp256k1_context >, std::shared_ptr< thread_pool > t_pool, ticket_number_type ticket_number)> factory_type
Factory function type for instantiating new runners.
virtual auto run() -> bool=0
Begins function execution.
std::function< bool(broker::key_type, broker::lock_type, broker::interface::try_lock_callback_type)> try_lock_callback_type
Callback function type for acquiring locks during function execution.
auto operator=(const interface &) -> interface &=delete
std::variant< runtime_locking_shard::state_update_type, error_code > run_return_type
Return type from executing a function.
auto operator=(interface &&) -> interface &=delete
parsec::ticket_machine::ticket_number_type ticket_number_type
Type alias for a ticket number.
error_code
Error codes return during function execution.
@ yield_count
Function yielded more than one key to lock.
@ wounded
Ticket wounded during execution.
@ internal_error
Internal Runner error.
@ result_count
Function more than one result.
@ result_value_type
Function did not return a string value.
@ yield_type
Function yielded a invalid datatype.
@ function_load
Error loading function bytecode.
@ lock_error
Error acquiring lock on key.
@ result_type
Function did not return a map.
@ result_key_type
Function did not return a string key.
@ exec_error
Runner error during function execution.
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.
std::function< void(try_lock_return_type)> try_lock_callback_type
Callback function type for a try lock operation.
std:: unordered_map< key_type, value_type, hashing::const_sip_hash< key_type > > state_update_type
Type for state updates to a shard. A map of keys and their new values.
lock_type
Types of key lock supported by shards.
uint64_t ticket_number_type
Type alias for a ticket number.
Configuration parameters for a phase two system.