input

package
v3.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExceptionFunc

type ExceptionFunc func(data interface{}, errMsg error)

ExceptionFunc the exception callback

type Inputer

type Inputer interface {

	// Description the Inputer description.
	// This information will be printed when the Inputer is abnormal, which is convenient for debugging.
	Name() string

	// Run execute the user logics
	Run(ctx InputerContext) *InputerResult

	// Stop stop the run function
	Stop() error
}

Inputer is the interface that must be implemented by every Inputer.

type InputerContext

type InputerContext interface {
}

InputerContext the inputer context

type InputerKey

type InputerKey string

InputerKey the inputer name

type InputerParams

type InputerParams struct {
	IsTiming  bool
	Frequency time.Duration
	Target    Inputer
	Kind      InputerType
	Putter    output.Puter
}

InputerParams the inputer params

type InputerResult

type InputerResult struct {
	Err error
}

InputerResult the inputer result

type InputerStatus

type InputerStatus int

InputerStatus the inputer status type definition.

const (

	// NormalStatus Inputer just created
	NormalStatus InputerStatus = iota
	// WaitingToRunStatus Inputer is waiting to run
	WaitingToRunStatus
	// RunningStatus Inputer is running
	RunningStatus
	// StoppingStatus Inputer normal exiting
	StoppingStatus
	// StoppedStatus Inputer normal exit
	StoppedStatus
	// ExceptionExitStatus Inputer abnormal exit
	ExceptionExitStatus
)

Inputer status type

type InputerType

type InputerType int

InputerType the inputer type definition

const (
	// ExecuteOnce only execute onece, non-blocking
	ExecuteOnce InputerType = iota

	// ExecuteTiming timing execute
	ExecuteTiming

	// ExecuteLoop loop execution does not exit, blocking
	ExecuteLoop
)

InputerType definition

type Manager

type Manager interface {

	// AddInputer add a new inputer
	AddInputer(params InputerParams) InputerKey

	// RemoveInputer remove the Inputer by a WorkerKey
	RemoveInputer(key InputerKey)

	// Run start the business cycle until the stop method is called.
	Run(ctx context.Context, inputerCtx InputerContext)

	// Stop
	Stop() error
}

Manager is the interface that must be implemented by every input manager.

func New

func New() Manager

New create a new Manager instance

type MapInputer

type MapInputer map[InputerKey]*wrapInputer

MapInputer inputer object

Jump to

Keyboard shortcuts

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