provider

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateBackoffForAttempt

func CalculateBackoffForAttempt(attempt float64) time.Duration

CalculateBackoffForAttempt returns the duration for a specific attempt. This is useful if you have a large number of independent Backoffs, but don't want use unnecessary memory storing the Backoff parameters per Backoff. The first attempt should be 0.

ForAttempt is concurrent-safe.

Types

type ExecutionProvider

type ExecutionProvider interface {
	Execute(interface{}, *Response) error
}

ExecutionProvider is used for executing cronjobs

type Response

type Response struct {
	StatusCode int    `json:"status_code"`
	Response   []byte `json:"response"`
}

Response contains data that executors can return

type SourceProvider

type SourceProvider interface {
	Read() error
	OnTaskUpdate(func(*Task) error)
	Stop() error
	TaskStarted(*Task) error
	TaskDone(*Task) error
	TaskError(*Task, error) error
}

SourceProvider is used to get tasks

type Task

type Task struct {
	Name              string         `json:"name"`
	Running           bool           `json:"is_running,omitempty"`
	Expression        string         `json:"schedule,omitempty"`
	LastRunAt         time.Time      `json:"last_run_at,omitempty"`
	AfterTask         string         `json:"after_task,omitempty"`
	Key               string         `json:"-"`
	SourceProvider    SourceProvider `json:"-"`
	Executor          string         `json:"executor"`
	ExecutionConfig   interface{}    `json:"execution_config"`
	LastError         string         `json:"last_error"`
	CurrentRetryCount int            `json:"current_retry_counter"`
	MaxRetries        int            `json:"max_retries"`
}

Task represents a task to be run

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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