OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
parsec/util.hpp
Go to the documentation of this file.
1// Copyright (c) 2021 MIT Digital Currency Initiative,
2// Federal Reserve Bank of Boston
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef OPENCBDC_TX_SRC_PARSEC_UTIL_H_
7#define OPENCBDC_TX_SRC_PARSEC_UTIL_H_
8
12
13namespace cbdc::parsec {
15 enum class load_type {
19 erc20
20 };
21
23 enum class runner_type {
25 lua,
27 evm
28 };
29
31 struct config {
33 std::vector<network::endpoint_t> m_ticket_machine_endpoints;
39 std::vector<std::vector<network::endpoint_t>> m_shard_endpoints;
42 std::optional<size_t> m_node_id;
44 std::vector<network::endpoint_t> m_agent_endpoints;
54 };
55
61 auto read_config(int argc, char** argv) -> std::optional<config>;
62
70 auto put_row(const std::shared_ptr<broker::interface>& broker,
73 const std::function<void(bool)>& result_callback) -> bool;
74
82 auto get_row(const std::shared_ptr<broker::interface>& broker,
84 const std::function<void(
86 result_callback)
88}
89
90#endif
Buffer to store and retrieve byte data.
Definition buffer.hpp:15
std::variant< value_type, error_code, runtime_locking_shard::shard_error > try_lock_return_type
Return type from a try lock operation.
Tools for reading options from a configuration file and building application-specific parameter sets ...
log_level
Set of possible log levels.
Definition logging.hpp:34
runner_type
Execution/transaction model.
@ evm
Ethereum-style transactions using EVM.
@ lua
Transaction semantics defined using Lua.
auto put_row(const std::shared_ptr< broker::interface > &broker, broker::key_type key, broker::value_type value, const std::function< void(bool)> &result_callback) -> bool
Asynchronously inserts the given row into the cluster.
Definition util.cpp:195
load_type
Type of load to generate for benchmarking.
@ erc20
ERC20 token transfer.
@ transfer
Base token transfer.
auto read_config(int argc, char **argv) -> std::optional< config >
Reads the configuration parameters from the program arguments.
Definition util.cpp:100
auto get_row(const std::shared_ptr< broker::interface > &broker, broker::key_type key, const std::function< void(cbdc::parsec::broker::interface::try_lock_return_type)> &result_callback) -> cbdc::parsec::broker::interface::try_lock_return_type
Asynchronously get the value stored at key from the cluster.
Definition util.cpp:250
Configuration parameters for a phase two system.
std::vector< network::endpoint_t > m_ticket_machine_endpoints
RPC endpoints for the nodes in the ticket machine raft cluster.
double m_contention_rate
The percentage of transactions that are using the same account to simulate contention.
size_t m_component_id
ID of the component the instance should be.
std::optional< size_t > m_node_id
ID of the node within the component the instance should be, if applicable.
logging::log_level m_loglevel
Log level to use, defaults to WARN.
load_type m_load_type
Type of transactions load generators should produce.
std::vector< network::endpoint_t > m_agent_endpoints
RPC endpoints for the agents.
size_t m_loadgen_accounts
The number of simultaneous load generator threads.
runner_type m_runner_type
Type of execution environment to use in the agent.
std::vector< std::vector< network::endpoint_t > > m_shard_endpoints
RPC endpoints for the nodes in the shard raft clusters.