server

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package server bootstraps and runs the Job Runner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

func NewServer

func NewServer(appCtx app.Context) *Server

func (*Server) API

func (s *Server) API() *api.API

API returns the Job Runner API created in Boot.

func (*Server) Boot

func (s *Server) Boot() error

Boot sets up the server. It must be called before calling Run.

func (*Server) Run

func (s *Server) Run(stopOnSignal bool) error

Run runs the Job Runner API in the foreground. It returns when the API stops running (either from an error, or after a call to Stop). If a custom RunAPI hook has been provided, it will be called to run the API instead of the default api.Run.

If stopOnSignal = true, the server will listen for TERM and INT signals from the OS and call Stop to shut itself down when those signals are received. Else, the caller must call Stop to shut down the server.

func (*Server) Stop

func (s *Server) Stop() error

Stop stops the server. It signals running traversers to shut down and then stops the API (using either the default api.Stop or the StopAPI hook if provided). Once Stop has been called, the server cannot be reused - future calls to Run will return an error.

If stopOnSignal was set when calling Run, Stop will automatically be called by the server on receiving a TERM or INT signal from the OS. Otherwise, you must call Stop when you want to shut down the Job Runner.

Jump to

Keyboard shortcuts

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