cleanupmanager

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriorityAlertCleanup = 1
	PrioritySchedHistory = 1
	PriorityAPICleanup   = 1
	PriorityTempSchedLFW = 2
	PriorityAlertLogsLFW = 2
	PriorityTempSched    = 3
	PriorityAlertLogs    = 4
)
View Source
const QueueName = "cleanup-manager"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeysArgs added in v0.34.0

type APIKeysArgs struct{}

func (APIKeysArgs) Kind added in v0.34.0

func (APIKeysArgs) Kind() string

type AlertArgs added in v0.34.0

type AlertArgs struct{}

func (AlertArgs) Kind added in v0.34.0

func (AlertArgs) Kind() string

type AlertLogArgs added in v0.34.0

type AlertLogArgs struct {
	StartID int64
	EndID   int64
}

func (AlertLogArgs) Kind added in v0.34.0

func (AlertLogArgs) Kind() string

type AlertLogLFWArgs added in v0.34.0

type AlertLogLFWArgs struct{}

func (AlertLogLFWArgs) Kind added in v0.34.0

func (AlertLogLFWArgs) Kind() string

type DB

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

DB handles updating escalation policies.

func NewDB

func NewDB(ctx context.Context, db *sql.DB, alertstore *alert.Store, log *slog.Logger) (*DB, error)

NewDB creates a new DB.

func (*DB) CleanupAPIKeys added in v0.34.0

func (db *DB) CleanupAPIKeys(ctx context.Context, j *river.Job[APIKeysArgs]) error

CleanupAPIKeys will revoke access to the API from unused tokens, including both user sessions and calendar subscriptions.

func (*DB) CleanupAlertLogs added in v0.34.0

func (db *DB) CleanupAlertLogs(ctx context.Context, j *river.Job[AlertLogArgs]) error

CleanupAlertLogs will remove alert log entries for deleted alerts.

func (*DB) CleanupAlerts added in v0.34.0

func (db *DB) CleanupAlerts(ctx context.Context, j *river.Job[AlertArgs]) error

CleanupAlerts will automatically close and delete old alerts.

func (*DB) CleanupScheduleData added in v0.34.0

func (db *DB) CleanupScheduleData(ctx context.Context, j *river.Job[SchedDataArgs]) error

CleanupScheduleData will automatically cleanup schedule data. - Remove temporary-schedule shifts for users that no longer exist. - Remove temporary-schedule shifts that occur in the past.

func (*DB) CleanupShifts added in v0.34.0

func (db *DB) CleanupShifts(ctx context.Context, j *river.Job[ShiftArgs]) error

CleanupShifts will automatically cleanup old shift and override records.

func (*DB) LookForWorkAlertLogs added in v0.34.0

func (db *DB) LookForWorkAlertLogs(ctx context.Context, j *river.Job[AlertLogLFWArgs]) error

LookForWorkAlertLogs will schedule alert log cleanup jobs for blocks of alert log IDs.

The strategy here is to look for the minimum and maximum alert log IDs in the database, then schedule jobs for each `blockSize` block of IDs, and those jobs will then cleanup the alert logs in that range `batchSize` at a time.

func (*DB) LookForWorkScheduleData added in v0.34.0

func (db *DB) LookForWorkScheduleData(ctx context.Context, j *river.Job[SchedDataLFW]) error

LookForWorkScheduleData will automatically look for schedules that need their JSON data cleaned up and insert them into the queue.

func (*DB) Name

func (db *DB) Name() string

Name returns the name of the module.

func (*DB) Setup added in v0.34.0

func (db *DB) Setup(ctx context.Context, args processinglock.SetupArgs) error

Setup implements processinglock.Setupable.

type SchedDataArgs added in v0.34.0

type SchedDataArgs struct {
	ScheduleID uuid.UUID
}

func (SchedDataArgs) Kind added in v0.34.0

func (SchedDataArgs) Kind() string

type SchedDataLFW added in v0.34.0

type SchedDataLFW struct{}

func (SchedDataLFW) Kind added in v0.34.0

func (SchedDataLFW) Kind() string

type ShiftArgs added in v0.34.0

type ShiftArgs struct{}

func (ShiftArgs) Kind added in v0.34.0

func (ShiftArgs) Kind() string

Jump to

Keyboard shortcuts

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