types

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSchedule

func CheckSchedule(schedule string) bool

CheckSchedule returns true if the schedule string is compliant with cron

Types

type CronFunction

type CronFunction struct {
	FuncData requests.Function
	Name     string
	Schedule string
}

CronFunction depicts an OpenFaaS function which is invoked by cron

func ToCronFunction

func ToCronFunction(f requests.Function, topic string) (CronFunction, error)

ToCronFunction converts a requests.Function object to the CronFunction and returns error if it is not possible

func (CronFunction) InvokeFunction

func (c CronFunction) InvokeFunction(i *types.Invoker) (*[]byte, error)

InvokeFunction Invokes the cron function

type CronFunctionInterface

type CronFunctionInterface interface {
	InvokeFunction(i *types.Invoker) (*[]byte, error)
}

CronFunctionInterface defines an interface to work with CronFunction during testing

type CronFunctions

type CronFunctions []CronFunction

CronFunctions a list of CronFunction

func (*CronFunctions) Contains

func (c *CronFunctions) Contains(cF *CronFunction) bool

Contains returns true if the provided CronFunction object is in list

type EntryID

type EntryID cron.EntryID

EntryID type redifined for this package

type FunctionLookupBuilder

type FunctionLookupBuilder types.FunctionLookupBuilder

FunctionLookupBuilder alias for types.FunctionLookupBuilder

func (*FunctionLookupBuilder) GetFunctions

func (lookup *FunctionLookupBuilder) GetFunctions() ([]requests.Function, error)

GetFunctions requests the OpenFaaS gteway to return a list of all functions

type ScheduledFunction

type ScheduledFunction struct {

	// Function is CronFunction object which is running
	Function CronFunction

	// Id is the entryid for the scheduled function
	ID EntryID
}

ScheduledFunction is a CronFunction that has been scheduled to run

type ScheduledFunctions

type ScheduledFunctions []ScheduledFunction

ScheduledFunctions is an array of ScheduledFunction

func (*ScheduledFunctions) Contains

func (functions *ScheduledFunctions) Contains(cronFunc *CronFunction) bool

Contains returns true if the ScheduledFunctions array contains the CronFunction

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler is an interface which talks with cron scheduler

func NewScheduler

func NewScheduler() *Scheduler

NewScheduler returns a scheduler

func (*Scheduler) AddCronFunction

func (s *Scheduler) AddCronFunction(c CronFunction, invoker *types.Invoker) (ScheduledFunction, error)

AddCronFunction adds a function to cron

func (*Scheduler) Remove

func (s *Scheduler) Remove(function ScheduledFunction)

Remove removes the function from scheduler

func (*Scheduler) Start

func (s *Scheduler) Start()

Start a scheduler in new go routine

Jump to

Keyboard shortcuts

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