@@ -14,13 +14,15 @@ use aptos_storage_interface::state_store::{
1414use aptos_types:: {
1515 contract_event:: ContractEvent ,
1616 epoch_state:: EpochState ,
17- state_store:: hot_state:: HotStateConfig ,
17+ state_store:: {
18+ hot_state:: HotStateConfig , state_key:: StateKey , state_value:: StateValue , NUM_STATE_SHARDS ,
19+ } ,
1820 transaction:: {
1921 block_epilogue:: BlockEndInfo , ExecutionStatus , Transaction , TransactionStatus , Version ,
2022 } ,
2123} ;
2224use derive_more:: Deref ;
23- use std:: sync:: Arc ;
25+ use std:: { collections :: HashMap , sync:: Arc } ;
2426
2527#[ derive( Clone , Debug , Deref ) ]
2628pub struct ExecutionOutput {
@@ -41,6 +43,8 @@ impl ExecutionOutput {
4143 block_end_info : Option < BlockEndInfo > ,
4244 next_epoch_state : Option < EpochState > ,
4345 subscribable_events : Planned < Vec < ContractEvent > > ,
46+ hot_inserted : [ HashMap < StateKey , Option < StateValue > > ; NUM_STATE_SHARDS ] ,
47+ hot_evicted : [ HashMap < StateKey , Option < StateValue > > ; NUM_STATE_SHARDS ] ,
4448 ) -> Self {
4549 let next_version = first_version + to_commit. len ( ) as Version ;
4650 assert_eq ! ( next_version, result_state. latest( ) . next_version( ) ) ;
@@ -65,6 +69,8 @@ impl ExecutionOutput {
6569 block_end_info,
6670 next_epoch_state,
6771 subscribable_events,
72+ hot_inserted,
73+ hot_evicted,
6874 } )
6975 }
7076
@@ -81,6 +87,8 @@ impl ExecutionOutput {
8187 block_end_info : None ,
8288 next_epoch_state : None ,
8389 subscribable_events : Planned :: ready ( vec ! [ ] ) ,
90+ hot_inserted : std:: array:: from_fn ( |_| HashMap :: new ( ) ) ,
91+ hot_evicted : std:: array:: from_fn ( |_| HashMap :: new ( ) ) ,
8492 } )
8593 }
8694
@@ -99,6 +107,8 @@ impl ExecutionOutput {
99107 block_end_info : None ,
100108 next_epoch_state : None ,
101109 subscribable_events : Planned :: ready ( vec ! [ ] ) ,
110+ hot_inserted : std:: array:: from_fn ( |_| HashMap :: new ( ) ) ,
111+ hot_evicted : std:: array:: from_fn ( |_| HashMap :: new ( ) ) ,
102112 } )
103113 }
104114
@@ -119,6 +129,8 @@ impl ExecutionOutput {
119129 block_end_info : None ,
120130 next_epoch_state : self . next_epoch_state . clone ( ) ,
121131 subscribable_events : Planned :: ready ( vec ! [ ] ) ,
132+ hot_inserted : std:: array:: from_fn ( |_| HashMap :: new ( ) ) ,
133+ hot_evicted : std:: array:: from_fn ( |_| HashMap :: new ( ) ) ,
122134 } )
123135 }
124136
@@ -166,6 +178,8 @@ pub struct Inner {
166178 /// state cache.
167179 pub next_epoch_state : Option < EpochState > ,
168180 pub subscribable_events : Planned < Vec < ContractEvent > > ,
181+ pub hot_inserted : [ HashMap < StateKey , Option < StateValue > > ; NUM_STATE_SHARDS ] ,
182+ pub hot_evicted : [ HashMap < StateKey , Option < StateValue > > ; NUM_STATE_SHARDS ] ,
169183}
170184
171185impl Inner {
0 commit comments