Skip to main content

fair_grant

Function fair_grant 

Source
pub fn fair_grant(
    remaining_bytes: u64,
    remaining_cells: usize,
    requested: u64,
) -> Result<u64, QdnfError>
Expand description

Equal-share cap for one request among remaining_cells still to admit.

remaining_cells includes the caller. Others keep at least floor(remaining_bytes / remaining_cells) each. Remainder may go to this request. 0 or more than MAX_SCALE_CELLS is QdnfError::Capacity.