@@ -542,7 +542,7 @@ impl HotStorageReader {
542
542
}
543
543
544
544
fn write_optional_fields (
545
- file : & TieredWritableFile ,
545
+ file : & mut TieredWritableFile ,
546
546
opt_fields : & AccountMetaOptionalFields ,
547
547
) -> TieredStorageResult < usize > {
548
548
let mut size = 0 ;
@@ -572,7 +572,7 @@ impl HotStorageWriter {
572
572
/// Persists an account with the specified information and returns
573
573
/// the stored size of the account.
574
574
fn write_account (
575
- & self ,
575
+ & mut self ,
576
576
lamports : u64 ,
577
577
owner_offset : OwnerOffset ,
578
578
account_data : & [ u8 ] ,
@@ -599,7 +599,7 @@ impl HotStorageWriter {
599
599
stored_size += self
600
600
. storage
601
601
. write_bytes ( & PADDING_BUFFER [ 0 ..( padding_len as usize ) ] ) ?;
602
- stored_size += write_optional_fields ( & self . storage , & optional_fields) ?;
602
+ stored_size += write_optional_fields ( & mut self . storage , & optional_fields) ?;
603
603
604
604
Ok ( stored_size)
605
605
}
@@ -614,7 +614,7 @@ impl HotStorageWriter {
614
614
U : StorableAccounts < ' a , T > ,
615
615
V : Borrow < AccountHash > ,
616
616
> (
617
- & self ,
617
+ & mut self ,
618
618
accounts : & StorableAccountsWithHashesAndWriteVersions < ' a , ' b , T , U , V > ,
619
619
skip : usize ,
620
620
) -> TieredStorageResult < Vec < StoredAccountInfo > > {
@@ -677,7 +677,7 @@ impl HotStorageWriter {
677
677
footer. index_block_offset = cursor as u64 ;
678
678
cursor += footer
679
679
. index_block_format
680
- . write_index_block ( & self . storage , & index) ?;
680
+ . write_index_block ( & mut self . storage , & index) ?;
681
681
if cursor % HOT_BLOCK_ALIGNMENT != 0 {
682
682
// In case it is not yet aligned, it is due to the fact that
683
683
// the index block has an odd number of entries. In such case,
@@ -692,9 +692,9 @@ impl HotStorageWriter {
692
692
footer. owner_count = owners_table. len ( ) as u32 ;
693
693
footer
694
694
. owners_block_format
695
- . write_owners_block ( & self . storage , & owners_table) ?;
695
+ . write_owners_block ( & mut self . storage , & owners_table) ?;
696
696
697
- footer. write_footer_block ( & self . storage ) ?;
697
+ footer. write_footer_block ( & mut self . storage ) ?;
698
698
699
699
Ok ( stored_infos)
700
700
}
@@ -892,8 +892,8 @@ pub mod tests {
892
892
} ;
893
893
894
894
{
895
- let file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
896
- expected_footer. write_footer_block ( & file) . unwrap ( ) ;
895
+ let mut file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
896
+ expected_footer. write_footer_block ( & mut file) . unwrap ( ) ;
897
897
}
898
898
899
899
// Reopen the same storage, and expect the persisted footer is
@@ -928,7 +928,7 @@ pub mod tests {
928
928
..TieredStorageFooter :: default ( )
929
929
} ;
930
930
{
931
- let file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
931
+ let mut file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
932
932
let mut current_offset = 0 ;
933
933
934
934
account_offsets = hot_account_metas
@@ -942,7 +942,7 @@ pub mod tests {
942
942
// while the test only focuses on account metas, writing a footer
943
943
// here is necessary to make it a valid tiered-storage file.
944
944
footer. index_block_offset = current_offset as u64 ;
945
- footer. write_footer_block ( & file) . unwrap ( ) ;
945
+ footer. write_footer_block ( & mut file) . unwrap ( ) ;
946
946
}
947
947
948
948
let hot_storage = HotStorageReader :: new_from_path ( & path) . unwrap ( ) ;
@@ -971,8 +971,8 @@ pub mod tests {
971
971
} ;
972
972
973
973
{
974
- let file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
975
- footer. write_footer_block ( & file) . unwrap ( ) ;
974
+ let mut file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
975
+ footer. write_footer_block ( & mut file) . unwrap ( ) ;
976
976
}
977
977
978
978
let hot_storage = HotStorageReader :: new_from_path ( & path) . unwrap ( ) ;
@@ -1016,14 +1016,14 @@ pub mod tests {
1016
1016
..TieredStorageFooter :: default ( )
1017
1017
} ;
1018
1018
{
1019
- let file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
1019
+ let mut file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
1020
1020
1021
1021
let cursor = footer
1022
1022
. index_block_format
1023
- . write_index_block ( & file, & index_writer_entries)
1023
+ . write_index_block ( & mut file, & index_writer_entries)
1024
1024
. unwrap ( ) ;
1025
1025
footer. owners_block_offset = cursor as u64 ;
1026
- footer. write_footer_block ( & file) . unwrap ( ) ;
1026
+ footer. write_footer_block ( & mut file) . unwrap ( ) ;
1027
1027
}
1028
1028
1029
1029
let hot_storage = HotStorageReader :: new_from_path ( & path) . unwrap ( ) ;
@@ -1059,20 +1059,20 @@ pub mod tests {
1059
1059
} ;
1060
1060
1061
1061
{
1062
- let file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
1062
+ let mut file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
1063
1063
1064
1064
let mut owners_table = OwnersTable :: default ( ) ;
1065
1065
addresses. iter ( ) . for_each ( |owner_address| {
1066
1066
owners_table. insert ( owner_address) ;
1067
1067
} ) ;
1068
1068
footer
1069
1069
. owners_block_format
1070
- . write_owners_block ( & file, & owners_table)
1070
+ . write_owners_block ( & mut file, & owners_table)
1071
1071
. unwrap ( ) ;
1072
1072
1073
1073
// while the test only focuses on account metas, writing a footer
1074
1074
// here is necessary to make it a valid tiered-storage file.
1075
- footer. write_footer_block ( & file) . unwrap ( ) ;
1075
+ footer. write_footer_block ( & mut file) . unwrap ( ) ;
1076
1076
}
1077
1077
1078
1078
let hot_storage = HotStorageReader :: new_from_path ( & path) . unwrap ( ) ;
@@ -1118,7 +1118,7 @@ pub mod tests {
1118
1118
let account_offsets: Vec < _ > ;
1119
1119
1120
1120
{
1121
- let file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
1121
+ let mut file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
1122
1122
let mut current_offset = 0 ;
1123
1123
1124
1124
account_offsets = hot_account_metas
@@ -1141,12 +1141,12 @@ pub mod tests {
1141
1141
} ) ;
1142
1142
footer
1143
1143
. owners_block_format
1144
- . write_owners_block ( & file, & owners_table)
1144
+ . write_owners_block ( & mut file, & owners_table)
1145
1145
. unwrap ( ) ;
1146
1146
1147
1147
// while the test only focuses on account metas, writing a footer
1148
1148
// here is necessary to make it a valid tiered-storage file.
1149
- footer. write_footer_block ( & file) . unwrap ( ) ;
1149
+ footer. write_footer_block ( & mut file) . unwrap ( ) ;
1150
1150
}
1151
1151
1152
1152
let hot_storage = HotStorageReader :: new_from_path ( & path) . unwrap ( ) ;
@@ -1237,7 +1237,7 @@ pub mod tests {
1237
1237
} ;
1238
1238
1239
1239
{
1240
- let file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
1240
+ let mut file = TieredWritableFile :: new ( & path) . unwrap ( ) ;
1241
1241
let mut current_offset = 0 ;
1242
1242
1243
1243
// write accounts blocks
@@ -1264,7 +1264,7 @@ pub mod tests {
1264
1264
footer. index_block_offset = current_offset as u64 ;
1265
1265
current_offset += footer
1266
1266
. index_block_format
1267
- . write_index_block ( & file, & index_writer_entries)
1267
+ . write_index_block ( & mut file, & index_writer_entries)
1268
1268
. unwrap ( ) ;
1269
1269
1270
1270
// write owners block
@@ -1275,10 +1275,10 @@ pub mod tests {
1275
1275
} ) ;
1276
1276
footer
1277
1277
. owners_block_format
1278
- . write_owners_block ( & file, & owners_table)
1278
+ . write_owners_block ( & mut file, & owners_table)
1279
1279
. unwrap ( ) ;
1280
1280
1281
- footer. write_footer_block ( & file) . unwrap ( ) ;
1281
+ footer. write_footer_block ( & mut file) . unwrap ( ) ;
1282
1282
}
1283
1283
1284
1284
let hot_storage = HotStorageReader :: new_from_path ( & path) . unwrap ( ) ;
@@ -1358,7 +1358,7 @@ pub mod tests {
1358
1358
let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
1359
1359
let path = temp_dir. path ( ) . join ( "test_write_account_and_index_blocks" ) ;
1360
1360
let stored_infos = {
1361
- let writer = HotStorageWriter :: new ( & path) . unwrap ( ) ;
1361
+ let mut writer = HotStorageWriter :: new ( & path) . unwrap ( ) ;
1362
1362
writer. write_accounts ( & storable_accounts, 0 ) . unwrap ( )
1363
1363
} ;
1364
1364
0 commit comments