task

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is an implementation of the interface of TaskMgr.

func NewManager

func NewManager(cfg *config.Config, peerMgr mgr.PeerMgr, dfgetTaskMgr mgr.DfgetTaskMgr,
	progressMgr mgr.ProgressMgr, cdnMgr mgr.CDNMgr, schedulerMgr mgr.SchedulerMgr,
	originClient httpclient.OriginHTTPClient, register prometheus.Registerer) (*Manager, error)

NewManager returns a new Manager Object.

func (*Manager) CheckTaskStatus

func (tm *Manager) CheckTaskStatus(ctx context.Context, taskID string) (bool, error)

CheckTaskStatus checks the task status.

func (*Manager) Delete

func (tm *Manager) Delete(ctx context.Context, taskID string) error

Delete deletes a task.

func (*Manager) Get

func (tm *Manager) Get(ctx context.Context, taskID string) (*types.TaskInfo, error)

Get a task info according to specified taskID.

func (*Manager) GetAccessTime added in v0.4.3

func (tm *Manager) GetAccessTime(ctx context.Context) (*syncmap.SyncMap, error)

GetAccessTime gets all task accessTime.

func (*Manager) GetPieces

func (tm *Manager) GetPieces(ctx context.Context, taskID, clientID string, req *types.PiecePullRequest) (bool, interface{}, error)

GetPieces gets the pieces to be downloaded based on the scheduling result.

func (*Manager) List

func (tm *Manager) List(ctx context.Context, filter map[string]string) ([]*types.TaskInfo, error)

List returns a list of tasks with filter. TODO: implement it.

func (*Manager) Register

func (tm *Manager) Register(ctx context.Context, req *types.TaskCreateRequest) (taskCreateResponse *types.TaskCreateResponse, err error)

Register will not only register a task.

func (*Manager) Update

func (tm *Manager) Update(ctx context.Context, taskID string, taskInfo *types.TaskInfo) error

Update the info of task.

func (*Manager) UpdatePieceStatus

func (tm *Manager) UpdatePieceStatus(ctx context.Context, taskID, pieceRange string, pieceUpdateRequest *types.PieceUpdateRequest) error

UpdatePieceStatus updates the piece status with specified parameters.

Jump to

Keyboard shortcuts

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