handlers

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueryKeys = struct {
	EngineID,
	EngineIDAlias string
}{
	EngineID:      "engine",
	EngineIDAlias: "key",
}

QueryKeys is a set of uri query keys.

Functions

func GetEngineID

func GetEngineID(ctx *handler.Context) (engine.ID, error)

GetEngineID gets the engine.ID from the uri query and returns it, otherwise returns BAD_REQUEST error.

func NewCloseHandler

func NewCloseHandler(es service.EngineService, logger logger.Logger) handler.Handler

func NewConnectHandler

func NewConnectHandler(es service.EngineService, logger logger.Logger) handler.Handler

func NewInitHandler

func NewInitHandler(
	es service.EngineService,
	config *config.Config,
	logger logger.Logger,
) handler.Handler

func NewOKHandler

func NewOKHandler() handler.Handler

func NewStartHandler

func NewStartHandler(es service.EngineService, logger logger.Logger) handler.Handler

func NewStopHandler

func NewStopHandler(es service.EngineService, logger logger.Logger) handler.Handler

func WithEngineID

func WithEngineID(ctx *handler.Context, block func(engine.ID) error) error

WithEngineID executes block with a engine.ID if the engine name is specified, otherwise returns BAD_REQUEST error.

Types

type CloseHandler

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

CloseHandler is a handler to close the engine connection. When the engine state is

  • NotConnected, then returns NOT_FOUND or BAD_REQUEST
  • Connected, StandBy or Thinking, then closes connection and returns OK

See domain/entity/engine/state.go about engine state.

func (*CloseHandler) Description

func (*CloseHandler) Description() string

func (*CloseHandler) Func

func (hdr *CloseHandler) Func(ctx *handler.Context) error

func (*CloseHandler) Methods

func (*CloseHandler) Methods() []string

type ConnectHandler

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

ConnectHandler is a handler for connecting (initializing) to the engine. When the engine state is Connected, StandBy or Thinking, then returns BAD_REQUEST See domain/entity/engine/state.go about engine state.

func (*ConnectHandler) Description

func (*ConnectHandler) Description() string

func (*ConnectHandler) Func

func (hdr *ConnectHandler) Func(ctx *handler.Context) error

func (*ConnectHandler) Methods

func (*ConnectHandler) Methods() []string

type InitHandler

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

InitHandler is a handler that initializes all engine. It closes all engines and returns the list of engine names.

func (*InitHandler) Description

func (*InitHandler) Description() string

func (*InitHandler) Func

func (hdr *InitHandler) Func(ctx *handler.Context) error

func (*InitHandler) Methods

func (*InitHandler) Methods() []string

type OKHandler

type OKHandler struct{}

OKHandler is a handler that just says OK.

func (*OKHandler) Description

func (*OKHandler) Description() string

func (*OKHandler) Func

func (hdr *OKHandler) Func(ctx *handler.Context) error

func (*OKHandler) Methods

func (*OKHandler) Methods() []string

type StartHandler

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

StartHandler is a handler for starting the engine think. When the engine state is

  • NotConnected, then returns NOT_FOUND or BAD_REQUEST
  • Connected or StandBy, then starts thinking and returns OK
  • Thinking, then returns OK (do nothing)

See domain/entity/engine/state.go about engine state.

func (*StartHandler) Description

func (*StartHandler) Description() string

func (*StartHandler) Func

func (hdr *StartHandler) Func(ctx *handler.Context) error

func (*StartHandler) Methods

func (*StartHandler) Methods() []string

type StopHandler

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

StopHandler is a handler for stopping the engine think. When the engine state is

  • NotConnected, then returns NOT_FOUND or BAD_REQUEST
  • Connected or StandBy, then returns OK (do nothing)
  • Thinking, then stops thinking and returns OK

See domain/entity/engine/state.go about engine state.

func (*StopHandler) Description

func (*StopHandler) Description() string

func (*StopHandler) Func

func (hdr *StopHandler) Func(ctx *handler.Context) error

func (*StopHandler) Methods

func (*StopHandler) Methods() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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