limit

package
v0.31.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID string

ID represents the identifier for a given system limit.

const (
	// Maximum number of notification rules per user.
	NotificationRulesPerUser ID = "notification_rules_per_user"
	// Maximum number of contact methods per user.
	ContactMethodsPerUser ID = "contact_methods_per_user"
	// Maximum number of steps on a single escalation policy.
	EPStepsPerPolicy ID = "ep_steps_per_policy"
	// Maximum number of actions on a single escalation policy step.
	EPActionsPerStep ID = "ep_actions_per_step"
	// Maximum number of participants per rotation.
	ParticipantsPerRotation ID = "participants_per_rotation"
	// Pertains to all rules for all assignments/targets.
	RulesPerSchedule ID = "rules_per_schedule"
	// Maximum number of integration keys per service.
	IntegrationKeysPerService ID = "integration_keys_per_service"
	// Only affects newly created alerts but not re-escalated ones.
	UnackedAlertsPerService ID = "unacked_alerts_per_service"
	// Maximum number of targets per schedule.
	TargetsPerSchedule ID = "targets_per_schedule"
	// Maximum number of heartbeat monitors per service.
	HeartbeatMonitorsPerService ID = "heartbeat_monitors_per_service"
	// Only limits future overrides (i.e. end in the future).
	UserOverridesPerSchedule ID = "user_overrides_per_schedule"
	// Maximum number of calendar subscriptions per user.
	CalendarSubscriptionsPerUser ID = "calendar_subscriptions_per_user"
)

IDs of configurable limits.

func (ID) Valid

func (id ID) Valid() error

Valid returns nil if a given ID is valid, a validation error is returned otherwise.

type Limits

type Limits map[ID]int

Limits contains the current value of all configurable limits.

func (Limits) Max

func (l Limits) Max(id ID) int

Max returns the current max value of the limit with the given ID.

type Store

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

A Store allows getting and setting system limits.

func NewStore added in v0.25.0

func NewStore(ctx context.Context, db *sql.DB) (*Store, error)

NewStore creates a new DB and prepares all necessary SQL statements.

func (*Store) All

func (s *Store) All(ctx context.Context) (Limits, error)

All will get the current value of all limits.

func (*Store) Max

func (s *Store) Max(ctx context.Context, id ID) (int, error)

Max will return the current max value for the given limit.

func (*Store) ResetAll

func (s *Store) ResetAll(ctx context.Context) error

ResetAll will reset all configurable limits to the default (no-limit).

func (*Store) SetMax

func (s *Store) SetMax(ctx context.Context, id ID, max int) error

SetMax allows setting the max value for a limit.

func (*Store) UpdateLimitsTx added in v0.25.0

func (s *Store) UpdateLimitsTx(ctx context.Context, tx *sql.Tx, id string, max int) error

UpdateLimitsTx updates all configurable limits.

Jump to

Keyboard shortcuts

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