limits

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentConfig

type AgentConfig struct {
	Agent    string        `yaml:"agent"`
	Schedule string        `yaml:"schedule"`
	Duration time.Duration `yaml:"duration"`
}

AgentConfig holds the limit configuration for a user agent.

type Agents

type Agents map[string]*Cron

Agents holds the cron limits for a set of user agents.

func ParseConfig

func ParseConfig(path string) (Agents, error)

ParseConfig interprets the configuration file and returns the set of agent limits.

type Config

type Config []AgentConfig

Config holds the limit configuration for all user agents.

type Cron

type Cron struct {
	*cronexpr.Expression
	// contains filtered or unexported fields
}

Cron infers time limits based on a cron schedule.

func NewCron

func NewCron(schedule string, duration time.Duration) *Cron

NewCron returns a new instance of Cron.

func (*Cron) IsLimited

func (c *Cron) IsLimited(t time.Time) bool

IsLimited returns whether the input time is within a time-limited window [start, end).

Jump to

Keyboard shortcuts

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