LCOV - code coverage report
Current view: top level - irohad/ametsuchi/impl - wsv_restorer_impl.cpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 5 6 83.3 %
Date: 2019-03-07 14:46:43 Functions: 1 1 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             : #include "wsv_restorer_impl.hpp"
       7             : 
       8             : #include <vector>
       9             : 
      10             : #include "ametsuchi/block_query.hpp"
      11             : #include "ametsuchi/storage.hpp"
      12             : #include "interfaces/iroha_internal/block.hpp"
      13             : 
      14             : namespace iroha {
      15             :   namespace ametsuchi {
      16             :     expected::Result<void, std::string> WsvRestorerImpl::restoreWsv(
      17             :         Storage &storage) {
      18             :       // get all blocks starting from the genesis
      19             :       std::vector<std::shared_ptr<shared_model::interface::Block>> blocks=
      20         248 :       storage.getBlockQuery()->getBlocksFrom(1);
      21             : 
      22         248 :       storage.reset();
      23             : 
      24         248 :       if (not storage.insertBlocks(blocks))
      25           0 :         return expected::makeError("cannot insert blocks");
      26             : 
      27         248 :       return expected::Value<void>();
      28         248 :     }
      29             :   }  // namespace ametsuchi
      30             : }  // namespace iroha

Generated by: LCOV version 1.13