process_master

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 32 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientNotInit = errors.New("no client")
)

Functions

func Process

func Process()

Types

type IAdmin

type IAdmin interface {
}

type IWorkerProcess

type IWorkerProcess interface {
	TrafficStatus() ([]int, []int, error)
}

type Master

type Master struct {
	service.UnimplementedMasterServer
	service.UnimplementedCtiServiceServer

	PID *pidfile.PidFile
	// contains filtered or unexported fields
}

func NewMasterHandle

func NewMasterHandle(pid *pidfile.PidFile) *Master

func (*Master) Close

func (m *Master) Close()

func (*Master) Fork

func (m *Master) Fork() error

Fork Master fork 子进程,入参为子进程需要的内容

func (*Master) Hello

func (m *Master) Hello(ctx context.Context, request *service.HelloRequest) (*service.HelloResponse, error)

func (*Master) Info

func (m *Master) Info(ctx context.Context, request *service.InfoRequest) (*service.InfoResponse, error)

Info 获取节点信息

func (*Master) Join

func (m *Master) Join(ctx context.Context, request *service.JoinRequest) (*service.JoinResponse, error)

Join 加入集群操作

func (*Master) Leave

func (m *Master) Leave(ctx context.Context, request *service.LeaveRequest) (*service.LeaveResponse, error)

Leave 将节点移除

func (*Master) List

func (m *Master) List(ctx context.Context, request *service.ListRequest) (*service.ListResponse, error)

List 获取节点列表

func (*Master) Start

func (m *Master) Start(handler *MasterHandler) error

func (*Master) Wait

func (m *Master) Wait() error

type MasterHandler

type MasterHandler struct {
	Professions eosc.IProfessionsData
}

type ProfessionRaft

type ProfessionRaft struct {
	eosc.IProfessionsData
}

func NewProfessionRaft

func NewProfessionRaft(IProfessionsData eosc.IProfessionsData) *ProfessionRaft

func (*ProfessionRaft) CommitHandler

func (p *ProfessionRaft) CommitHandler(cmd string, data []byte) error

func (*ProfessionRaft) Delete

func (p *ProfessionRaft) Delete(name string) error

func (*ProfessionRaft) Encode

func (p *ProfessionRaft) Encode(startIndex int) ([]byte, []*os.File, error)

func (*ProfessionRaft) ProcessHandler

func (p *ProfessionRaft) ProcessHandler(cmd string, body []byte) ([]byte, interface{}, error)

func (*ProfessionRaft) ResetHandler

func (p *ProfessionRaft) ResetHandler(data []byte) error

func (*ProfessionRaft) Set

func (p *ProfessionRaft) Set(name string, profession *eosc.ProfessionConfig) error

func (*ProfessionRaft) Snapshot

func (p *ProfessionRaft) Snapshot() []byte

type WorkerController

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

func NewWorkerController

func NewWorkerController(trafficController traffic.IController, dms ...eosc.IDataMarshaller) *WorkerController

func (*WorkerController) Delete

func (*WorkerController) DeleteCheck

func (*WorkerController) NewWorker

func (wc *WorkerController) NewWorker() error

func (*WorkerController) Ping

func (*WorkerController) Refresh added in v0.1.1

func (*WorkerController) Restart added in v0.1.1

func (wc *WorkerController) Restart()

func (*WorkerController) Set

func (*WorkerController) SetCheck

func (*WorkerController) Start

func (wc *WorkerController) Start()

func (*WorkerController) Stop

func (wc *WorkerController) Stop()

type WorkerProcess

type WorkerProcess struct {
	service.WorkerServiceClient
	// contains filtered or unexported fields
}

func (*WorkerProcess) Close

func (w *WorkerProcess) Close() error

type WorkerProcessController

type WorkerProcessController interface {
	Stop()
	NewWorker() error
	Start()
	Restart()
}

type WorkersData

type WorkersData struct {
	workers.ITypedWorkers
}

func NewWorkersData

func NewWorkersData(ITypedWorkers workers.ITypedWorkers) *WorkersData

func (*WorkersData) Encode

func (w *WorkersData) Encode(startIndex int) ([]byte, []*os.File, error)

type WorkersRaft

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

func NewWorkersRaft

func NewWorkersRaft(workerData *WorkersData, professions eosc.IProfessionsData, workerServiceClient service.WorkerServiceClient, service raft_service.IService, workerController WorkerProcessController) *WorkersRaft

func (*WorkersRaft) CommitHandler

func (w *WorkersRaft) CommitHandler(cmd string, data []byte) error

func (*WorkersRaft) Delete

func (w *WorkersRaft) Delete(id string) (eosc.TWorker, error)

func (*WorkersRaft) GetList

func (w *WorkersRaft) GetList(profession string) ([]eosc.TWorker, error)

func (*WorkersRaft) GetWork

func (w *WorkersRaft) GetWork(id string) (eosc.TWorker, error)

func (*WorkersRaft) ProcessHandler

func (w *WorkersRaft) ProcessHandler(cmd string, body []byte) ([]byte, interface{}, error)

func (*WorkersRaft) ResetHandler

func (w *WorkersRaft) ResetHandler(data []byte) error

func (*WorkersRaft) Set

func (w *WorkersRaft) Set(profession, name, driver string, data []byte) (eosc.TWorker, error)

func (*WorkersRaft) Snapshot

func (w *WorkersRaft) Snapshot() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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