hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
postgres_indexer.hpp
Go to the documentation of this file.
1 
6 #ifndef AMETSUCHI_POSTGRES_INDEXER_HPP
7 #define AMETSUCHI_POSTGRES_INDEXER_HPP
8 
9 #include "ametsuchi/indexer.hpp"
10 
11 #include <string>
12 #include <vector>
13 
14 namespace soci {
15  class session;
16 }
17 
18 namespace iroha {
19  namespace ametsuchi {
20 
21  class PostgresIndexer final : public Indexer {
22  public:
23  PostgresIndexer(soci::session &sql);
24 
25  void committedTxHash(const shared_model::interface::types::HashType
26  &committed_tx_hash) override;
27 
28  void rejectedTxHash(const shared_model::interface::types::HashType
29  &rejected_tx_hash) override;
30 
31  void txPositions(
34  boost::optional<shared_model::interface::types::AssetIdType>
35  &&asset_id,
37  TxPosition const &position) override;
38 
40 
41  private:
42  struct {
43  std::vector<std::string> hash;
44  std::vector<std::string> status;
45  } tx_hash_status_;
46 
47  struct {
48  std::vector<shared_model::interface::types::AccountIdType> account;
49  std::vector<std::string> hash;
50  std::vector<
51  boost::optional<shared_model::interface::types::AssetIdType>>
53  std::vector<shared_model::interface::types::TimestampType> ts;
54  std::vector<size_t> height;
55  std::vector<size_t> index;
56  } tx_positions_;
57 
59  void txHashStatus(const shared_model::interface::types::HashType &tx_hash,
60  bool is_committed);
61 
62  soci::session &sql_;
63  };
64 
65  } // namespace ametsuchi
66 } // namespace iroha
67 
68 #endif /* AMETSUCHI_POSTGRES_INDEXER_HPP */
Definition: hash.hpp:18
Definition: result_fwd.hpp:27
std::vector< shared_model::interface::types::TimestampType > ts
Definition: postgres_indexer.hpp:53
Definition: block_query.hpp:15
std::vector< std::string > hash
Definition: postgres_indexer.hpp:43
std::string AccountIdType
Type of account id.
Definition: types.hpp:38
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
std::vector< std::string > status
Definition: postgres_indexer.hpp:44
std::vector< size_t > height
Definition: postgres_indexer.hpp:54
Position of a transaction in the ledger.
Definition: indexer.hpp:26
Definition: postgres_indexer.hpp:21
Definition: pool_wrapper.hpp:11
std::vector< size_t > index
Definition: postgres_indexer.hpp:55
Definition: indexer.hpp:21
std::vector< boost::optional< shared_model::interface::types::AssetIdType > > asset_id
Definition: postgres_indexer.hpp:52
std::vector< shared_model::interface::types::AccountIdType > account
Definition: postgres_indexer.hpp:48
uint64_t TimestampType
Type of timestamp.
Definition: types.hpp:67