apiserver

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAddr = "0.0.0.0:7074"

DefaultAddr is the default address of the APIServer

Variables

This section is empty.

Functions

This section is empty.

Types

type APIServer

type APIServer struct {
	*types.BaseService
	// contains filtered or unexported fields
}

APIServer runs a HTTP server to receive messages from the replicas and provide an interactive dashboard

func NewAPIServer

func NewAPIServer(ctx *context.RootContext, messageParser types.MessageParser, dashboard DashboardRouter) *APIServer

NewAPIServer instantiates APIServer

func (*APIServer) HandleDashboard

func (srv *APIServer) HandleDashboard(c *gin.Context)

HandleDashboard is the handler for the router `/dashboard`

func (*APIServer) HandleDashboardName

func (srv *APIServer) HandleDashboardName(c *gin.Context)

HandleDashboardName is the handler for `/dashboard/name` route of the APIServer

func (*APIServer) HandleEvent

func (srv *APIServer) HandleEvent(c *gin.Context)

HandleEvent is the handler for the router `/event` . The route is used by replicas to send events to the scheduler

func (*APIServer) HandleLog

func (srv *APIServer) HandleLog(c *gin.Context)

HandleLog is the handler for the route `/log` The route is used by replicas to send log messages

func (*APIServer) HandleMessage

func (srv *APIServer) HandleMessage(c *gin.Context)

HandleMessage is the handler for the route `/message` which is used by replicas to send messages

func (*APIServer) HandleReplicaPost

func (srv *APIServer) HandleReplicaPost(c *gin.Context)

HandleReplicaPost is the handler for the route `/replica` for a POST request. The route is used by replicas to register and start communicating with the scheduler

func (*APIServer) Start

func (a *APIServer) Start()

Start starts the APIServer and implements Service

func (*APIServer) Stop

func (a *APIServer) Stop()

Stop stops the APIServer and implements Service

type DashboardRouter

type DashboardRouter interface {
	// Name should return the key for the dashboard type
	Name() string
	// SetupRouter should set up the routes for the dashboard
	SetupRouter(*gin.RouterGroup)
}

DashboardRouter for handling routes that are specific to the dashboard. The APIServer will be initialized with an instance of DashboardRouter. The dashboard routes depends on the mode in which the scheduler is run.

Jump to

Keyboard shortcuts

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