24
24
25
25
#include < silkworm/infra/concurrency/task.hpp>
26
26
27
+ #include < silkworm/db/chain/local_chain_storage.hpp>
27
28
#include < silkworm/db/data_store.hpp>
28
29
29
30
#include " base_transaction.hpp"
@@ -34,8 +35,21 @@ namespace silkworm::db::kv::api {
34
35
35
36
class LocalTransaction : public BaseTransaction {
36
37
public:
37
- explicit LocalTransaction (DataStoreRef data_store)
38
+ class Cache {
39
+ public:
40
+ using ChainStorageCache = db::chain::LocalChainStorage::Cache;
41
+ Cache () : chain_storage_cache_{std::make_shared<ChainStorageCache>()} {}
42
+ std::shared_ptr<ChainStorageCache> chain_storage_cache () const { return chain_storage_cache_; }
43
+
44
+ private:
45
+ std::shared_ptr<ChainStorageCache> chain_storage_cache_;
46
+ };
47
+
48
+ LocalTransaction (
49
+ DataStoreRef data_store,
50
+ std::shared_ptr<Cache> cache)
38
51
: data_store_{std::move (data_store)},
52
+ cache_{std::move (cache)},
39
53
tx_{data_store_.chaindata .access_ro ().start_ro_tx ()} {}
40
54
41
55
~LocalTransaction () override = default ;
@@ -104,6 +118,7 @@ class LocalTransaction : public BaseTransaction {
104
118
std::map<std::string, std::shared_ptr<CursorDupSort>> dup_cursors_;
105
119
106
120
DataStoreRef data_store_;
121
+ std::shared_ptr<Cache> cache_;
107
122
uint32_t last_cursor_id_{0 };
108
123
datastore::kvdb::ROTxnManaged tx_;
109
124
uint64_t tx_id_{++next_tx_id_};
0 commit comments