@@ -60,6 +60,10 @@ impl ReadOnlyStorage for MapStorage {
6060 async fn mget_mut ( & mut self , keys : & [ & DbKey ] ) -> PatriciaStorageResult < Vec < Option < DbValue > > > {
6161 ImmutableReadOnlyStorage :: mget ( self , keys) . await
6262 }
63+
64+ fn as_gatherable_storage ( & mut self ) -> Option < & mut impl GatherableStorage > {
65+ Some ( self )
66+ }
6367}
6468
6569impl Storage for MapStorage {
@@ -102,10 +106,6 @@ impl Storage for MapStorage {
102106 // Need a concrete Option type.
103107 None :: < NullStorage >
104108 }
105-
106- fn as_gatherable_storage ( & mut self ) -> Option < & mut impl GatherableStorage > {
107- Some ( self )
108- }
109109}
110110
111111impl GatherableStorage for MapStorage { }
@@ -303,7 +303,7 @@ impl<S: Storage + ImmutableReadOnlyStorage + 'static> GatherableStorage for Cach
303303}
304304
305305// TODO(Nimrod): Find a way to share the implementation with `ImmutableReadOnlyStorage`.
306- impl < S : Storage > ReadOnlyStorage for CachedStorage < S > {
306+ impl < S : Storage + ImmutableReadOnlyStorage + ' static > ReadOnlyStorage for CachedStorage < S > {
307307 async fn get_mut ( & mut self , key : & DbKey ) -> PatriciaStorageResult < Option < DbValue > > {
308308 self . reads . fetch_add ( 1 , Ordering :: Relaxed ) ;
309309 if let Some ( cached_value) = self . cache . get ( key) {
@@ -346,6 +346,10 @@ impl<S: Storage> ReadOnlyStorage for CachedStorage<S> {
346346
347347 Ok ( values)
348348 }
349+
350+ fn as_gatherable_storage ( & mut self ) -> Option < & mut impl GatherableStorage > {
351+ Some ( self )
352+ }
349353}
350354
351355impl < S : Storage + ImmutableReadOnlyStorage + ' static > Storage for CachedStorage < S > {
@@ -420,8 +424,4 @@ impl<S: Storage + ImmutableReadOnlyStorage + 'static> Storage for CachedStorage<
420424 // Need a concrete Option type.
421425 None :: < NullStorage >
422426 }
423-
424- fn as_gatherable_storage ( & mut self ) -> Option < & mut impl GatherableStorage > {
425- Some ( self )
426- }
427427}
0 commit comments