purge

package
v0.0.0-...-a7b91b5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// SchedulerCallback ...
	SchedulerCallback = "PURGE_AUDIT_LOG_CALLBACK"
)

Variables

View Source
var Ctrl = NewController()

Ctrl a global purge controller instance

Functions

func String

func String(extras map[string]interface{}) string

String convert map to json string

Types

type Controller

type Controller interface {
	// Start kick off a purge schedule
	Start(ctx context.Context, policy JobPolicy, trigger string) (int64, error)
	// Stop a purge job
	Stop(ctx context.Context, id int64) error
}

Controller defines the interface with the purge job

func NewController

func NewController() Controller

NewController ...

type JobPolicy

type JobPolicy struct {
	Trigger           *Trigger               `json:"trigger"`
	DryRun            bool                   `json:"dryrun"`
	RetentionHour     int                    `json:"retention_hour"`
	IncludeOperations string                 `json:"include_operations"`
	ExtraAttrs        map[string]interface{} `json:"extra_attrs"`
}

JobPolicy defines the purge job policy

type Trigger

type Trigger struct {
	Type     TriggerType      `json:"type"`
	Settings *TriggerSettings `json:"trigger_settings"`
}

Trigger holds info for a trigger

type TriggerSettings

type TriggerSettings struct {
	Cron string `json:"cron"`
}

TriggerSettings is the setting about the trigger

type TriggerType

type TriggerType string

TriggerType represents the type of trigger.

Jump to

Keyboard shortcuts

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