mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-21 23:34:22 +01:00
rate-limiter: implement hypervisor-built-in rate limiter
As for hypervisors that support built-in rate limiter, like firecracker, we use this built-in characteristics to implement rate limiter in kata. kata-defined rate is in bits with scaling factors of 1000, otherwise fc-defined rate is in bytes with scaling factors of 1024, so need reversion. Fixes: #250 Signed-off-by: Penny Zheng <penny.zheng@arm.com>
This commit is contained in:
@@ -19,17 +19,17 @@ type TokenBucket struct {
|
||||
|
||||
// The initial size of a token bucket.
|
||||
// Minimum: 0
|
||||
OneTimeBurst *int64 `json:"one_time_burst,omitempty"`
|
||||
OneTimeBurst *uint64 `json:"one_time_burst,omitempty"`
|
||||
|
||||
// The amount of milliseconds it takes for the bucket to refill.
|
||||
// Required: true
|
||||
// Minimum: 0
|
||||
RefillTime *int64 `json:"refill_time"`
|
||||
RefillTime *uint64 `json:"refill_time"`
|
||||
|
||||
// The total number of tokens this bucket can hold.
|
||||
// Required: true
|
||||
// Minimum: 0
|
||||
Size *int64 `json:"size"`
|
||||
Size *uint64 `json:"size"`
|
||||
}
|
||||
|
||||
// Validate validates this token bucket
|
||||
|
||||
@@ -615,17 +615,17 @@ definitions:
|
||||
properties:
|
||||
size:
|
||||
type: integer
|
||||
format: int64
|
||||
format: uint64
|
||||
description: The total number of tokens this bucket can hold.
|
||||
minimum: 0
|
||||
one_time_burst:
|
||||
type: integer
|
||||
format: int64
|
||||
format: uint64
|
||||
description: The initial size of a token bucket.
|
||||
minimum: 0
|
||||
refill_time:
|
||||
type: integer
|
||||
format: int64
|
||||
format: uint64
|
||||
description: The amount of milliseconds it takes for the bucket to refill.
|
||||
minimum: 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user