workers

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandSet = "set"
	CommandDel = "delete"
)
View Source
const (
	SpaceWorker = "worker"
)

Variables

View Source
var (
	ErrorInvalidWorkerData = errors.New("invalid process-worker data")
	ErrorNotExist          = errors.New("not exist")
	ErrorUnknown           = errors.New("unknown error")
	ErrorChangeDriver      = errors.New("try change driver")
	ErrorInvalidProfession = errors.New("invalid profession")
	ErrorInvalidDriver     = errors.New("invalid driver")
	ErrorInvalidCommand    = errors.New("invalid command")
)

Functions

func DecodeWorkerData

func DecodeWorkerData(data []byte) (*eosc.WorkerConfig, error)

func EncodeWorkerData

func EncodeWorkerData(wd *eosc.WorkerConfig) ([]byte, error)

func ReadTWorker

func ReadTWorker(obj interface{}) (map[string]interface{}, error)

Types

type ITypedWorkers

type ITypedWorkers interface {
	All() []*Worker
	Set(id string, w *Worker)
	Get(id string) (*Worker, bool)
	Del(id string) (*Worker, bool)
	Reset(ds []*eosc.WorkerConfig)
}

func NewTypedWorkers

func NewTypedWorkers() ITypedWorkers

type TypedWorkers

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

func (*TypedWorkers) All

func (t *TypedWorkers) All() []*Worker

func (*TypedWorkers) Del

func (t *TypedWorkers) Del(id string) (*Worker, bool)

func (*TypedWorkers) Get

func (t *TypedWorkers) Get(id string) (*Worker, bool)

func (*TypedWorkers) Reset

func (t *TypedWorkers) Reset(ds []*eosc.WorkerConfig)

func (*TypedWorkers) Set

func (t *TypedWorkers) Set(id string, w *Worker)

type Worker

type Worker struct {
	*eosc.WorkerConfig
	Data WorkerAttr
}

func DecodeWorker

func DecodeWorker(data []byte) (*Worker, error)

func ToWorker

func ToWorker(wd *eosc.WorkerConfig) (*Worker, error)

func (*Worker) Detail

func (w *Worker) Detail() eosc.TWorker

func (*Worker) Format

func (w *Worker) Format(attrs []string) eosc.TWorker

func (*Worker) Info

func (w *Worker) Info() eosc.TWorker

func (*Worker) MarshalJSON

func (w *Worker) MarshalJSON() ([]byte, error)

type WorkerAttr

type WorkerAttr map[string]interface{}

func (WorkerAttr) Get

func (wa WorkerAttr) Get(field string) string

Jump to

Keyboard shortcuts

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