fn calculate_my_repairman_index_for_slot(
        my_pubkey: &Pubkey,
        eligible_repairmen: &[&Pubkey],
        num_blobs_in_slot: usize,
        repair_redundancy: usize,
    ) -> Option<BlobIndexesToRepairIterator> {
        let total_blobs = num_blobs_in_slot * repair_redundancy;
        let total_repairmen_for_slot = cmp::min(total_blobs, eligible_repairmen.len());

        let blobs_per_repairman = cmp::min(
            (total_blobs + total_repairmen_for_slot - 1) / total_repairmen_for_slot,
            num_blobs_in_slot,
        );

        // Calculate the indexes this node is responsible for
        if let Some(my_position) = eligible_repairmen[..total_repairmen_for_slot]
            .iter()
            .position(|id| *id == my_pubkey)
        {
            let start_index = my_position % num_blobs_in_slot;
            Some(BlobIndexesToRepairIterator::new(
                start_index,
                blobs_per_repairman,
                total_repairmen_for_slot,
                num_blobs_in_slot,
            ))
        } else {
            // If there are more repairmen than `total_blobs`, then some repairmen
            // will not have any responsibility to repair this slot
            None
        }
    }
// The calculation should partition the blobs in the slot across the repairmen in the cluster
// such that each blob in the slot is the responsibility of `repair_redundancy` or
// `repair_redundancy + 1` number of repairmen in the cluster.
The calculation should partition the blobs in the slot across the repairmen in the cluster
such that each blob in the slot is the responsibility of `repair_redundancy` or
`repair_redundancy + 1` number of repairmen in the cluster.
The calculation should partition the blobs in the slot across the repairmen in the cluster such that each blob in the slot is the responsibility of ` repair_redundancy ` or ` repair_redundancy + 1 ` number of repairmen in the cluster .
fn calculate_my_repairman_index_for_slot(
        my_pubkey: &Pubkey,
        eligible_repairmen: &[&Pubkey],
        num_blobs_in_slot: usize,
        repair_redundancy: usize,
    ) -> Option<BlobIndexesToRepairIterator> {
        let total_blobs = num_blobs_in_slot * repair_redundancy;
        let total_repairmen_for_slot = cmp::min(total_blobs, eligible_repairmen.len());
        let blobs_per_repairman = cmp::min(
            (total_blobs + total_repairmen_for_slot - 1) / total_repairmen_for_slot,
            num_blobs_in_slot,
        );
        // Calculate the indexes this node is responsible for
        if let Some(my_position) = eligible_repairmen[..total_repairmen_for_slot]
            .iter()
            .position(|id| *id == my_pubkey)
        {
            let start_index = my_position % num_blobs_in_slot;
            Some(BlobIndexesToRepairIterator::new(
                start_index,
                blobs_per_repairman,
                total_repairmen_for_slot,
                num_blobs_in_slot,
            ))
        } else {
            // If there are more repairmen than `total_blobs`, then some repairmen
            // will not have any responsibility to repair this slot
            None
        }
    }
fn calculate_my_repairman_index_for_slot ( my_pubkey : & Pubkey , eligible_repairmen : & [ & Pubkey ] , num_blobs_in_slot : usize , repair_redundancy : usize , ) -> Option < BlobIndexesToRepairIterator > { let total_blobs = num_blobs_in_slot * repair_redundancy ; let total_repairmen_for_slot = cmp :: min ( total_blobs , eligible_repairmen . len ( ) ) ; let blobs_per_repairman = cmp :: min ( ( total_blobs + total_repairmen_for_slot - 1 ) / total_repairmen_for_slot , num_blobs_in_slot , ) ; // Calculate the indexes this node is responsible for if let Some ( my_position ) = eligible_repairmen [ .. total_repairmen_for_slot ] . iter ( ) . position ( | id | * id == my_pubkey ) { let start_index = my_position % num_blobs_in_slot ; Some ( BlobIndexesToRepairIterator :: new ( start_index , blobs_per_repairman , total_repairmen_for_slot , num_blobs_in_slot , ) ) } else { // If there are more repairmen than `total_blobs`, then some repairmen // will not have any responsibility to repair this slot None } }
The calculation should partition the blobs in the slot across the repairmen in the cluster
such that each blob in the slot is the responsibility of `repair_redundancy` or
`repair_redundancy + 1` number of repairmen in the cluster.
The calculation should partition the blobs in the slot across the repairmen in the cluster such that each blob in the slot is the responsibility of ` repair_redundancy ` or ` repair_redundancy + 1 ` number of repairmen in the cluster .
my_pubkey
&Pubkey
eligible_repairmen
&[&Pubkey]
num_blobs_in_slot
usize
repair_redundancy
usize
my_pubkey
&Pubkey
eligible_repairmen
&[&Pubkey]
num_blobs_in_slot
usize
repair_redundancy
usize