Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Server - shared compute instance quota (number of instances only) Server = FromEnv("OS_SERVER_QUOTA", 10) CPU = FromEnv("OS_CPU_QUOTA", 40) RAM = FromEnv("OS_RAM_QUOTA", 160*1024) // FloatingIP - shared floating IP quota FloatingIP = FromEnv("OS_FLOATING_IP_QUOTA", 3) // Router - shared router(VPC) quota Router = FromEnv("OS_ROUTER_QUOTA", 7) // safe value Subnet = FromEnv("OS_SUBNET_QUOTA", 50) Network = FromEnv("OS_NETWORK_QUOTA", 50) SecurityGroup = FromEnv("OS_SG_QUOTA", 100) // Volume - quota for block storage volumes Volume = FromEnv("OS_VOLUME_QUOTA", 50) // VolumeSize - quota for block storage total size, GB VolumeSize = FromEnv("OS_VOLUME_SIZE_QUOTA", 12500) // LoadBalancer - quota for load balancer instances LoadBalancer = FromEnv("OS_LB_QUOTA", 50) // LbCertificate - quota for load balancer certificates LbCertificate = FromEnv("OS_LB_CERTIFICATE_QUOTA", 120) // LbListener - quota for load balancer listeners LbListener = FromEnv("OS_LB_LISTENER_QUOTA", 100) // LbPool - quota for load balancer pools LbPool = FromEnv("OS_LB_POOl_QUOTA", 500) // LbPolicy - quota for load balancer policies LbPolicy = FromEnv("OS_LB_POLICY_QUOTA", 500) // CCEClusterQuota is a quota for controlling number of CCE clusters existing in the parallel CCEClusterQuota = FromEnv("OS_CCE_CLUSTER_QUOTA", 5) ASGroup = FromEnv("OS_AS_GROUP_QUOTA", 25) ASConfiguration = FromEnv("OS_AS_CONFIGURATION_QUOTA", 100) CBRPolicy = FromEnv("OS_CBR_POLICY_QUOTA", 32) )
Functions ¶
func AcquireMultipleQuotas ¶
func AcquireMultipleQuotas(e []*ExpectedQuota, interval time.Duration) error
AcquireMultipleQuotas tries to acquire all given quotas, reverting on failure Deprecated: use BookMany in tests instead
func BookMany ¶ added in v1.26.3
func BookMany(t *testing.T, qts []*ExpectedQuota)
BookMany acquires quotas at the beginning and release them on the end of the test
func BookOne ¶ added in v1.26.3
BookOne acquires a quota at the beginning and release it on the end of the test
func ReleaseMultipleQuotas ¶
func ReleaseMultipleQuotas(e []*ExpectedQuota)
ReleaseMultipleQuotas releases quotas acquired by AcquireMultipleQuotas Deprecated: use BookMany in tests instead
Types ¶
type ExpectedQuota ¶
ExpectedQuota is a simple container of quota + count used for `Multiple` operations
func (ExpectedQuota) X ¶ added in v1.25.7
func (q ExpectedQuota) X(multiplier int64) *ExpectedQuota
X multiples quota returning new `ExpectedQuota` instance
type MultipleQuotas ¶ added in v1.25.7
type MultipleQuotas []*ExpectedQuota
func (MultipleQuotas) X ¶ added in v1.25.7
func (q MultipleQuotas) X(multiplier int64) MultipleQuotas
X multiples quota returning new `MultipleQuotas` instance
type Quota ¶
type Quota struct { Name string Size int64 Current int64 // contains filtered or unexported fields }
Quota is a wrapper around a semaphore providing simple control over shared resources with quotas
func FromEnv ¶
FromEnv creates quota instance with limit set to env var or default value if the variable is not set or not an integer.
func NewQuotaWithTimeout ¶
NewQuotaWithTimeout creates a new Quota with timing out context
func (*Quota) Acquire ¶
Acquire decrease count of available resources by 1 Deprecated: use BookOne in tests instead
func (*Quota) AcquireMultiple ¶
AcquireMultiple decrease count of available resources by n Deprecated: use BookMany in tests instead
func (*Quota) Release ¶
func (q *Quota) Release()
Release increase count of available resources by 1 Deprecated: use BookOne in tests instead
func (*Quota) ReleaseMultiple ¶
ReleaseMultiple increase count of available resources by n Deprecated: use BookMany in tests instead