@@ -22,10 +22,10 @@ impl<T: RandomAccess + Debug> StorageTraits for T {}
2222/// Save data to a desired storage backend.
2323#[ derive( Debug ) ]
2424pub struct Storage {
25- tree : Box < dyn StorageTraits > ,
26- data : Box < dyn StorageTraits > ,
27- bitfield : Box < dyn StorageTraits > ,
28- oplog : Box < dyn StorageTraits > ,
25+ tree : Box < dyn StorageTraits + Send > ,
26+ data : Box < dyn StorageTraits + Send > ,
27+ bitfield : Box < dyn StorageTraits + Send > ,
28+ oplog : Box < dyn StorageTraits + Send > ,
2929}
3030
3131pub ( crate ) fn map_random_access_err ( err : RandomAccessError ) -> HypercoreError {
@@ -60,8 +60,9 @@ impl Storage {
6060 Store ,
6161 ) -> std:: pin:: Pin <
6262 Box <
63- dyn std:: future:: Future < Output = Result < Box < dyn StorageTraits > , RandomAccessError > >
64- + Send ,
63+ dyn std:: future:: Future <
64+ Output = Result < Box < dyn StorageTraits + Send > , RandomAccessError > ,
65+ > + Send ,
6566 > ,
6667 > ,
6768 {
@@ -236,7 +237,7 @@ impl Storage {
236237 Ok ( ( ) )
237238 }
238239
239- fn get_random_access ( & mut self , store : & Store ) -> & mut Box < dyn StorageTraits > {
240+ fn get_random_access ( & mut self , store : & Store ) -> & mut Box < dyn StorageTraits + Send > {
240241 match store {
241242 Store :: Tree => & mut self . tree ,
242243 Store :: Data => & mut self . data ,
@@ -249,7 +250,8 @@ impl Storage {
249250 #[ instrument( err) ]
250251 pub async fn new_memory ( ) -> Result < Self , HypercoreError > {
251252 let create = |_| {
252- async { Ok ( Box :: new ( RandomAccessMemory :: default ( ) ) as Box < dyn StorageTraits > ) } . boxed ( )
253+ async { Ok ( Box :: new ( RandomAccessMemory :: default ( ) ) as Box < dyn StorageTraits + Send > ) }
254+ . boxed ( )
253255 } ;
254256 // No reason to overwrite, as this is a new memory segment
255257 Self :: open ( create, false ) . await
@@ -270,7 +272,7 @@ impl Storage {
270272 } ;
271273 Ok (
272274 Box :: new ( RandomAccessDisk :: open ( dir. as_path ( ) . join ( name) ) . await ?)
273- as Box < dyn StorageTraits > ,
275+ as Box < dyn StorageTraits + Send > ,
274276 )
275277 }
276278 . boxed ( )
0 commit comments