taskmanager

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package taskmanager provides a background task scheduler for the cc-backend. It manages various periodic tasks such as job archiving (retention), database compression, LDAP synchronization, and statistic updates.

The package uses the gocron library to schedule tasks. Configuration for the tasks is provided via JSON configs passed to the Start function.

Index

Constants

View Source
const (
	DefaultCompressOlderThan = 7
)

Variables

This section is empty.

Functions

func RegisterCommitJobService

func RegisterCommitJobService()

func RegisterCompressionService

func RegisterCompressionService(compressOlderThan int)

func RegisterFootprintWorker

func RegisterFootprintWorker()

func RegisterLdapSyncService

func RegisterLdapSyncService(ds string)

func RegisterNodeStateRetentionDeleteService

func RegisterNodeStateRetentionDeleteService(ageHours int)

func RegisterNodeStateRetentionMoveService

func RegisterNodeStateRetentionMoveService(cfg *config.NodeStateRetention)

func RegisterRetentionCopyService

func RegisterRetentionCopyService(cfg Retention)

func RegisterRetentionDeleteService

func RegisterRetentionDeleteService(cfg Retention)

func RegisterRetentionMoveService

func RegisterRetentionMoveService(cfg Retention)

func RegisterStopJobsExceedTime

func RegisterStopJobsExceedTime()

func RegisterUpdateDurationWorker

func RegisterUpdateDurationWorker()

func Shutdown

func Shutdown()

Shutdown stops the task manager and its scheduler.

func Start

func Start(cronCfg, archiveConfig json.RawMessage)

Start initializes the task manager, parses configurations, and registers background tasks. It starts the gocron scheduler.

Types

type CronFrequency

type CronFrequency struct {
	// Duration Update Worker [Defaults to '2m']
	CommitJobWorker string `json:"commit-job-worker"`
	// Duration Update Worker [Defaults to '5m']
	DurationWorker string `json:"duration-worker"`
	// Metric-Footprint Update Worker [Defaults to '10m']
	FootprintWorker string `json:"footprint-worker"`
}

CronFrequency defines the execution intervals for various background workers.

var (

	// Keys holds the configured frequencies for cron jobs.
	Keys CronFrequency
)

type Retention

type Retention struct {
	Policy             string `json:"policy"`
	Format             string `json:"format"`
	Age                int    `json:"age"`
	IncludeDB          bool   `json:"include-db"`
	OmitTagged         string `json:"omit-tagged"`
	TargetKind         string `json:"target-kind"`
	TargetPath         string `json:"target-path"`
	TargetEndpoint     string `json:"target-endpoint"`
	TargetBucket       string `json:"target-bucket"`
	TargetAccessKey    string `json:"target-access-key"`
	TargetSecretKey    string `json:"target-secret-key"`
	TargetRegion       string `json:"target-region"`
	TargetUsePathStyle bool   `json:"target-use-path-style"`
	MaxFileSizeMB      int    `json:"max-file-size-mb"`
}

Retention defines the configuration for job retention policies.

Jump to

Keyboard shortcuts

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