options

package
v0.0.0-...-c447f9b Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package options provides ways to extract the task-related options from a Flux script.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableScriptCacheForTest

func EnableScriptCacheForTest()

EnableScriptCacheForTest is used as a workaround for https://github.com/influxdata/platform/issues/484, and should be removed after that issue is addressed. Do not call this method in production code, as it will leak memory.

Types

type Options

type Options struct {
	// Name is a non optional name designator for each task.
	Name string `json:"options,omitempty"`

	// Cron is a cron style time schedule that can be used in place of Every.
	Cron string `json:"cron,omitempty"`

	// Every represents a fixed period to repeat execution.
	// this can be unmarshaled from json as a string i.e.: "1d" will unmarshal as 1 day
	Every time.Duration `json:"every,omitempty"`

	// Offset represents a delay before execution.
	// this can be unmarshaled from json as a string i.e.: "1d" will unmarshal as 1 day
	Offset time.Duration `json:"offset,omitempty"`

	Concurrency int64 `json:"concurrency,omitempty"`

	Retry int64 `json:"retry,omitempty"`
}

Options are the task-related options that can be specified in a Flux script.

func FromScript

func FromScript(script string) (Options, error)

FromScript extracts Options from a Flux script.

func (*Options) Clear

func (o *Options) Clear()

Clear clears out all options in the options struct, it us useful if you wish to reuse it.

func (*Options) EffectiveCronString

func (o *Options) EffectiveCronString() string

EffectiveCronString returns the effective cron string of the options. If the cron option was specified, it is returned. If the every option was specified, it is converted into a cron string using "@every". Otherwise, the empty string is returned. The value of the offset option is not considered.

func (*Options) IsZero

func (o *Options) IsZero() bool

func (*Options) Validate

func (o *Options) Validate() error

Validate returns an error if the options aren't valid.

Jump to

Keyboard shortcuts

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