reaper

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unit = time.Minute
)

Variables

View Source
var (
	Settings = &settings.Settings
	Log      = logr.WithName("reaper")
)

Functions

This section is empty.

Types

type BucketReaper

type BucketReaper struct {
	// DB
	DB *gorm.DB
}

BucketReaper bucket reaper.

func (*BucketReaper) Run

func (r *BucketReaper) Run()

Run Executes the reaper. A bucket is deleted when it is no longer referenced and the TTL has expired.

type FileReaper added in v0.1.0

type FileReaper struct {
	// DB
	DB *gorm.DB
}

FileReaper file reaper.

func (*FileReaper) Run added in v0.1.0

func (r *FileReaper) Run()

Run Executes the reaper. A file is deleted when it is no longer referenced and the TTL has expired.

type GroupReaper

type GroupReaper struct {
	// DB
	DB *gorm.DB
}

GroupReaper reaps task groups.

func (*GroupReaper) Run

func (r *GroupReaper) Run()

Run Executes the reaper. Rules by state:

Created
- Deleted after the defined period.
Ready (submitted)
- Deleted when all of its task have been deleted.
- Bucket is released immediately.

type Manager

type Manager struct {
	// DB
	DB *gorm.DB
	// k8s client.
	Client k8s.Client
}

Manager provides task management.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context)

Run the manager.

type Reaper

type Reaper interface {
	Run()
}

Reaper interface.

type RefCounter added in v0.1.0

type RefCounter struct {
	// DB
	DB *gorm.DB
}

RefCounter provides model inspection for files tagged with: ref:<kind>.

func (*RefCounter) Count added in v0.1.0

func (r *RefCounter) Count(m interface{}, kind string, pk uint) (nRef int64, err error)

Count find & count references.

type Task

type Task = task.Task

type TaskReaper

type TaskReaper struct {
	// DB
	DB *gorm.DB
	// k8s client.
	Client k8s.Client
}

TaskReaper reaps tasks.

func (*TaskReaper) Run

func (r *TaskReaper) Run()

Run Executes the reaper. Rules by state:

Created
- Deleted after TTL.Created > created timestamp or
  settings.Task.Reaper.Created.
Pending
- Deleted after TTL.Pending > created timestamp or
  settings.Task.Reaper.Created.
Postponed
- Deleted after TTL.Postponed > created timestamp or
  settings.Task.Reaper.Created.
Running
- Deleted after TTL.Running > started timestamp.
Succeeded
- Deleted after TTL > terminated timestamp or
  settings.Task.Reaper.Succeeded.
- Bucket is released after the defined period.
- Pod is deleted after the defined period.
Failed
- Deleted after TTL > terminated timestamp or
  settings.Task.Reaper.Failed.
- Bucket is released after the defined period.
- Pod is deleted after the defined period.

func (*TaskReaper) TTL

func (r *TaskReaper) TTL(m *model.Task) (ttl api.TTL)

TTL returns the task TTL.

Jump to

Keyboard shortcuts

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