process_worker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPlugins

func LoadPlugins(dir string)

func Process

func Process()

func ReadProfessionData

func ReadProfessionData(r io.Reader) ([]*eosc.ProfessionConfig, error)

func ReadWorkers

func ReadWorkers(r io.Reader) []*eosc.WorkerData

Types

type IProfession

type IProfession interface {
	GetDriver(name string) (eosc.IProfessionDriver, bool)
}

type IProfessions

type IProfessions interface {
	Get(name string) (*Profession, bool)
	Sort() []*Profession
	List() []*Profession
}

type ITypedDrivers

type ITypedDrivers interface {
	Get(name string) (eosc.IProfessionDriver, bool)
}

type ITypedWorkers

type ITypedWorkers interface {
	Set(id string, w *Worker)
	Del(id string) (*Worker, bool)
	Get(id string) (*Worker, bool)
}

type IWorker

type IWorker interface {
	eosc.IWorker
	GetProfession() *Profession
}

type IWorkerRequireManager

type IWorkerRequireManager interface {
	Set(id string, requires []string)
	Del(id string)
	RequireByCount(requireId string) int
}

type IWorkers

type IWorkers interface {
	eosc.IWorkers
	Del(id string) error
	Check(id, profession, name, driverName string, body []byte) error
	Set(id, profession, name, driverName string, body []byte) error
	RequiredCount(id string) int
	ResourcesPort() []int32
}

type ProcessWorker

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

func NewProcessWorker

func NewProcessWorker() (*ProcessWorker, error)

NewProcessWorker 创建新的worker进程 启动时通过stdin传输配置信息

func (*ProcessWorker) Start

func (w *ProcessWorker) Start() error

type Profession

type Profession struct {
	*eosc.ProfessionConfig
	// contains filtered or unexported fields
}

func NewProfession

func NewProfession(c *eosc.ProfessionConfig) *Profession

func (*Profession) GetDriver

func (p *Profession) GetDriver(name string) (eosc.IProfessionDriver, bool)

type Professions

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

func NewProfessions

func NewProfessions() *Professions

func (*Professions) Get

func (ps *Professions) Get(name string) (*Profession, bool)

func (*Professions) List

func (ps *Professions) List() []*Profession

func (*Professions) Sort

func (ps *Professions) Sort() []*Profession

type RegisterFunc

type RegisterFunc func()

RegisterFunc 注册函数

type TypedDrivers

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

func NewTypedDrivers

func NewTypedDrivers() *TypedDrivers

func (*TypedDrivers) Get

func (t *TypedDrivers) Get(name string) (eosc.IProfessionDriver, bool)

type TypedWorkers

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

func NewTypedWorkers

func NewTypedWorkers() *TypedWorkers

func (*TypedWorkers) Del

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

func (*TypedWorkers) Get

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

func (*TypedWorkers) Set

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

type Worker

type Worker struct {
	eosc.IWorker

	Profession string
	Name       string
	Driver     string
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(id, professionName, name, driverName string, body []byte, target eosc.IWorker, profession *Profession, driver eosc.IProfessionDriver) *Worker

func (*Worker) GetProfession

func (w *Worker) GetProfession() *Profession

func (*Worker) Id

func (w *Worker) Id() string

type WorkerManager

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

func NewWorkerManager

func NewWorkerManager(professions IProfessions) *WorkerManager

func (*WorkerManager) Check

func (wm *WorkerManager) Check(id, profession, name, driverName string, body []byte) error

func (*WorkerManager) Del

func (wm *WorkerManager) Del(id string) error

func (*WorkerManager) Get

func (wm *WorkerManager) Get(id string) (eosc.IWorker, bool)

func (*WorkerManager) Init

func (wm *WorkerManager) Init(wdl []*eosc.WorkerData) error

func (*WorkerManager) RequiredCount

func (wm *WorkerManager) RequiredCount(id string) int

func (*WorkerManager) ResourcesPort

func (wm *WorkerManager) ResourcesPort() []int32

func (*WorkerManager) Set

func (wm *WorkerManager) Set(id, profession, name, driverName string, body []byte) error

type WorkerRequireManager

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

func NewWorkerRequireManager

func NewWorkerRequireManager() *WorkerRequireManager

func (*WorkerRequireManager) Del

func (w *WorkerRequireManager) Del(id string)

func (*WorkerRequireManager) RequireByCount

func (w *WorkerRequireManager) RequireByCount(requireId string) int

func (*WorkerRequireManager) Set

func (w *WorkerRequireManager) Set(id string, requiresIds []string)

type WorkerServer

type WorkerServer struct {
	service.UnimplementedWorkerServiceServer
	// contains filtered or unexported fields
}

func NewWorkerServer

func NewWorkerServer(workers IWorkers) *WorkerServer

func (*WorkerServer) Delete

func (*WorkerServer) DeleteCheck

func (*WorkerServer) Ping

func (*WorkerServer) Set

func (*WorkerServer) SetCheck

Jump to

Keyboard shortcuts

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