api

package
Version: v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package api provides controllers for each api endpoint. Controllers are "dumb wiring"; there is little to no application logic in this package. Controllers call and coordinate other packages to satisfy the api endpoint.

Index

Constants

View Source
const (
	API_ROOT = "/api/v1/"
)

Variables

View Source
var (
	// Errors related to getting and setting traversers in the traverser repo.
	ErrDuplicateTraverser = errors.New("traverser already exists")
	ErrTraverserNotFound  = errors.New("traverser not found")
	ErrInvalidTraverser   = errors.New("traverser found, but type is invalid")

	// Error when Job Runner is shutting down and not starting new job chains
	ErrShuttingDown = errors.New("Job Runner is shutting down - no new job chains are being started")
)

Functions

This section is empty.

Types

type API

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

api provides controllers for endpoints it registers with a router.

func NewAPI

func NewAPI(cfg Config) *API

NewAPI creates a new API struct. It initializes an echo web server within the struct, and registers all of the API's routes with it.

func (*API) Run

func (api *API) Run() error

Run API server.

func (*API) ServeHTTP

func (api *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*API) Stop

func (api *API) Stop() error

Stop stops the API when it's running. When Stop is called, Run returns immediately. Make sure to wait for Stop to return.

type Config

type Config struct {
	AppCtx           app.Context
	TraverserFactory chain.TraverserFactory
	TraverserRepo    cmap.ConcurrentMap
	StatusManager    status.Manager
	ShutdownChan     chan struct{}
	BaseURL          string // returned in location header when starting/resuming job chains
}

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