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_MST_TYPES_HPP
7 : #define IROHA_MST_TYPES_HPP
8 :
9 : #include <memory>
10 :
11 : #include "interfaces/common_objects/types.hpp"
12 :
13 : namespace shared_model {
14 : namespace interface {
15 : class TransactionBatch;
16 : class TransactionResponse;
17 : class Peer;
18 : } // namespace interface
19 : } // namespace shared_model
20 :
21 : namespace iroha {
22 :
23 : using BatchPtr = std::shared_ptr<shared_model::interface::TransactionBatch>;
24 : using ConstPeer = const shared_model::interface::Peer;
25 : using TimeType = shared_model::interface::types::TimestampType;
26 : using TxResponse =
27 : std::shared_ptr<shared_model::interface::TransactionResponse>;
28 :
29 : template <typename T>
30 : using ConstRefT = const T &;
31 :
32 : using ConstRefBatch = ConstRefT<BatchPtr>;
33 : using ConstRefPeer = ConstRefT<shared_model::interface::Peer>;
34 : using ConstRefTime = ConstRefT<TimeType>;
35 :
36 : class MstState;
37 :
38 : using ConstRefState = ConstRefT<MstState>;
39 :
40 : using DataType = BatchPtr;
41 :
42 : /**
43 : * Contains result of updating local state:
44 : * - state with completed batches
45 : * - state with updated (still not enough signatures) batches
46 : */
47 : struct StateUpdateResult {
48 : StateUpdateResult(std::shared_ptr<MstState> completed_state,
49 : std::shared_ptr<MstState> updated_state)
50 114 : : completed_state_{std::move(completed_state)},
51 114 : updated_state_{std::move(updated_state)} {}
52 : std::shared_ptr<MstState> completed_state_;
53 : std::shared_ptr<MstState> updated_state_;
54 : };
55 : } // namespace iroha
56 :
57 : #endif // IROHA_MST_TYPES_HPP
|