api

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	API_CALL uint8 = iota // initiate
	API_ACK               // ack and stop
	API_DATA              // data
	API_ERR               // error, must not mean stop
	API_END               // silent stop
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Init(server, initiator bool, fromShip, toShip chan *container.Container)
	Run()
	Send(id uint32, msgType uint8, c *container.Container)
	EndCall(id uint32)
}

type APIBase

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

func (*APIBase) AttachConveyorBelts

func (api *APIBase) AttachConveyorBelts(lineID string, fromShip, toShip chan *container.Container)

AttachConveyorBelts attaches the Conveyor to a line.

func (*APIBase) Call

func (api *APIBase) Call(handlerID uint8, c *container.Container) *Call

func (*APIBase) EndCall

func (api *APIBase) EndCall(id uint32)

func (*APIBase) Init

func (api *APIBase) Init(server, initiator bool, fromShip, toShip chan *container.Container)

func (*APIBase) IsAbandoned

func (api *APIBase) IsAbandoned() bool

func (*APIBase) RegisterCall added in v0.2.2

func (api *APIBase) RegisterCall(call *Call)

func (*APIBase) RegisterHandler

func (api *APIBase) RegisterHandler(id uint8, handler ApiHandler)

func (*APIBase) Run

func (api *APIBase) Run()

func (*APIBase) Send

func (api *APIBase) Send(id uint32, msgType uint8, c *container.Container)

func (*APIBase) Shutdown

func (api *APIBase) Shutdown()

type ApiError

type ApiError struct {
	Temporary bool
	Msg       string
}

func NewApiError

func NewApiError(msg string) *ApiError

func ParseError

func ParseError(c *container.Container) *ApiError

func (*ApiError) Bytes

func (err *ApiError) Bytes() []byte

func (*ApiError) Error

func (err *ApiError) Error() string

func (*ApiError) MarkAsTemporary

func (err *ApiError) MarkAsTemporary() *ApiError

type ApiHandler

type ApiHandler func(call *Call, c *container.Container)

type ApiMsg

type ApiMsg struct {
	MsgType   uint8
	Container *container.Container
}

type Call

type Call struct {
	Api       API
	Initiator bool
	ID        uint32

	Msgs chan *ApiMsg
	// contains filtered or unexported fields
}

func (*Call) End

func (call *Call) End()

func (*Call) IsEnded

func (call *Call) IsEnded() bool

func (*Call) SendAck

func (call *Call) SendAck()

func (*Call) SendData

func (call *Call) SendData(c *container.Container)

func (*Call) SendError

func (call *Call) SendError(msg string)

func (*Call) SendTemporaryError

func (call *Call) SendTemporaryError(msg string)

Jump to

Keyboard shortcuts

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