supervisor

package
v2.0.1-a-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDNMgr

type CDNMgr interface {

	// TriggerCDN will trigger CDN to download the resource from sourceUrl.
	TriggerCDN(context.Context, *types.SeedTask) (*types.SeedTask, error)

	// Delete the cdn meta with specified taskID.
	// The file on the disk will be deleted when the force is true.
	Delete(string) error

	// TryFreeSpace checks if the free space of the storage is larger than the fileLength.
	TryFreeSpace(fileLength int64) (bool, error)
}

CDNMgr as an interface defines all operations against CDN and operates on the underlying files stored on the local disk, etc.

type SeedProgressMgr

type SeedProgressMgr interface {

	// InitSeedProgress init task seed progress
	InitSeedProgress(ctx context.Context, taskID string)

	// WatchSeedProgress watch task seed progress
	WatchSeedProgress(ctx context.Context, taskID string) (<-chan *types.SeedPiece, error)

	// PublishPiece publish piece seed
	PublishPiece(ctx context.Context, taskID string, task *types.SeedPiece) error

	// PublishTask publish task seed
	PublishTask(ctx context.Context, taskID string, task *types.SeedTask) error

	// GetPieces get pieces by taskID
	GetPieces(ctx context.Context, taskID string) (records []*types.SeedPiece, err error)

	// Clear meta info of task
	Clear(taskID string) error

	SetTaskMgr(taskMgr SeedTaskMgr)
}

SeedProgressMgr as an interface defines all operations about seed progress

type SeedTaskMgr

type SeedTaskMgr interface {

	// Register register seed task
	Register(context.Context, *types.TaskRegisterRequest) (pieceCh <-chan *types.SeedPiece, err error)

	// Get get task Info with specified taskId.
	Get(string) (*types.SeedTask, error)

	// Exist check task existence with specified taskId.
	Exist(string) (*types.SeedTask, bool)

	// Delete delete a task.
	Delete(string) error

	// GetPieces
	GetPieces(context.Context, string) (pieces []*types.SeedPiece, err error)
}

SeedTaskMgr as an interface defines all operations against SeedTask. A SeedTask will store some meta info about the taskFile, pieces and something else. A seedTask corresponds to three files on the disk, which are identified by taskId, the data file meta file piece file

Directories

Path Synopsis
cdn
storage/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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