Fabcoin Core  0.16.2
P2P Digital Currency
storageresults.h
Go to the documentation of this file.
1 #include <util.h>
2 #include <libethereum/State.h>
5 #include <uint256.h>
6 
7 using logEntriesSerializ = std::vector<std::pair<dev::Address, std::pair<dev::h256s, dev::bytes>>>;
8 
11  uint32_t blockNumber;
13  uint32_t transactionIndex;
17  uint64_t gasUsed;
21 };
22 
24  std::vector<dev::h256> blockHashes;
25  std::vector<uint32_t> blockNumbers;
26  std::vector<dev::h256> transactionHashes;
27  std::vector<uint32_t> transactionIndexes;
28  std::vector<dev::h160> senders;
29  std::vector<dev::h160> receivers;
30  std::vector<dev::u256> cumulativeGasUsed;
31  std::vector<dev::u256> gasUsed;
32  std::vector<dev::h160> contractAddresses;
33  std::vector<logEntriesSerializ> logs;
34  std::vector<uint32_t> excepted;
35 };
36 
38 {
39 public:
40  StorageResults(std::string const& _path);
41  ~StorageResults();
42 
43  void addResult(dev::h256 hashTx, std::vector<TransactionReceiptInfo>& result);
44 
45  void deleteResults(std::vector<CTransactionRef> const& txs);
46 
47  std::vector<TransactionReceiptInfo> getResult(dev::h256 const& hashTx);
48 
49  void commitResults();
50 
51  void clearCacheResult();
52 
53  void wipeResults();
54 
55 private:
56  bool readResult(dev::h256 const& _key, std::vector<TransactionReceiptInfo>& _result);
57 
58  logEntriesSerializ logEntriesSerialization(dev::eth::LogEntries const& _logs);
59 
60  dev::eth::LogEntries logEntriesDeserialize(logEntriesSerializ const& _logs);
61 
62  std::string path;
63 
65 
66  leveldb::Options options;
67 
68  std::unordered_map<dev::h256, std::vector<TransactionReceiptInfo>> m_cache_result;
69 };
std::vector< dev::h160 > senders
std::vector< std::pair< dev::Address, std::pair< dev::h256s, dev::bytes >>> logEntriesSerializ
Definition: storageresults.h:7
Definition: util.h:95
std::vector< dev::h160 > contractAddresses
std::vector< dev::u256 > cumulativeGasUsed
std::unordered_map< dev::h256, std::vector< TransactionReceiptInfo > > m_cache_result
std::vector< dev::h256 > transactionHashes
std::vector< uint32_t > blockNumbers
std::vector< uint32_t > transactionIndexes
dev::eth::LogEntries logs
std::vector< dev::h160 > receivers
std::vector< logEntriesSerializ > logs
std::vector< dev::u256 > gasUsed
dev::Address contractAddress
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
Definition: FixedHash.h:47
leveldb::Options options
std::vector< uint32_t > excepted
std::string path
std::vector< dev::h256 > blockHashes
leveldb::DB * db
256-bit opaque blob.
Definition: uint256.h:132
dev::eth::TransactionException excepted
TransactionException
Definition: Transaction.h:35
std::vector< LogEntry > LogEntries
Definition: ExtVMFace.h:110