types

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: BSD-3-Clause Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncInterface

type FuncInterface func(strategyId, parameter string)

FuncInterface defines the func used in scheduling.

Generally it's better keeping invocation fast but if it costs much more time
maybe you should carefully set a suitable timeout during shutdown.

type ScheduleConfig

type ScheduleConfig struct {
	// StallAfterStartup represents the delay after the manager started.
	//	Default to 10 seconds
	StallAfterStartup time.Duration

	// HeartbeatInterval represents the interval of sending a heartbeat.
	//	Default to 5 seconds
	HeartbeatInterval time.Duration

	// DeathTimeout represents the duration no heartbeats happened before we treat the remote manager as dead.
	//	Default to 60 seconds
	DeathTimeout time.Duration

	// ScheduleInterval represents the interval the manager will do its work to guanrantee:
	//	- Appropriate workers are running
	//	- Kick dead managers
	//	Default to 10 seconds
	ScheduleInterval time.Duration

	// ShutdownTimeout indicates whether to wait a maxmum time when closing
	//	Default to wait with no limitation
	ShutdownTimeout time.Duration
}

type TaskBase added in v1.1.0

type TaskBase interface {
	// Select returns tasks to be dealed later.
	//	It will be guaranteed in serial model.
	//	parameter, items, eachFetchNum are from definition of task
	//	ownSign is from name of strategy bond in the form of 'name$ownsign'
	//	It's a kind of relation to strategy but generally task doesn't care about strategy in user's view.
	Select(parameter, ownSign string, items []definition.TaskItem, eachFetchNum int) []interface{}
}

TaskBase defines the task used in scheduling.

type TaskBatch added in v1.1.0

type TaskBatch interface {
	TaskBase
	// return true if succ false otherwise, but things will still go on
	Execute(tasks []interface{}, ownSign string) bool
}

TaskBatch represents multiple tasks one time(routine) model

type TaskComparable added in v1.1.0

type TaskComparable interface {
	Less(a, b interface{}) bool
}

type TaskSingle added in v1.1.0

type TaskSingle interface {
	TaskBase
	// return true if succ false otherwise, but things will still go on
	Execute(task interface{}, ownSign string) bool
}

TaskSingle represents one task one time(routine) model

type Worker

type Worker interface {
	Start(strategyId, parameter string) error
	Stop(strategyId, parameter string) error
}

Worker manages data of scheduling for bond strategy

Jump to

Keyboard shortcuts

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