Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #include <utility>
7 :
8 : #include "multi_sig_transactions/storage/mst_storage.hpp"
9 :
10 : namespace iroha {
11 : MstStorage::MstStorage(logger::LoggerPtr log) : log_{std::move(log)} {}
12 :
13 : StateUpdateResult MstStorage::apply(
14 : const shared_model::crypto::PublicKey &target_peer_key,
15 : const MstState &new_state) {
16 3 : std::lock_guard<std::mutex> lock{this->mutex_};
17 3 : return applyImpl(target_peer_key, new_state);
18 3 : }
19 :
20 : StateUpdateResult MstStorage::updateOwnState(const DataType &tx) {
21 41 : std::lock_guard<std::mutex> lock{this->mutex_};
22 41 : return updateOwnStateImpl(tx);
23 41 : }
24 :
25 : MstState MstStorage::getExpiredTransactions(const TimeType ¤t_time) {
26 24 : std::lock_guard<std::mutex> lock{this->mutex_};
27 24 : return getExpiredTransactionsImpl(current_time);
28 24 : }
29 :
30 : MstState MstStorage::getDiffState(
31 : const shared_model::crypto::PublicKey &target_peer_key,
32 : const TimeType ¤t_time) {
33 25 : std::lock_guard<std::mutex> lock{this->mutex_};
34 25 : return getDiffStateImpl(target_peer_key, current_time);
35 25 : }
36 :
37 : MstState MstStorage::whatsNew(ConstRefState new_state) const {
38 0 : std::lock_guard<std::mutex> lock{this->mutex_};
39 0 : return whatsNewImpl(new_state);
40 0 : }
41 :
42 : bool MstStorage::batchInStorage(const DataType &batch) const {
43 726 : return batchInStorageImpl(batch);
44 : }
45 : } // namespace iroha
|