Struct solana_perf::data_budget::DataBudget
source · pub struct DataBudget { /* private fields */ }
Implementations§
source§impl DataBudget
impl DataBudget
sourcepub fn restricted() -> Self
pub fn restricted() -> Self
Create a data budget with max bytes, used for tests
pub fn take(&self, size: usize) -> bool
sourcepub fn update<F>(&self, duration_millis: u64, updater: F) -> usizewhere
F: Fn(usize) -> usize,
pub fn update<F>(&self, duration_millis: u64, updater: F) -> usizewhere F: Fn(usize) -> usize,
Updates the budget if at least given milliseconds has passed since last update. Updater function maps current value of bytes to the new one. Returns current data-budget after the update.
pub fn clone_non_atomic(&self) -> Self
Trait Implementations§
source§impl Default for DataBudget
impl Default for DataBudget
source§fn default() -> DataBudget
fn default() -> DataBudget
Returns the “default value” for a type. Read more