manager

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package manager provides a concurrent downloading api with checkpoint for FDS

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorPartSizeSmallerThanOne    = errors.New("PartSize can not be smaller than 1")
	ErrorConcurrencySmallerThanOne = errors.New("Concurrency can not be smaller than 1")
	ErrorRnageFormat               = errors.New("Does not support (bytes=i-j,m-n) format, only support (bytes=i-j)")
	ErrorBucketOrObjectNotMatching = errors.New("BucketName or ObjectName is not matching")
	ErrorMD5NotMatching            = errors.New("MD5 is not matching")
	ErrorObjectStateNotMatching    = errors.New("Object state is not matching")
	ErrorRangeNotMatching          = errors.New("Range is not matching")
	ErrorFileNotFound              = errors.New("File is not found")
	ErrorTooManyUploadParts        = errors.New("Too many upload parts, increase PartSize please")
)

Errors

Functions

This section is empty.

Types

type DownloadRequest

type DownloadRequest struct {
	fds.GetObjectRequest
	FilePath string
	// contains filtered or unexported fields
}

DownloadRequest is the input of Download

type Downloader

type Downloader struct {
	PartSize    int64
	Concurrency int
	Breakpoint  bool
	// contains filtered or unexported fields
}

Downloader is a FDS client for file concurrency download

func NewDownloader

func NewDownloader(client *fds.Client, partSize int64, concurrency int, breakpoint bool) (*Downloader, error)

NewDownloader new a downloader

func (*Downloader) Download

func (downloader *Downloader) Download(request *DownloadRequest) error

Download performs the downloading action

func (*Downloader) DownloadWithContext

func (downloader *Downloader) DownloadWithContext(ctx context.Context, request *DownloadRequest) error

DownloadWithContext performs the downloading action with context controlling

func (*Downloader) SetLimiter added in v1.0.9

func (downloader *Downloader) SetLimiter(limiter *rate.Limiter)

func (*Downloader) SetLoggerLevel added in v1.0.9

func (downloader *Downloader) SetLoggerLevel(level logrus.Level)

Jump to

Keyboard shortcuts

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