pub struct BandwidthConfig {
pub enabled: bool,
pub max_bytes_per_sec: u64,
pub burst_capacity_bytes: u64,
pub tag_overrides: HashMap<String, u64>,
}
Expand description
Bandwidth throttling configuration
Fields§
§enabled: bool
Enable bandwidth throttling
max_bytes_per_sec: u64
Maximum bandwidth in bytes per second (0 = unlimited)
burst_capacity_bytes: u64
Token bucket capacity in bytes (burst allowance)
tag_overrides: HashMap<String, u64>
Tag-based bandwidth overrides
Implementations§
Source§impl BandwidthConfig
impl BandwidthConfig
Sourcepub fn new(max_bytes_per_sec: u64, burst_capacity_bytes: u64) -> Self
pub fn new(max_bytes_per_sec: u64, burst_capacity_bytes: u64) -> Self
Create a new bandwidth configuration
Sourcepub fn with_tag_override(self, tag: String, max_bytes_per_sec: u64) -> Self
pub fn with_tag_override(self, tag: String, max_bytes_per_sec: u64) -> Self
Add a tag-based bandwidth override
Sourcepub fn get_effective_limit(&self, tags: &[String]) -> u64
pub fn get_effective_limit(&self, tags: &[String]) -> u64
Get the effective bandwidth limit for the given tags
Trait Implementations§
Source§impl Clone for BandwidthConfig
impl Clone for BandwidthConfig
Source§fn clone(&self) -> BandwidthConfig
fn clone(&self) -> BandwidthConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BandwidthConfig
impl Debug for BandwidthConfig
Source§impl Default for BandwidthConfig
impl Default for BandwidthConfig
Source§impl<'de> Deserialize<'de> for BandwidthConfig
impl<'de> Deserialize<'de> for BandwidthConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BandwidthConfig
impl RefUnwindSafe for BandwidthConfig
impl Send for BandwidthConfig
impl Sync for BandwidthConfig
impl Unpin for BandwidthConfig
impl UnwindSafe for BandwidthConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more