throttle

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2016 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetThrottleForGroup

func GetThrottleForGroup(group string, groups *[]config.SecurityGroups) (requestsPerSecond int64)

GetThrottleForGroup takes a group name and a pointer to array of groups. It returns an int64 representing the number of requests the group is allowed to make per second, or 0 (do not throttle) if the key doesn't exist.

func GroupLimitReached

func GroupLimitReached(throttle map[string]map[int]time.Time, groupname string, requestsPerSecond int64) bool

GroupLimitReached takes the throttle groups, the group name to check, and the requests the group is limited to per second. It counts the group's requests made in the past second that have not been throttled. Returns true if the group has exceeded their request per second count. Otherwise, it returns false.

func InitThrottleGroups

func InitThrottleGroups(groups *[]config.SecurityGroups, throttle map[string]map[int]time.Time) map[string]map[int]time.Time

InitThrottleGroups takes the security groups and empty throttle map It returns the throttle map with individual maps for each group name Create a map where the keys are the group's name, and will contain a map of timestamps

Types

This section is empty.

Jump to

Keyboard shortcuts

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