calculator

package
v1.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calculator

type Calculator interface {
	GetQuota() float64
}

type ClusterAwareNamespaceQuotaCalculator

type ClusterAwareNamespaceQuotaCalculator quotaCalculator[func(namespace string) int]

ClusterAwareNamespaceQuotaCalculator is similar to ClusterAwareQuotaCalculator, but it uses quotas that are specific to a namespace.

func (ClusterAwareNamespaceQuotaCalculator) GetQuota

func (l ClusterAwareNamespaceQuotaCalculator) GetQuota(namespace string) float64

type ClusterAwareQuotaCalculator

type ClusterAwareQuotaCalculator quotaCalculator[func() int]

ClusterAwareQuotaCalculator calculates the available quota for the current host based on the per instance and per cluster quota. The quota could represent requests per second, total number of active requests, etc. It works by dividing the per cluster quota by the total number of instances running the same service.

func (ClusterAwareQuotaCalculator) GetQuota

func (l ClusterAwareQuotaCalculator) GetQuota() float64

type LoggedCalculator

type LoggedCalculator struct {
	// contains filtered or unexported fields
}

func NewLoggedCalculator

func NewLoggedCalculator(
	calculator Calculator,
	logger log.Logger,
) *LoggedCalculator

func (*LoggedCalculator) GetQuota

func (c *LoggedCalculator) GetQuota() float64

type LoggedNamespaceCalculator

type LoggedNamespaceCalculator struct {
	// contains filtered or unexported fields
}

func NewLoggedNamespaceCalculator

func NewLoggedNamespaceCalculator(
	calculator NamespaceCalculator,
	logger log.Logger,
) *LoggedNamespaceCalculator

func (*LoggedNamespaceCalculator) GetQuota

func (c *LoggedNamespaceCalculator) GetQuota(namespace string) float64

type MemberCounter

type MemberCounter interface {
	AvailableMemberCount() int
}

MemberCounter returns the total number of instances there are for a given service.

type NamespaceCalculator

type NamespaceCalculator interface {
	GetQuota(namespace string) float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL