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(
26  const TxPosition &position,
28  const shared_model::interface::types::HashType &committed_tx_hash)
29  override;
30 
31  void rejectedTxHash(
32  const TxPosition &position,
34  const shared_model::interface::types::HashType &rejected_tx_hash)
35  override;
36 
37  void txPositions(
40  boost::optional<shared_model::interface::types::AssetIdType>
41  &&asset_id,
43  TxPosition const &position) override;
44 
46 
47  private:
48  struct {
49  std::vector<std::string> hash;
50  std::vector<std::string> status;
51  } tx_hash_status_;
52 
53  struct {
54  std::vector<shared_model::interface::types::AccountIdType> account;
55  std::vector<std::string> hash;
56  std::vector<
57  boost::optional<shared_model::interface::types::AssetIdType>>
59  std::vector<shared_model::interface::types::TimestampType> ts;
60  std::vector<size_t> height;
61  std::vector<size_t> index;
62  } tx_positions_;
63 
65  void txHashStatus(const shared_model::interface::types::HashType &tx_hash,
66  bool is_committed);
67 
68  soci::session &sql_;
69  std::string cache_;
70  };
71 
72  } // namespace ametsuchi
73 } // namespace iroha
74 
75 #endif /* AMETSUCHI_POSTGRES_INDEXER_HPP */
Definition: block_query.hpp:17
Definition: hash.hpp:18
Definition: result_fwd.hpp:27
std::vector< shared_model::interface::types::TimestampType > ts
Definition: postgres_indexer.hpp:59
Definition: block_query.hpp:15
std::vector< std::string > hash
Definition: postgres_indexer.hpp:49
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:50
std::vector< size_t > height
Definition: postgres_indexer.hpp:60
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:61
Definition: indexer.hpp:21
std::vector< boost::optional< shared_model::interface::types::AssetIdType > > asset_id
Definition: postgres_indexer.hpp:58
std::vector< shared_model::interface::types::AccountIdType > account
Definition: postgres_indexer.hpp:54
uint64_t TimestampType
Type of timestamp.
Definition: types.hpp:69