Add sn-fair v0: weighted max-min fairness scheduler with leech policy
Two-class allocation engine: contributors (configurable weight) get weighted max-min shares of the pooled capacity, leeches (receive-only, explicitly allowed) share the leftover capacity. Deterministic u128 arithmetic, validated newtypes, demo CLI in Mbit/s for the pilot Soll/Ist comparison. 19 tests, workspace clippy clean.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
//! Error type for the fairness scheduler.
|
||||
|
||||
use crate::types::ParticipantId;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum FairnessError {
|
||||
#[error("capacity must be greater than zero")]
|
||||
ZeroCapacity,
|
||||
|
||||
#[error("invalid participant id `{0}`: expected a decimal number greater than zero")]
|
||||
InvalidParticipantId(String),
|
||||
|
||||
#[error("demand references unknown participant {0}")]
|
||||
UnknownParticipant(ParticipantId),
|
||||
|
||||
#[error("duplicate demand for participant {0}")]
|
||||
DuplicateDemand(ParticipantId),
|
||||
|
||||
#[error("duplicate participant {0}")]
|
||||
DuplicateParticipant(ParticipantId),
|
||||
|
||||
#[error("conflicting participation classes for participant {0}")]
|
||||
ConflictingParticipation(ParticipantId),
|
||||
}
|
||||
Reference in New Issue
Block a user