dfgettask

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: 14 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 DfgetTaskMgr.

func NewManager

func NewManager(cfg *config.Config, register prometheus.Registerer) (*Manager, error)

NewManager returns a new Manager.

func (*Manager) Add

func (dtm *Manager) Add(ctx context.Context, dfgetTask *types.DfGetTask) error

Add a new dfgetTask, we use clientID and taskID to identify a dfgetTask uniquely. ClientID should be generated by dfget, supernode will use it directly. NOTE: We should create a new dfgetTask for each download process,

even if the downloads initiated by the same machine.

func (*Manager) Delete

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

Delete deletes a dfgetTask with clientID and taskID.

func (*Manager) Get

func (dtm *Manager) Get(ctx context.Context, clientID, taskID string) (dfgetTask *types.DfGetTask, err error)

Get a dfgetTask info with specified clientID and taskID.

func (*Manager) GetCIDAndTaskIDsByPeerID added in v1.0.0

func (dtm *Manager) GetCIDAndTaskIDsByPeerID(ctx context.Context, peerID string) (map[string]string, error)

GetCIDAndTaskIDsByPeerID returns a cid<->taskID map by specified peerID.

func (*Manager) GetCIDByPeerIDAndTaskID

func (dtm *Manager) GetCIDByPeerIDAndTaskID(ctx context.Context, peerID, taskID string) (string, error)

GetCIDByPeerIDAndTaskID returns cid with specified peerID and taskID.

func (*Manager) GetCIDsByTaskID added in v1.0.0

func (dtm *Manager) GetCIDsByTaskID(ctx context.Context, taskID string) ([]string, error)

GetCIDsByTaskID returns cids as a string slice with specified taskID.

func (*Manager) List

func (dtm *Manager) List(ctx context.Context, filter map[string]string) (dfgetTaskList []*types.DfGetTask, err error)

List returns the list of dfgetTask.

func (*Manager) UpdateStatus

func (dtm *Manager) UpdateStatus(ctx context.Context, clientID, taskID, status string) error

UpdateStatus updates the status of dfgetTask with specified clientID and taskID.

Jump to

Keyboard shortcuts

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