limits

package
v0.4.27 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const Unlimited = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAction

type AccountAction interface {
	HandleAccount(a *store.Account, rxBytes, txBytes int64, limit *BandwidthPerPeriod, trx *sqlx.Tx) error
}

type Agent

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

func NewAgent

func NewAgent(cfg *Config, ifxCfg *metrics.InfluxConfig, zCfg *zrokEdgeSdk.Config, emailCfg *emailUi.Config, str *store.Store) (*Agent, error)

func (*Agent) CanAccessShare

func (a *Agent) CanAccessShare(shrId int, trx *sqlx.Tx) (bool, error)

func (*Agent) CanCreateEnvironment

func (a *Agent) CanCreateEnvironment(acctId int, trx *sqlx.Tx) (bool, error)

func (*Agent) CanCreateShare

func (a *Agent) CanCreateShare(acctId, envId int, trx *sqlx.Tx) (bool, error)

func (*Agent) Handle

func (a *Agent) Handle(u *metrics.Usage) error

func (*Agent) Start

func (a *Agent) Start()

func (*Agent) Stop

func (a *Agent) Stop()

type Bandwidth

type Bandwidth struct {
	Rx    int64
	Tx    int64
	Total int64
}

type BandwidthConfig

type BandwidthConfig struct {
	PerAccount     *BandwidthPerPeriod
	PerEnvironment *BandwidthPerPeriod
	PerShare       *BandwidthPerPeriod
}

type BandwidthPerPeriod

type BandwidthPerPeriod struct {
	Period  time.Duration
	Warning *Bandwidth
	Limit   *Bandwidth
}

func DefaultBandwidthPerPeriod

func DefaultBandwidthPerPeriod() *BandwidthPerPeriod

type Config

type Config struct {
	Environments int
	Shares       int
	Bandwidth    *BandwidthConfig
	Cycle        time.Duration
	Enforcing    bool
}

func DefaultConfig

func DefaultConfig() *Config

type EnvironmentAction

type EnvironmentAction interface {
	HandleEnvironment(e *store.Environment, rxBytes, txBytes int64, limit *BandwidthPerPeriod, trx *sqlx.Tx) error
}

type ShareAction

type ShareAction interface {
	HandleShare(s *store.Share, rxBytes, txBytes int64, limit *BandwidthPerPeriod, trx *sqlx.Tx) error
}

Jump to

Keyboard shortcuts

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