engine

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateIdle        = "IDLE"
	StateRunning     = "RUNNING"
	StateTerminating = "TERMINATING"
	StateTerminated  = "TERMINATED"
)

Variables

This section is empty.

Functions

func RegisterEndpoint added in v0.1.7

func RegisterEndpoint(method, path string, handler web.HandlerFunc)

func RegisterJobMiddleware added in v0.1.7

func RegisterJobMiddleware(mw job.MiddlewareFunc)

func RegisterNodeMiddleware added in v0.1.7

func RegisterNodeMiddleware(mw node.MiddlewareFunc)

func RegisterTaskMiddleware added in v0.1.7

func RegisterTaskMiddleware(mw task.MiddlewareFunc)

func RegisterWebMiddleware added in v0.1.7

func RegisterWebMiddleware(mw web.MiddlewareFunc)

func Run added in v0.1.7

func Run() error

func SetMode added in v0.1.7

func SetMode(mode Mode)

func Start added in v0.1.7

func Start() error

func SubmitJob added in v0.1.7

func SubmitJob(ctx context.Context, ij *input.Job, listeners ...web.JobListener) (*tork.Job, error)

func Terminate added in v0.1.7

func Terminate() error

Types

type Config added in v0.1.5

type Config struct {
	Mode       Mode
	Middleware Middleware
	Endpoints  map[string]web.HandlerFunc
}

type Engine

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

func New

func New(cfg Config) *Engine

func (*Engine) RegisterEndpoint

func (e *Engine) RegisterEndpoint(method, path string, handler web.HandlerFunc)

func (*Engine) RegisterJobMiddleware

func (e *Engine) RegisterJobMiddleware(mw job.MiddlewareFunc)

func (*Engine) RegisterNodeMiddleware

func (e *Engine) RegisterNodeMiddleware(mw node.MiddlewareFunc)

func (*Engine) RegisterTaskMiddleware

func (e *Engine) RegisterTaskMiddleware(mw task.MiddlewareFunc)

func (*Engine) RegisterWebMiddleware added in v0.1.7

func (e *Engine) RegisterWebMiddleware(mw web.MiddlewareFunc)

func (*Engine) Run added in v0.1.7

func (e *Engine) Run() error

func (*Engine) SetMode added in v0.1.7

func (e *Engine) SetMode(mode Mode)

func (*Engine) Start

func (e *Engine) Start() error

func (*Engine) SubmitJob added in v0.1.7

func (e *Engine) SubmitJob(ctx context.Context, ij *input.Job, listeners ...web.JobListener) (*tork.Job, error)

func (*Engine) Terminate

func (e *Engine) Terminate() error

type Middleware added in v0.1.5

type Middleware struct {
	Web  []web.MiddlewareFunc
	Task []task.MiddlewareFunc
	Job  []job.MiddlewareFunc
	Node []node.MiddlewareFunc
}

type Mode

type Mode string
const (
	ModeCoordinator Mode = "coordinator"
	ModeWorker      Mode = "worker"
	ModeStandalone  Mode = "standalone"
)

type OnStartedHandler

type OnStartedHandler func() error

OnStartedHandler a bootstrap hook that is called after Tork has finished starting up. If a non-nil error is returned it will terminate the bootstrap process.

Jump to

Keyboard shortcuts

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