Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved.
3 : * http://soramitsu.co.jp
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * See the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : #include "ametsuchi/impl/peer_query_wsv.hpp"
19 :
20 : #include <numeric>
21 :
22 : #include "ametsuchi/wsv_query.hpp"
23 :
24 : namespace iroha {
25 : namespace ametsuchi {
26 :
27 : PeerQueryWsv::PeerQueryWsv(std::shared_ptr<WsvQuery> wsv)
28 2458 : : wsv_(std::move(wsv)) {}
29 :
30 : boost::optional<std::vector<PeerQuery::wPeer>>
31 : PeerQueryWsv::getLedgerPeers() {
32 1925 : auto peers = wsv_->getPeers();
33 1925 : if (peers) {
34 1925 : return boost::make_optional(peers.value());
35 : } else {
36 0 : return boost::none;
37 : }
38 1925 : }
39 :
40 : } // namespace ametsuchi
41 : } // namespace iroha
|