compute_coding_params

Function compute_coding_params 

Source
pub fn compute_coding_params(
    stabilities: &[f64],
    ph: f64,
    q_target: f64,
) -> BpResult<NetworkCodingParams>
Expand description

Compute the optimal coding parameters for the given network state.

§Arguments

  • stabilities — slice of per-peer stability scores p_i ∈ [0.0, 1.0] produced by crate::network::qos::QosRegistry::all_stability_scores.
  • ph — target recovery probability, e.g. 0.999.
  • q_target — desired redundancy overhead fraction, e.g. 1.0 (= 2×k total fragments per chunk). Must be > 0.0.

§Errors

  • No peers provided (empty stabilities).
  • ph outside (0.0, 1.0).
  • q_target ≤ 0.0.
  • Network too small or too unreliable to satisfy Ph (k would be ≤ 0).