File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
crates/starknet_patricia_storage/src Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -223,10 +223,8 @@ impl<S: Storage> CachedStorage<S> {
223223 }
224224
225225 pub fn flush_to_cache ( & mut self , map : DbHashMap ) {
226- let cache =
227- Arc :: get_mut ( & mut self . cache ) . expect ( "Failed to get mutable reference to cache." ) ;
228226 map. into_iter ( ) . for_each ( |( key, value) | {
229- cache. put ( key, Some ( value) ) ;
227+ self . cache . put ( key, Some ( value) ) ;
230228 } ) ;
231229 }
232230}
@@ -321,4 +319,8 @@ impl<S: Storage> Storage for CachedStorage<S> {
321319 // Need a concrete Option type.
322320 None :: < NullStorage >
323321 }
322+ fn flush_to_cache ( & mut self , map : DbHashMap ) -> PatriciaStorageResult < ( ) > {
323+ Self :: flush_to_cache ( self , map) ;
324+ Ok ( ( ) )
325+ }
324326}
Original file line number Diff line number Diff line change @@ -155,6 +155,11 @@ pub trait Storage: Send + Sync {
155155
156156 /// If the storage is async, returns an instance of the async storage.
157157 fn get_async_self ( & self ) -> Option < impl AsyncStorage > ;
158+
159+ /// If uses a cache, flushes the given map into the cache.
160+ fn flush_to_cache ( & mut self , _map : DbHashMap ) -> PatriciaStorageResult < ( ) > {
161+ Ok ( ( ) )
162+ }
158163}
159164
160165/// A trait wrapper for [Storage] that supports concurrency.
You can’t perform that action at this time.
0 commit comments