cdn

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManager

func NewManager(cfg *config.Config, cacheStore *store.Store, progressManager mgr.ProgressMgr,
	originClient httpclient.OriginHTTPClient, register prometheus.Registerer) (mgr.CDNMgr, error)

NewManager returns a new Manager.

Types

type Manager

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

Manager is an implementation of the interface of CDNMgr which use source as CDN node.

func (*Manager) CheckFile

func (cm *Manager) CheckFile(ctx context.Context, taskID string) bool

CheckFile checks the file whether exists.

func (*Manager) Delete

func (cm *Manager) Delete(ctx context.Context, taskID string, force bool) error

Delete the cdn meta with specified taskID. It will also delete the files on the disk when the force equals true.

func (*Manager) GetGCTaskIDs

func (cm *Manager) GetGCTaskIDs(ctx context.Context, taskMgr mgr.TaskMgr) ([]string, error)

func (*Manager) GetHTTPPath

func (cm *Manager) GetHTTPPath(ctx context.Context, taskInfo *types.TaskInfo) (string, error)

GetHTTPPath returns the http download path of taskID.

func (*Manager) GetPieceMD5

func (cm *Manager) GetPieceMD5(ctx context.Context, taskID string, pieceNum int, pieceRange, source string) (pieceMd5 string, err error)

GetPieceMD5 gets the piece Md5 accorrding to the specified taskID and pieceNum.

func (*Manager) GetStatus

func (cm *Manager) GetStatus(ctx context.Context, taskID string) (cdnStatus string, err error)

GetStatus gets the status of the file.

func (*Manager) TriggerCDN

func (cm *Manager) TriggerCDN(ctx context.Context, task *types.TaskInfo) (*types.TaskInfo, error)

TriggerCDN will trigger CDN to download the file from sourceUrl.

Jump to

Keyboard shortcuts

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