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 ¶
GetClientByAddr gets scheduler clients with net addresses.
Click to show internal directories.
Click to hide internal directories.