function

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Category is the category of Function.
	Category = supervisor.CategoryPipeline

	// Kind is the kind of Function.
	Kind = "Function"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cron

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

Cron is the cron job for http probe.

func NewCron

func NewCron(url string, spec *CronSpec) *Cron

NewCron creates a Cron.

func (*Cron) Close

func (c *Cron) Close()

Close closes the CronJob.

func (*Cron) Status

func (c *Cron) Status() *CronStatus

Status returns the status of Cron.

type CronSpec

type CronSpec struct {
	WithSecond bool   `yaml:"withSecond"`
	Spec       string `yaml:"spec" jsonschema:"required"`
}

CronSpec is the spec of Cron.

func (CronSpec) Validate

func (spec CronSpec) Validate() error

Validate validates CronSpec.

type CronStatus

type CronStatus struct {
	Total   uint64
	Succeed uint64
	Failed  uint64
	Codes   map[int]uint64
}

CronStatus is the status of Cron.

type Function

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

Function is Object Function.

func (*Function) Category

func (f *Function) Category() supervisor.ObjectCategory

Category returns the category of Function.

func (*Function) Close

func (f *Function) Close()

Close closes Function.

func (*Function) DefaultSpec

func (f *Function) DefaultSpec() interface{}

DefaultSpec returns the default spec of Function.

func (*Function) Handle

func (f *Function) Handle(ctx context.HTTPContext)

Handle handles all HTTP incoming traffic.

func (*Function) Inherit

func (f *Function) Inherit(superSpec *supervisor.Spec,
	previousGeneration supervisor.Object, super *supervisor.Supervisor)

Inherit inherits previous generation of Function.

func (*Function) Init

func (f *Function) Init(superSpec *supervisor.Spec, super *supervisor.Supervisor)

Init initializes Function.

func (*Function) Kind

func (f *Function) Kind() string

Kind returns the kind of Function.

func (*Function) Status

func (f *Function) Status() *supervisor.Status

Status returns Status genreated by Runtime.

type RequestAdapotorSpec

type RequestAdapotorSpec struct {
	Method string                `yaml:"method" jsonschema:"omitempty,format=httpmethod"`
	Path   *pathadaptor.Spec     `yaml:"path,omitempty" jsonschema:"omitempty"`
	Header *httpheader.AdaptSpec `yaml:"header,omitempty" jsonschema:"omitempty"`
}

RequestAdapotorSpec describes the RequestAdaptor.

type Spec

type Spec struct {
	URL            string               `yaml:"url" jsonschema:"required"`
	Cron           *CronSpec            `yaml:"cron" jsonschema:"omitempty"`
	RequestAdaptor *RequestAdapotorSpec `yaml:"requestAdaptor" jsonschema:"omitempty"`
}

Spec describes the Function.

func (Spec) Validate

func (spec Spec) Validate() error

Validate validates Spec.

type Status

type Status struct {
	Health string `yaml:"health"`

	HTTP *httpstat.Status `yaml:"http"`
	Cron *CronStatus      `yaml:"cron"`
}

Status is the status of Function.

Jump to

Keyboard shortcuts

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