@@ -507,7 +507,6 @@ impl BaoFileStorage {
507507pub struct BaoFileHandleInner {
508508 pub ( crate ) storage : watch:: Sender < BaoFileStorage > ,
509509 hash : Hash ,
510- options : Arc < Options > ,
511510}
512511
513512impl fmt:: Debug for BaoFileHandleInner {
@@ -526,15 +525,14 @@ impl fmt::Debug for BaoFileHandleInner {
526525pub struct BaoFileHandle ( Arc < BaoFileHandleInner > ) ;
527526
528527impl BaoFileHandle {
529- pub fn persist ( & mut self ) {
528+ pub fn persist ( & mut self , options : & Options ) {
530529 self . 0 . storage . send_if_modified ( |guard| {
531530 if Arc :: strong_count ( & self . 0 ) > 1 {
532531 return false ;
533532 }
534533 let BaoFileStorage :: Partial ( fs) = guard. take ( ) else {
535534 return false ;
536535 } ;
537- let options = & self . options ;
538536 let path = options. path . bitfield_path ( & self . hash ) ;
539537 trace ! (
540538 "writing bitfield for hash {} to {}" ,
@@ -554,12 +552,6 @@ impl BaoFileHandle {
554552 }
555553}
556554
557- impl Drop for BaoFileHandle {
558- fn drop ( & mut self ) {
559- self . persist ( ) ;
560- }
561- }
562-
563555/// A reader for a bao file, reading just the data.
564556#[ derive( Debug ) ]
565557pub struct DataReader ( BaoFileHandle ) ;
@@ -601,12 +593,11 @@ impl BaoFileHandle {
601593 /// Create a new bao file handle.
602594 ///
603595 /// This will create a new file handle with an empty memory storage.
604- pub fn new_partial_mem ( hash : Hash , options : Arc < Options > ) -> Self {
596+ pub fn new_partial_mem ( hash : Hash ) -> Self {
605597 let storage = BaoFileStorage :: partial_mem ( ) ;
606598 Self ( Arc :: new ( BaoFileHandleInner {
607599 storage : watch:: Sender :: new ( storage) ,
608600 hash,
609- options : options. clone ( ) ,
610601 } ) )
611602 }
612603
@@ -626,7 +617,6 @@ impl BaoFileHandle {
626617 Ok ( Self ( Arc :: new ( BaoFileHandleInner {
627618 storage : watch:: Sender :: new ( storage) ,
628619 hash,
629- options,
630620 } ) ) )
631621 }
632622
@@ -635,13 +625,11 @@ impl BaoFileHandle {
635625 hash : Hash ,
636626 data : MemOrFile < Bytes , FixedSize < File > > ,
637627 outboard : MemOrFile < Bytes , File > ,
638- options : Arc < Options > ,
639628 ) -> Self {
640629 let storage = CompleteStorage { data, outboard } . into ( ) ;
641630 Self ( Arc :: new ( BaoFileHandleInner {
642631 storage : watch:: Sender :: new ( storage) ,
643632 hash,
644- options,
645633 } ) )
646634 }
647635
0 commit comments