@@ -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?, ( ) ) )
@@ -332,11 +332,11 @@ impl HashContext {
332
332
}
333
333
334
334
async fn open_bao_file (
335
- hash : & Hash ,
336
335
state : EntryState < Bytes > ,
337
- ctx : & TaskContext ,
336
+ ctx : & HashContext ,
338
337
) -> io:: Result < BaoFileHandle > {
339
- let options = & ctx. options ;
338
+ let hash = & ctx. id ;
339
+ let options = & ctx. global . options ;
340
340
Ok ( match state {
341
341
EntryState :: Complete {
342
342
data_location,
@@ -368,7 +368,7 @@ async fn open_bao_file(
368
368
} ;
369
369
BaoFileHandle :: new_complete ( data, outboard)
370
370
}
371
- EntryState :: Partial { .. } => BaoFileHandle :: new_partial_file ( * hash , ctx) . await ?,
371
+ EntryState :: Partial { .. } => BaoFileHandle :: new_partial_file ( ctx) . await ?,
372
372
} )
373
373
}
374
374
0 commit comments