daemon

package
v0.1.0-beta-3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 3 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
}

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(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)

	// GetAccessTime get all tasks accessTime.
	GetAccessTime() (*syncmap.SyncMap, error)

	// 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