@@ -298,7 +298,7 @@ impl HashContext {
298298 . get_or_create ( || async {
299299 let res = self . db ( ) . get ( hash) . await . map_err ( io:: Error :: other) ?;
300300 let res = match res {
301- Some ( state) => open_bao_file ( & hash , state, & self . global ) . await ,
301+ Some ( state) => open_bao_file ( state, & self ) . await ,
302302 None => Err ( io:: Error :: new ( io:: ErrorKind :: NotFound , "hash not found" ) ) ,
303303 } ;
304304 Ok ( ( res?, ( ) ) )
@@ -318,7 +318,7 @@ impl HashContext {
318318 . get_or_create ( || async {
319319 let res = self . db ( ) . get ( hash) . await . map_err ( io:: Error :: other) ?;
320320 let res = match res {
321- Some ( state) => open_bao_file ( & hash , state, & self . global ) . await ,
321+ Some ( state) => open_bao_file ( state, & self ) . await ,
322322 None => Ok ( BaoFileHandle :: new_partial_mem ( ) ) ,
323323 } ;
324324 Ok ( ( res?, ( ) ) )
@@ -332,11 +332,11 @@ impl HashContext {
332332}
333333
334334async fn open_bao_file (
335- hash : & Hash ,
336335 state : EntryState < Bytes > ,
337- ctx : & TaskContext ,
336+ ctx : & HashContext ,
338337) -> io:: Result < BaoFileHandle > {
339- let options = & ctx. options ;
338+ let hash = & ctx. id ;
339+ let options = & ctx. global . options ;
340340 Ok ( match state {
341341 EntryState :: Complete {
342342 data_location,
@@ -368,7 +368,7 @@ async fn open_bao_file(
368368 } ;
369369 BaoFileHandle :: new_complete ( data, outboard)
370370 }
371- EntryState :: Partial { .. } => BaoFileHandle :: new_partial_file ( * hash , ctx) . await ?,
371+ EntryState :: Partial { .. } => BaoFileHandle :: new_partial_file ( ctx) . await ?,
372372 } )
373373}
374374
0 commit comments