client

package
v2.0.4-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBeginOfPiece added in v2.0.2

func NewBeginOfPiece(taskID, peerID string) *scheduler.PieceResult

NewBeginOfPiece creates begin of piece.

func NewEndOfPiece added in v2.0.2

func NewEndOfPiece(taskID, peerID string, finishedCount int32) *scheduler.PieceResult

NewBeginOfPiece creates end of piece.

Types

type Client added in v2.0.3

type Client interface {
	// RegisterPeerTask registers a peer into task.
	RegisterPeerTask(context.Context, *scheduler.PeerTaskRequest, ...grpc.CallOption) (*scheduler.RegisterResult, error)

	// ReportPieceResult reports piece results and receives peer packets.
	ReportPieceResult(context.Context, *scheduler.PeerTaskRequest, ...grpc.CallOption) (scheduler.Scheduler_ReportPieceResultClient, error)

	// ReportPeerResult reports downloading result for the peer.
	ReportPeerResult(context.Context, *scheduler.PeerResult, ...grpc.CallOption) error

	// LeaveTask makes the peer leaving from task.
	LeaveTask(context.Context, *scheduler.PeerTarget, ...grpc.CallOption) error

	// Checks if any peer has the given task.
	StatTask(context.Context, *scheduler.StatTaskRequest, ...grpc.CallOption) (*scheduler.Task, error)

	// A peer announces that it has the announced task to other peers.
	AnnounceTask(context.Context, *scheduler.AnnounceTaskRequest, ...grpc.CallOption) error

	// Update grpc addresses.
	UpdateState([]dfnet.NetAddr)

	// Get grpc addresses.
	GetState() []dfnet.NetAddr

	// Close grpc service.
	Close() error
}

Client is the interface for grpc client.

func GetClientByAddr

func GetClientByAddr(addrs []dfnet.NetAddr, opts ...grpc.DialOption) (Client, error)

GetClientByAddr gets scheduler clients with net addresses.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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