Provides token bucket and rate limiter configuration structs with helper constructors for hypervisor.
// Source: https://github.com/kata-containers/kata-containers | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright (c) 2022-2023 Intel Corporation
//
// Copyright (c) 2024-2025 Ant Group
//
// SPDX-License-Identifier: Apache-2.0
use serde::{Deserialize, Serialize};
/// The DEFAULT_RATE_LIMITER_REFILL_TIME is used for calculating the rate at
/// which a TokenBucket is replinished, in cases where a RateLimiter is
/// applied to either network or disk I/O.
pub const DEFAULT_RATE_LIMITER_REFILL_TIME: u64 = 1000;
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PartialEq, Eq)]
pub struct TokenBucketConfig {
pub size: u64,
pub one_time_burst: Option<u64>,
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key