downloader

package
v0.2.1-alpha.12 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDownloadObjectParallelPerNode defines the default max download object parallel
	// per downloader
	DefaultDownloadObjectParallelPerNode = 10240
	// DefaultChallengePieceParallelPerNode defines the default max challenge piece parallel
	// per downloader
	DefaultChallengePieceParallelPerNode = 10240
	// DefaultBucketFreeQuota defines the default free read quota per bucket
	DefaultBucketFreeQuota = 10 * 1024 * 1024 * 1024
)

Variables

View Source
var (
	ErrDanglingPointer   = gfsperrors.Register(module.DownloadModularName, http.StatusBadRequest, 30001, "OoooH.... request lost")
	ErrObjectUnsealed    = gfsperrors.Register(module.DownloadModularName, http.StatusBadRequest, 30002, "object unsealed")
	ErrRepeatedTask      = gfsperrors.Register(module.DownloadModularName, http.StatusBadRequest, 30003, "request repeated")
	ErrExceedBucketQuota = gfsperrors.Register(module.DownloadModularName, http.StatusNotAcceptable, 30004, "bucket quota overflow")
	ErrInvalidParam      = gfsperrors.Register(module.DownloadModularName, http.StatusBadRequest, 30005, "request params invalid")
	ErrNoSuchPiece       = gfsperrors.Register(module.DownloadModularName, http.StatusBadRequest, 30006, "request params invalid, no such piece")
	ErrPieceStore        = gfsperrors.Register(module.DownloadModularName, http.StatusInternalServerError, 35101, "server slipped away, try again later")
	ErrGfSpDB            = gfsperrors.Register(module.DownloadModularName, http.StatusInternalServerError, 35201, "server slipped away, try again later")
)

Functions

func DefaultDownloaderOptions

func DefaultDownloaderOptions(downloader *DownloadModular, cfg *gfspconfig.GfSpConfig) error

func NewDownloadModular

func NewDownloadModular(app *gfspapp.GfSpBaseApp, cfg *gfspconfig.GfSpConfig) (coremodule.Modular, error)

Types

type DownloadModular

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

func (*DownloadModular) HandleChallengePiece

func (d *DownloadModular) HandleChallengePiece(ctx context.Context, downloadPieceTask task.ChallengePieceTask) (
	[]byte, [][]byte, []byte, error)

func (*DownloadModular) HandleDownloadObjectTask

func (d *DownloadModular) HandleDownloadObjectTask(ctx context.Context, downloadObjectTask task.DownloadObjectTask) ([]byte, error)

func (*DownloadModular) HandleDownloadPieceTask

func (d *DownloadModular) HandleDownloadPieceTask(ctx context.Context, downloadPieceTask task.DownloadPieceTask) ([]byte, error)

func (*DownloadModular) Name

func (d *DownloadModular) Name() string

func (*DownloadModular) PostChallengePiece

func (d *DownloadModular) PostChallengePiece(ctx context.Context, downloadPieceTask task.ChallengePieceTask)

func (*DownloadModular) PostDownloadObject

func (d *DownloadModular) PostDownloadObject(ctx context.Context, downloadObjectTask task.DownloadObjectTask)

func (*DownloadModular) PostDownloadPiece

func (d *DownloadModular) PostDownloadPiece(ctx context.Context, downloadPieceTask task.DownloadPieceTask)

func (*DownloadModular) PreChallengePiece

func (d *DownloadModular) PreChallengePiece(ctx context.Context, downloadPieceTask task.ChallengePieceTask) error

func (*DownloadModular) PreDownloadObject

func (d *DownloadModular) PreDownloadObject(ctx context.Context, downloadObjectTask task.DownloadObjectTask) error

func (*DownloadModular) PreDownloadPiece

func (d *DownloadModular) PreDownloadPiece(ctx context.Context, downloadPieceTask task.DownloadPieceTask) error

func (*DownloadModular) QueryTasks

func (d *DownloadModular) QueryTasks(ctx context.Context, subKey task.TKey) (
	[]task.Task, error)

func (*DownloadModular) ReleaseResource

func (d *DownloadModular) ReleaseResource(ctx context.Context, span rcmgr.ResourceScopeSpan)

func (*DownloadModular) ReserveResource

func (d *DownloadModular) ReserveResource(ctx context.Context, state *rcmgr.ScopeStat) (rcmgr.ResourceScopeSpan, error)

func (*DownloadModular) Start

func (d *DownloadModular) Start(ctx context.Context) error

func (*DownloadModular) Stop

func (d *DownloadModular) Stop(ctx context.Context) error

type SegmentPieceInfo

type SegmentPieceInfo struct {
	SegmentPieceKey string
	Offset          uint64
	Length          uint64
}

func SplitToSegmentPieceInfos

func SplitToSegmentPieceInfos(downloadObjectTask task.DownloadObjectTask, op piecestore.PieceOp) ([]*SegmentPieceInfo, error)

Jump to

Keyboard shortcuts

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