next-shred-index is already readily available from returned data shreds.
The commit simplifies the api for upcoming changes to erasure coding
schema which will require explicit tracking of indices for coding shreds
as well as data shreds.
(cherry picked from commit 89d66c3210
)
Co-authored-by: behzad nouri <behzadnouri@gmail.com>
This commit is contained in:
@@ -48,8 +48,8 @@ fn test_multi_fec_block_coding() {
|
||||
.collect();
|
||||
|
||||
let serialized_entries = bincode::serialize(&entries).unwrap();
|
||||
let (data_shreds, coding_shreds, next_index) =
|
||||
shredder.entries_to_shreds(&keypair, &entries, true, 0);
|
||||
let (data_shreds, coding_shreds) = shredder.entries_to_shreds(&keypair, &entries, true, 0);
|
||||
let next_index = data_shreds.last().unwrap().index() + 1;
|
||||
assert_eq!(next_index as usize, num_data_shreds);
|
||||
assert_eq!(data_shreds.len(), num_data_shreds);
|
||||
assert_eq!(coding_shreds.len(), num_data_shreds);
|
||||
@@ -218,7 +218,7 @@ fn setup_different_sized_fec_blocks(
|
||||
let total_num_data_shreds: usize = 2 * num_shreds_per_iter;
|
||||
for i in 0..2 {
|
||||
let is_last = i == 1;
|
||||
let (data_shreds, coding_shreds, new_next_index) =
|
||||
let (data_shreds, coding_shreds) =
|
||||
shredder.entries_to_shreds(&keypair, &entries, is_last, next_index);
|
||||
for shred in &data_shreds {
|
||||
if (shred.index() as usize) == total_num_data_shreds - 1 {
|
||||
@@ -232,7 +232,7 @@ fn setup_different_sized_fec_blocks(
|
||||
}
|
||||
}
|
||||
assert_eq!(data_shreds.len(), num_shreds_per_iter as usize);
|
||||
next_index = new_next_index;
|
||||
next_index = data_shreds.last().unwrap().index() + 1;
|
||||
sort_data_coding_into_fec_sets(
|
||||
data_shreds,
|
||||
coding_shreds,
|
||||
|
Reference in New Issue
Block a user