client

package
v2.1.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type V1 added in v2.0.9

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

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

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

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

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

	// LeaveTask releases peer in scheduler.
	LeaveTask(context.Context, *schedulerv1.PeerTarget, ...grpc.CallOption) error

	// AnnounceHost announces host to scheduler.
	AnnounceHost(context.Context, *schedulerv1.AnnounceHostRequest, ...grpc.CallOption) error

	// LeaveHost releases host in scheduler.
	LeaveHost(context.Context, *schedulerv1.LeaveHostRequest, ...grpc.CallOption) error

	// SyncProbes sync probes of the host.
	SyncProbes(context.Context, *schedulerv1.SyncProbesRequest, ...grpc.CallOption) (schedulerv1.Scheduler_SyncProbesClient, error)

	// SyncNetworkTopology sync network topology of the hosts.
	SyncNetworkTopology(context.Context, *schedulerv1.SyncNetworkTopologyRequest, ...grpc.CallOption) (schedulerv1.Scheduler_SyncNetworkTopologyClient, error)

	// Close tears down the ClientConn and all underlying connections.
	Close() error
}

V1 is the interface for v1 version of the grpc client.

func GetV1 added in v2.0.9

func GetV1(ctx context.Context, dynconfig config.Dynconfig, opts ...grpc.DialOption) (V1, error)

GetV1 returns v1 version of the scheduler client.

func GetV1ByAddr added in v2.0.9

func GetV1ByAddr(ctx context.Context, target string, opts ...grpc.DialOption) (V1, error)

GetV1ByAddr returns v2 version of the scheduler client by address.

type V2 added in v2.0.9

type V2 interface {
	// AnnouncePeer announces peer to scheduler.
	AnnouncePeer(context.Context, string, ...grpc.CallOption) (schedulerv2.Scheduler_AnnouncePeerClient, error)

	// Checks information of peer.
	StatPeer(context.Context, *schedulerv2.StatPeerRequest, ...grpc.CallOption) (*commonv2.Peer, error)

	// LeavePeer releases peer in scheduler.
	LeavePeer(context.Context, *schedulerv2.LeavePeerRequest, ...grpc.CallOption) error

	// TODO exchange peer api definition.
	// ExchangePeer exchanges peer information.
	ExchangePeer(context.Context, *schedulerv2.ExchangePeerRequest, ...grpc.CallOption) (*schedulerv2.ExchangePeerResponse, error)

	// Checks information of task.
	StatTask(context.Context, *schedulerv2.StatTaskRequest, ...grpc.CallOption) (*commonv2.Task, error)

	// AnnounceHost announces host to scheduler.
	AnnounceHost(context.Context, *schedulerv2.AnnounceHostRequest, ...grpc.CallOption) error

	// LeaveHost releases host in scheduler.
	LeaveHost(context.Context, *schedulerv2.LeaveHostRequest, ...grpc.CallOption) error

	// SyncProbes sync probes of the host.
	SyncProbes(context.Context, *schedulerv2.SyncProbesRequest, ...grpc.CallOption) (schedulerv2.Scheduler_SyncProbesClient, error)

	// SyncNetworkTopology sync network topology of the hosts.
	SyncNetworkTopology(context.Context, *schedulerv2.SyncNetworkTopologyRequest, ...grpc.CallOption) (schedulerv2.Scheduler_SyncNetworkTopologyClient, error)

	// Close tears down the ClientConn and all underlying connections.
	Close() error
}

V2 is the interface for v1 version of the grpc client.

func GetV2 added in v2.0.9

func GetV2(ctx context.Context, dynconfig config.Dynconfig, opts ...grpc.DialOption) (V2, error)

GetV2 returns v2 version of the scheduler client.

func GetV2ByAddr added in v2.0.9

func GetV2ByAddr(ctx context.Context, target string, opts ...grpc.DialOption) (V2, error)

GetV2ByAddr returns v2 version of the scheduler client by address.

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