github.com/igggame/nebulas-go@v2.1.0+incompatible/nbre/cmd/dummy_neb/dummies/stress_dummy.h (about) 1 // Copyright (C) 2018 go-nebulas authors 2 // 3 // This file is part of the go-nebulas library. 4 // 5 // the go-nebulas library is free software: you can redistribute it and/or 6 // modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // (at your option) any later version. 10 // 11 // the go-nebulas library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with the go-nebulas library. If not, see 18 // <http://www.gnu.org/licenses/>. 19 // 20 #pragma once 21 #include "cmd/dummy_neb/dummies/dummy_base.h" 22 #include "cmd/dummy_neb/generator/generators.h" 23 24 class stress_dummy : public dummy_base { 25 public: 26 stress_dummy(const std::string &name, int initial_account_num, 27 nas initial_nas, int account_num, int contract_num, 28 int transfer_tx_num, int call_tx_num, 29 const std::string &rpc_listen, uint16_t rpc_port); 30 31 virtual ~stress_dummy(); 32 virtual std::shared_ptr<generate_block> generate_LIB_block(); 33 34 virtual std::shared_ptr<checker_task_base> generate_checker_task(); 35 virtual address_t get_auth_admin_addr(); 36 37 private: 38 void handle_cli_pkgs(); 39 40 void init_ir_and_accounts(); 41 42 private: 43 all_accounts m_all_accounts; 44 std::unique_ptr<transaction_generator> m_tx_gen; 45 std::unique_ptr<genesis_generator> m_genesis_gen; 46 std::unique_ptr<call_tx_generator> m_call_gen; 47 std::unique_ptr<contract_generator> m_contract_gen; 48 std::unique_ptr<cli_generator> m_cli_generator; 49 50 std::unique_ptr<auth_table_generator> m_auth_gen; 51 std::unique_ptr<nr_ir_generator> m_nr_gen; 52 std::unique_ptr<dip_ir_generator> m_dip_gen; 53 54 int m_initial_account_num; 55 nas m_initial_nas; 56 int m_account_num; 57 int m_contract_num; 58 int m_transfer_tx_num; 59 int m_call_tx_num; 60 61 std::string m_rpc_listen; 62 uint16_t m_rpc_port; 63 64 address_t m_auth_admin_addr; 65 66 std::unique_ptr<std::thread> m_thread; 67 neb::util::wakeable_queue<std::shared_ptr<ff::net::package>> m_pkgs; 68 ff::net::tcp_connection_base_ptr m_conn; 69 ff::net::net_nervure *m_p_nn; 70 };