Documentation
¶
Index ¶
- Variables
- func InitData()
- type Config
- type Data
- type DataElement
- type Dataer
- type Entry
- func (t *Entry) GetLastRun() time.Time
- func (t Entry) GetNext() (time.Time, time.Duration, error)
- func (t Entry) GetNextAt(tm time.Time) (time.Time, time.Duration, error)
- func (t *Entry) LastRunFile() string
- func (t *Entry) LastSuccessFile() string
- func (t *Entry) LoadLast() time.Time
- func (t Entry) LogPrefix() string
- func (t *Entry) RID() string
- func (t *Entry) SetLastRun(tm time.Time) error
- func (t *Entry) SetLastSuccess(tm time.Time) error
- type OnFilter
- type OnPace
- type Table
- func (t Table) Add(i interface{}) Table
- func (t Table) AddEntries(l ...Entry) Table
- func (t Table) AddTable(l Table) Table
- func (t Table) DeepCopy() *Table
- func (t Table) DelEntry(e Entry) Table
- func (t Table) Merge(i interface{}) Table
- func (t Table) MergeEntries(l ...Entry) Table
- func (t Table) MergeEntry(e Entry) Table
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // OnKinds are the event kinds an action can run on: the events of the // node a file installed from what the node knows is to be installed // again on, and the install of files of the object, which what reads // them is to read again. OnKinds = []string{ "FileInstalled", "NetworkPeersUpdated", } // DefaultPace is the pace of the runs of an action whose // pace is not set. DefaultPace = "@10s" )
Functions ¶
Types ¶
type Config ¶
type Config struct {
Action string `json:"action"`
Schedule string `json:"schedule"`
Key string `json:"key"`
MaxParallel int `json:"max_parallel"`
Require string `json:"require,omitempty"`
RequireCollector bool `json:"require_collector"`
RequireProvisioned bool `json:"require_provisioned"`
RunDir string `json:"-"`
// RequireReplicationSource schedules the action on the node the
// data is replicated from only.
RequireReplicationSource bool `json:"require_replication_source,omitempty"`
// StatefileKey is used in the last run filename and last run success formatters.
// Defaults to Action if empty.
StatefileKey string `json:"-"`
// On are the events running the action, each one an event kind
// and the values of the fields of the event it requires:
// "NetworkPeersUpdated,name=backend1".
On []string `json:"on,omitempty"`
// Pace paces the runs the events ask for: "@30s" runs at
// most once each 30s, "@30s backoff @1m" stretches the interval
// up to 1m while the events keep coming.
Pace string `json:"pace,omitempty"`
}
type Data ¶
Data defines a shared holder for all objects Dataer
var ( // TableData is the package data holder for all objects schedule TableData *Data[Table] )
func (*Data[T]) GetAll ¶
func (c *Data[T]) GetAll() []DataElement[T]
type DataElement ¶
type Entry ¶
type Entry struct {
Config
LastRunAt time.Time `json:"last_run_at"`
NextRunAt time.Time `json:"next_run_at"`
Node string `json:"node"`
Path naming.Path `json:"path"`
}
func (*Entry) GetLastRun ¶
func (Entry) GetNextAt ¶
GetNextAt returns the next time the entry is allowed to run after tm, given its last run, and the duration it stays allowed.
A caller computing a delay from a time it read passes that time, so the delay and the next date are computed from the same clock reading.
func (*Entry) LastRunFile ¶
func (*Entry) LastSuccessFile ¶
type OnFilter ¶
OnFilter is an event an action runs on: its kind, and the values of the fields of the event it requires.
type OnPace ¶
OnPace paces the runs the events ask for: a run at most each Interval, stretched up to Max while the events keep coming.
type Table ¶
type Table []Entry
func (Table) AddEntries ¶
func (Table) MergeEntries ¶
func (Table) MergeEntry ¶
Click to show internal directories.
Click to hide internal directories.