app

package
Version: v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(appCtx Context) (config.JobRunner, error)

func MakeRequestManagerClient

func MakeRequestManagerClient(appCtx Context) (rm.Client, error)

func ServerURL

func ServerURL(appCtx Context) (string, error)

Default ServerURL Hook. Uses Server.Addr from config as the host and sets scheme based on the presence of a TLS config.

Types

type Context

type Context struct {
	Hooks     Hooks
	Factories Factories

	Config config.JobRunner
}

func Defaults

func Defaults() Context

type Factories

type Factories struct {
	MakeRequestManagerClient func(Context) (rm.Client, error)
}

type Hooks

type Hooks struct {
	LoadConfig func(Context) (config.JobRunner, error)

	// RunAPI runs the Job Runner API. It should block until the API is stopped
	// via a call to StopAPI. If this hook is provided, it is called instead of
	// api.Run, and StopAPI must be provided as well.
	RunAPI func() error

	// StopAPI stops running the Job Runner API. It's called when the server is
	// stopped, and it should cause RunAPI to return. If this hook is provided, it
	// is called instead of api.Stop, and RunAPI must be provided as well.
	StopAPI func() error

	// ServerURL returns the base URL to be used for querying this Job Runner's API.
	// This URL is returned to the Request Manager when a job chain is run, so the
	// Request Manager may direct status/stop queries for the request to the
	// correct Job Runner instance. The default ServerURL hook must be overriden if
	// a Addr (and TLS config) is not provided in the Job Runner config
	// file. This is typical if a RunAPI hook has been provided, as Addr
	// and TLS config files are used only in the default api.Run.
	ServerURL func(Context) (string, error)
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL