This repository was archived by the owner on Feb 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
crates/subspace-farmer/src Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -737,6 +737,21 @@ impl<T: PlotFile> PlotWorker<T> {
737
737
. write_all ( & piece_index. to_le_bytes ( ) )
738
738
}
739
739
740
+ fn put_piece_indexes (
741
+ & mut self ,
742
+ start_offset : PieceOffset ,
743
+ piece_indexes : & [ PieceIndex ] ,
744
+ ) -> io:: Result < ( ) > {
745
+ self . piece_offset_to_index . seek ( SeekFrom :: Start (
746
+ start_offset * std:: mem:: size_of :: < PieceIndex > ( ) as u64 ,
747
+ ) ) ?;
748
+ let piece_indexes = piece_indexes
749
+ . iter ( )
750
+ . flat_map ( |piece_index| piece_index. to_le_bytes ( ) )
751
+ . collect :: < Vec < _ > > ( ) ;
752
+ self . piece_offset_to_index . write_all ( & piece_indexes)
753
+ }
754
+
740
755
// TODO: Add error recovery
741
756
fn write_encodings (
742
757
& mut self ,
@@ -768,9 +783,10 @@ impl<T: PlotFile> PlotWorker<T> {
768
783
{
769
784
self . piece_index_hash_to_offset_db
770
785
. put ( & piece_index. into ( ) , piece_offset) ?;
771
- self . put_piece_index ( piece_offset, piece_index) ?;
772
786
}
773
787
788
+ self . put_piece_indexes ( current_piece_count, sequential_piece_indexes) ?;
789
+
774
790
self . piece_count
775
791
. fetch_add ( pieces_left_until_full_plot, Ordering :: AcqRel ) ;
776
792
}
You can’t perform that action at this time.
0 commit comments