LCOV - code coverage report
Current view: top level - irohad/main/impl - consensus_init.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 3 3 100.0 %
Date: 2019-03-07 14:46:43 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef IROHA_CONSENSUS_INIT_HPP
       7             : #define IROHA_CONSENSUS_INIT_HPP
       8             : 
       9             : #include <memory>
      10             : 
      11             : #include "ametsuchi/peer_query_factory.hpp"
      12             : #include "consensus/consensus_block_cache.hpp"
      13             : #include "consensus/yac/outcome_messages.hpp"
      14             : #include "consensus/yac/timer.hpp"
      15             : #include "consensus/yac/transport/impl/network_impl.hpp"
      16             : #include "consensus/yac/yac.hpp"
      17             : #include "consensus/yac/yac_gate.hpp"
      18             : #include "consensus/yac/yac_hash_provider.hpp"
      19             : #include "consensus/yac/yac_peer_orderer.hpp"
      20             : #include "cryptography/keypair.hpp"
      21             : #include "interfaces/common_objects/common_objects_factory.hpp"
      22             : #include "logger/logger_manager_fwd.hpp"
      23             : #include "network/block_loader.hpp"
      24             : #include "network/impl/async_grpc_client.hpp"
      25             : #include "simulator/block_creator.hpp"
      26             : 
      27             : namespace iroha {
      28             :   namespace consensus {
      29             :     namespace yac {
      30             : 
      31             :       class YacInit {
      32             :        public:
      33             :         std::shared_ptr<YacGate> initConsensusGate(
      34             :             std::shared_ptr<ametsuchi::PeerQueryFactory> peer_query_factory,
      35             :             std::shared_ptr<simulator::BlockCreator> block_creator,
      36             :             std::shared_ptr<network::BlockLoader> block_loader,
      37             :             const shared_model::crypto::Keypair &keypair,
      38             :             std::shared_ptr<consensus::ConsensusResultCache> block_cache,
      39             :             std::chrono::milliseconds vote_delay_milliseconds,
      40             :             std::shared_ptr<
      41             :                 iroha::network::AsyncGrpcClient<google::protobuf::Empty>>
      42             :                 async_call,
      43             :             std::shared_ptr<shared_model::interface::CommonObjectsFactory>
      44             :                 common_objects_factory,
      45             :             ConsistencyModel consistency_model,
      46             :             const logger::LoggerManagerTreePtr &consensus_log_manager);
      47             : 
      48             :         std::shared_ptr<NetworkImpl> getConsensusNetwork() const;
      49             : 
      50             :        private:
      51             :         auto createTimer(std::chrono::milliseconds delay_milliseconds);
      52             : 
      53             :         // coordinator has a worker, and a factory for coordinated
      54             :         // observables, subscribers and schedulable functions.
      55             :         //
      56             :         // A new thread scheduler is created
      57             :         // by calling .create_coordinator().get_scheduler()
      58         247 :         rxcpp::observe_on_one_worker coordination_{
      59         247 :             rxcpp::observe_on_new_thread()};
      60             : 
      61         247 :         bool initialized_{false};
      62             :         std::shared_ptr<NetworkImpl> consensus_network_;
      63             :       };
      64             :     }  // namespace yac
      65             :   }    // namespace consensus
      66             : }  // namespace iroha
      67             : 
      68             : #endif  // IROHA_CONSENSUS_INIT_HPP

Generated by: LCOV version 1.13