@@ -298,7 +298,7 @@ impl HashContext {
298
298
. get_or_create ( || async {
299
299
let res = self . db ( ) . get ( hash) . await . map_err ( io:: Error :: other) ?;
300
300
let res = match res {
301
- Some ( state) => open_bao_file ( & hash , state, & self . global ) . await ,
301
+ Some ( state) => open_bao_file ( state, self ) . await ,
302
302
None => Err ( io:: Error :: new ( io:: ErrorKind :: NotFound , "hash not found" ) ) ,
303
303
} ;
304
304
Ok ( ( res?, ( ) ) )
@@ -318,7 +318,7 @@ impl HashContext {
318
318
. get_or_create ( || async {
319
319
let res = self . db ( ) . get ( hash) . await . map_err ( io:: Error :: other) ?;
320
320
let res = match res {
321
- Some ( state) => open_bao_file ( & hash , state, & self . global ) . await ,
321
+ Some ( state) => open_bao_file ( state, self ) . await ,
322
322
None => Ok ( BaoFileHandle :: new_partial_mem ( ) ) ,
323
323
} ;
324
324
Ok ( ( res?, ( ) ) )
@@ -331,12 +331,9 @@ impl HashContext {
331
331
}
332
332
}
333
333
334
- async fn open_bao_file (
335
- hash : & Hash ,
336
- state : EntryState < Bytes > ,
337
- ctx : & TaskContext ,
338
- ) -> io:: Result < BaoFileHandle > {
339
- let options = & ctx. options ;
334
+ async fn open_bao_file ( state : EntryState < Bytes > , ctx : & HashContext ) -> io:: Result < BaoFileHandle > {
335
+ let hash = & ctx. id ;
336
+ let options = & ctx. global . options ;
340
337
Ok ( match state {
341
338
EntryState :: Complete {
342
339
data_location,
@@ -368,7 +365,7 @@ async fn open_bao_file(
368
365
} ;
369
366
BaoFileHandle :: new_complete ( data, outboard)
370
367
}
371
- EntryState :: Partial { .. } => BaoFileHandle :: new_partial_file ( * hash , ctx) . await ?,
368
+ EntryState :: Partial { .. } => BaoFileHandle :: new_partial_file ( ctx) . await ?,
372
369
} )
373
370
}
374
371
0 commit comments