downloader

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 22 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")
	ErrExceedRequest     = gfsperrors.Register(module.DownloadModularName, http.StatusBadRequest, 30003, "get piece request exceed")
	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")
	ErrKeyFormat         = gfsperrors.Register(module.DownloadModularName, http.StatusBadRequest, 30007, "invalid key format")
	ErrAccountFrozen     = gfsperrors.Register(module.DownloadModularName, http.StatusNotAcceptable, 30008, "stream account has been frozen")
	ErrDownloadStatus    = gfsperrors.Register(module.DownloadModularName, http.StatusBadRequest, 30009, "object cannot be downloaded")
)

Functions

func DefaultDownloaderOptions

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

func ErrConsensusWithDetail added in v0.2.4

func ErrConsensusWithDetail(detail string) *gfsperrors.GfSpError

func ErrGfSpDBWithDetail added in v0.2.4

func ErrGfSpDBWithDetail(detail string) *gfsperrors.GfSpError

func ErrPieceStoreWithDetail added in v0.2.4

func ErrPieceStoreWithDetail(detail string) *gfsperrors.GfSpError

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, challengePieceTask 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(context.Context, task.ChallengePieceTask)

func (*DownloadModular) PostDownloadObject

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

func (*DownloadModular) PostDownloadPiece

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

func (*DownloadModular) PreChallengePiece

func (d *DownloadModular) PreChallengePiece(ctx context.Context, challengePieceTask 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(context.Context, 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