hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
tx_status_factory.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_TX_STATUS_FACTORY_HPP
7 #define IROHA_TX_STATUS_FACTORY_HPP
8 
9 #include <memory>
10 
12 
13 namespace shared_model {
14  namespace interface {
15 
20  public:
22  using FactoryReturnType = std::unique_ptr<TransactionResponse>;
23 
25  using TransactionHashType =
27 
32 
37 
41 
44  std::decay_t<StatelessErrorOrFailedCommandNameType> cmd_name_;
47 
48  TransactionError() : cmd_name_{}, cmd_index_{}, error_code_{} {}
50  FailedCommandIndexType cmd_index,
51  ErrorCodeType error_code)
52  : cmd_name_{cmd_name},
53  cmd_index_{cmd_index},
54  error_code_{error_code} {}
55  };
56 
57  // ------------------------| Stateless statuses |-------------------------
58 
62  TransactionError tx_error = TransactionError()) = 0;
63 
67  TransactionError tx_error = TransactionError()) = 0;
68 
69  // ------------------------| Stateful statuses |--------------------------
70 
74  TransactionError tx_error = TransactionError()) = 0;
78  TransactionError tx_error = TransactionError()) = 0;
79 
80  // --------------------------| Final statuses |---------------------------
81 
85  TransactionError tx_error = TransactionError()) = 0;
86 
90  TransactionError tx_error = TransactionError()) = 0;
91 
92  // --------------------------| Rest statuses |----------------------------
93 
97  TransactionError tx_error = TransactionError()) = 0;
98 
102  TransactionError tx_error = TransactionError()) = 0;
103 
107  TransactionError tx_error = TransactionError()) = 0;
108 
112  TransactionError tx_error = TransactionError()) = 0;
113 
114  virtual ~TxStatusFactory() = default;
115  };
116  } // namespace interface
117 } // namespace shared_model
118 
119 #endif // IROHA_TX_STATUS_FACTORY_HPP
virtual FactoryReturnType makeMstPending(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates transaction pending status.
uint32_t ErrorCodeType
Type of command error code.
Definition: tx_response.hpp:87
TransactionError(StatelessErrorOrFailedCommandNameType cmd_name, FailedCommandIndexType cmd_index, ErrorCodeType error_code)
Definition: tx_status_factory.hpp:49
virtual FactoryReturnType makeStatelessFail(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates stateless failed transaction status.
Definition: tx_status_factory.hpp:19
virtual FactoryReturnType makeCommitted(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates committed transaction status.
Definition: hash.hpp:18
TransactionResponse::FailedCommandIndexType FailedCommandIndexType
Definition: tx_status_factory.hpp:36
FailedCommandIndexType cmd_index_
Definition: tx_status_factory.hpp:45
std::string StatelessErrorOrFailedCommandNameType
Definition: tx_response.hpp:72
const TransactionResponse::StatelessErrorOrFailedCommandNameType & StatelessErrorOrFailedCommandNameType
Definition: tx_status_factory.hpp:31
size_t FailedCommandIndexType
Type of command index, which failed validation.
Definition: tx_response.hpp:80
virtual FactoryReturnType makeStatefulValid(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates stateful valid transaction status.
std::decay_t< StatelessErrorOrFailedCommandNameType > cmd_name_
Definition: tx_status_factory.hpp:44
virtual FactoryReturnType makeNotReceived(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates transaction is not received status.
ErrorCodeType error_code_
Definition: tx_status_factory.hpp:46
virtual FactoryReturnType makeEnoughSignaturesCollected(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates status which shows that enough signatures were collected.
virtual FactoryReturnType makeRejected(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates rejected transaction status.
virtual FactoryReturnType makeStatefulFail(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates stateful failed transaction status.
represents transaction error, empty or not
Definition: tx_status_factory.hpp:43
virtual FactoryReturnType makeStatelessValid(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates stateless valid transaction status.
TransactionResponse::ErrorCodeType ErrorCodeType
Definition: tx_status_factory.hpp:40
virtual FactoryReturnType makeMstExpired(TransactionHashType, TransactionError tx_error=TransactionError())=0
Creates transaction expired status.
TransactionError()
Definition: tx_status_factory.hpp:48
std::unique_ptr< TransactionResponse > FactoryReturnType
return type of all generative methods
Definition: tx_status_factory.hpp:22
Definition: command_executor.hpp:12