schedule

package
v0.0.0-...-ffd2651 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitData

func InitData()

InitData reset package objects data, it can be used for tests.

Types

type Data

type Data[T Dataer] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Data defines a shared holder for all objects Dataer

var (
	// TableData is the package data holder for all objects schedule
	TableData *Data[Table]
)

func NewData

func NewData[T Dataer]() *Data[T]

func (*Data[T]) Get

func (c *Data[T]) Get(p naming.Path) *T

func (*Data[T]) GetAll

func (c *Data[T]) GetAll() []DataElement[T]

func (*Data[T]) GetPaths

func (c *Data[T]) GetPaths() naming.Paths

func (*Data[T]) Set

func (c *Data[T]) Set(p naming.Path, v *T)

func (*Data[T]) Unset

func (c *Data[T]) Unset(p naming.Path)

type DataElement

type DataElement[T Dataer] struct {
	Path  naming.Path
	Value *T
}

type Dataer

type Dataer interface {
	Table
}

type Entry

type Entry struct {
	Action             string      `json:"action"`
	Schedule           string      `json:"schedule"`
	Key                string      `json:"key"`
	LastRunAt          time.Time   `json:"last_run_at"`
	LastRunFile        string      `json:"last_run_file"`
	LastSuccessFile    string      `json:"last_success_file"`
	NextRunAt          time.Time   `json:"next_run_at"`
	Node               string      `json:"node"`
	Path               naming.Path `json:"path"`
	RequireCollector   bool        `json:"require_collector"`
	RequireProvisioned bool        `json:"require_provisioned"`
}

func (Entry) GetNext

func (t Entry) GetNext() (time.Time, time.Duration, error)

func (Entry) RID

func (t Entry) RID() string

func (Entry) SetLastRun

func (t Entry) SetLastRun(tm time.Time) error

func (Entry) SetLastSuccess

func (t Entry) SetLastSuccess(tm time.Time) error

type Table

type Table []Entry

func NewTable

func NewTable(entries ...Entry) Table

func (Table) Add

func (t Table) Add(i interface{}) Table

func (Table) AddEntries

func (t Table) AddEntries(l ...Entry) Table

func (Table) AddTable

func (t Table) AddTable(l Table) Table

func (Table) DelEntry

func (t Table) DelEntry(e Entry) Table

func (Table) Merge

func (t Table) Merge(i interface{}) Table

func (Table) MergeEntries

func (t Table) MergeEntries(l ...Entry) Table

func (Table) MergeEntry

func (t Table) MergeEntry(e Entry) Table

Jump to

Keyboard shortcuts

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