client

package
v2.4.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool added in v2.3.4

type Pool interface {
	// Serve starts the manager.
	Serve()

	// Stop stops the manager.
	Stop()

	// Get returns the client by address.
	Get(target string, opts ...grpc.DialOption) (V2, error)
}

Pool is the interface for pooling v2 version of the grpc client.

func GetV2Pool added in v2.3.4

func GetV2Pool() Pool

GetV2Pool creates a new pool instance.

type V1 added in v2.0.9

type V1 interface {
	// Trigger client to download file.
	Download(context.Context, *dfdaemonv1.DownRequest, ...grpc.CallOption) (dfdaemonv1.Daemon_DownloadClient, error)

	// Get piece tasks from other peers.
	GetPieceTasks(context.Context, *commonv1.PieceTaskRequest, ...grpc.CallOption) (*commonv1.PiecePacket, error)

	// Sync piece tasks with other peers.
	SyncPieceTasks(context.Context, *commonv1.PieceTaskRequest, ...grpc.CallOption) (dfdaemonv1.Daemon_SyncPieceTasksClient, error)

	// Check if given task exists in P2P cache system.
	StatTask(context.Context, *dfdaemonv1.StatTaskRequest, ...grpc.CallOption) error

	// Import the given file into P2P cache system.
	ImportTask(context.Context, *dfdaemonv1.ImportTaskRequest, ...grpc.CallOption) error

	// Export or download file from P2P cache system.
	ExportTask(context.Context, *dfdaemonv1.ExportTaskRequest, ...grpc.CallOption) error

	// Delete file from P2P cache system.
	DeleteTask(context.Context, *dfdaemonv1.DeleteTaskRequest, ...grpc.CallOption) error

	// LeaveHost leaves the host from the scheduler.
	LeaveHost(context.Context, ...grpc.CallOption) error

	// PeerExchange exchange peer metadata between daemons
	PeerExchange(ctx context.Context, opts ...grpc.CallOption) (dfdaemonv1.Daemon_PeerExchangeClient, error)

	// Check daemon health.
	CheckHealth(context.Context, ...grpc.CallOption) error

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

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

func GetInsecureV1 added in v2.0.9

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

GetInsecureV1 returns v1 version of the dfdaemon client. FIXME use GetV1 and insecure.NewCredentials instead of this function

func GetV1 added in v2.0.9

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

GetV1 returns v1 version of the dfdaemon client.

type V2 added in v2.0.9

type V2 interface {
	// SyncPieces syncs pieces from the other peers.
	SyncPieces(context.Context, *dfdaemonv2.SyncPiecesRequest, ...grpc.CallOption) (dfdaemonv2.DfdaemonUpload_SyncPiecesClient, error)

	// DownloadTask downloads task from p2p network.
	DownloadTask(context.Context, string, *dfdaemonv2.DownloadTaskRequest, ...grpc.CallOption) (dfdaemonv2.DfdaemonUpload_DownloadTaskClient, error)

	// StatTask stats task information.
	StatTask(context.Context, *dfdaemonv2.StatTaskRequest, ...grpc.CallOption) (*commonv2.Task, error)

	// StatLocalTask stats local task information.
	StatLocalTask(context.Context, *dfdaemonv2.StatLocalTaskRequest, ...grpc.CallOption) (*dfdaemonv2.StatLocalTaskResponse, error)

	// DeleteTask deletes task from p2p network.
	DeleteTask(context.Context, *dfdaemonv2.DeleteTaskRequest, ...grpc.CallOption) error

	// ListTaskEntries lists task entries.
	ListTaskEntries(context.Context, *dfdaemonv2.ListTaskEntriesRequest, ...grpc.CallOption) (*dfdaemonv2.ListTaskEntriesResponse, error)

	// DownloadPersistentTask downloads persistent task from p2p network.
	DownloadPersistentTask(context.Context, *dfdaemonv2.DownloadPersistentTaskRequest, ...grpc.CallOption) (dfdaemonv2.DfdaemonUpload_DownloadPersistentTaskClient, error)

	// UpdatePersistentTask updates persistent task information.
	UpdatePersistentTask(context.Context, *dfdaemonv2.UpdatePersistentTaskRequest, ...grpc.CallOption) error

	// StatPersistentTask stats persistent task information.
	StatPersistentTask(context.Context, *dfdaemonv2.StatPersistentTaskRequest, ...grpc.CallOption) (*commonv2.PersistentTask, error)

	// DeletePersistentTask deletes persistent task from p2p network.
	DeletePersistentTask(context.Context, *dfdaemonv2.DeletePersistentTaskRequest, ...grpc.CallOption) error

	// DownloadPersistentCacheTask downloads persistent cache task from p2p network.
	DownloadPersistentCacheTask(context.Context, *dfdaemonv2.DownloadPersistentCacheTaskRequest, ...grpc.CallOption) (dfdaemonv2.DfdaemonUpload_DownloadPersistentCacheTaskClient, error)

	// UpdatePersistentCacheTask updates persistent cache task information.
	UpdatePersistentCacheTask(context.Context, *dfdaemonv2.UpdatePersistentCacheTaskRequest, ...grpc.CallOption) error

	// StatPersistentCacheTask stats persistent cache task information.
	StatPersistentCacheTask(context.Context, *dfdaemonv2.StatPersistentCacheTaskRequest, ...grpc.CallOption) (*commonv2.PersistentCacheTask, error)

	// DeletePersistentCacheTask deletes persistent cache task from p2p network.
	DeletePersistentCacheTask(context.Context, *dfdaemonv2.DeletePersistentCacheTaskRequest, ...grpc.CallOption) error

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

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

func GetV2ByAddr added in v2.1.55

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

GetV2ByAddr returns v2 version of the dfdaemon 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