worker

package
v0.1.0-beta-3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(client scheduler.Scheduler_ReportPieceResultServer, worker IWorker, schedulerService *service.SchedulerService) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) IsClosed

func (c *Client) IsClosed() bool

func (*Client) Recv

func (c *Client) Recv() (*scheduler.PieceResult, error)

func (*Client) Send

func (c *Client) Send(p *scheduler.PeerPacket) error

func (*Client) Serve

func (c *Client) Serve() error

type Group

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

func NewGroup

func NewGroup(cfg *config.Config, schedulerService *service.SchedulerService) *Group

func (*Group) ReceiveJob

func (wg *Group) ReceiveJob(job *types.PeerTask)

func (*Group) ReceiveUpdatePieceResult

func (wg *Group) ReceiveUpdatePieceResult(pr *scheduler2.PieceResult)

func (*Group) Serve

func (wg *Group) Serve()

func (*Group) Stop

func (wg *Group) Stop()

type ISender

type ISender interface {
	Serve()
	Stop()
	Send(peerTask *types.PeerTask)
}

type IWorker

type IWorker interface {
	Serve()
	Stop()
	ReceiveJob(job *types.PeerTask)
	ReceiveUpdatePieceResult(pr *scheduler2.PieceResult)
}

type JobType

type JobType int8

type Sender

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

func (*Sender) Send

func (s *Sender) Send(peerTask *types.PeerTask)

func (*Sender) Serve

func (s *Sender) Serve()

type SenderGroup

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

func NewSender

func NewSender(worker config.SchedulerWorkerConfig, schedulerService *service.SchedulerService) *SenderGroup

func (*SenderGroup) Send

func (sg *SenderGroup) Send(peerTask *types.PeerTask)

func (*SenderGroup) Serve

func (sg *SenderGroup) Serve()

func (*SenderGroup) Stop

func (sg *SenderGroup) Stop()

type Worker

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

func NewWorker

func NewWorker(schedulerService *service.SchedulerService, sender ISender, sendJod func(*types.PeerTask), stop <-chan struct{}) *Worker

func (*Worker) ReceiveJob

func (w *Worker) ReceiveJob(peerTask *types.PeerTask)

func (*Worker) ReceiveUpdatePieceResult

func (w *Worker) ReceiveUpdatePieceResult(pr *scheduler2.PieceResult)

func (*Worker) Serve

func (w *Worker) Serve()

func (*Worker) Stop

func (w *Worker) Stop()

func (*Worker) UpdatePieceResult

func (w *Worker) UpdatePieceResult(pr *scheduler2.PieceResult) (peerTask *types.PeerTask, needSchedule bool, err error)

Jump to

Keyboard shortcuts

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