api

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressRecorder

type ProgressRecorder struct {
	BlkCtxs      []storage.BlkputRet      `json:"blk_ctxs"`    // resume v1
	Parts        []storage.UploadPartInfo `json:"parts"`       // resume v2
	UploadId     string                   `json:"upload_id"`   // resume v2
	ExpireTime   int64                    `json:"expire_time"` // resume v2
	Offset       int64                    `json:"offset"`
	TotalSize    int64                    `json:"total_size"`
	LastModified int                      `json:"last_modified"` // 上传文件的modification time
	FilePath     string                   `json:"-"`             // 断点续传记录保存文件
}

func NewProgressRecorder

func NewProgressRecorder(filePath string) *ProgressRecorder

func (*ProgressRecorder) CheckValid

func (p *ProgressRecorder) CheckValid(fileSize int64, lastModified int, isResumableV2 bool)

func (*ProgressRecorder) RecordProgress

func (p *ProgressRecorder) RecordProgress() (err *data.CodeError)

func (*ProgressRecorder) Recover

func (p *ProgressRecorder) Recover() (err *data.CodeError)

func (*ProgressRecorder) Reset

func (p *ProgressRecorder) Reset()

type Resume

type Resume interface {
	InitServer(ctx context.Context) *data.CodeError
	UploadBlock(ctx context.Context, index int, data []byte) *data.CodeError
	Complete(ctx context.Context, ret interface{}) (err *data.CodeError)
}

func NewResume

func NewResume(info ResumeInfo, isResumeV2 bool) Resume

func NewRetryResume

func NewRetryResume(r Resume, retryMax int, retryInterval time.Duration) Resume

type ResumeInfo

type ResumeInfo struct {
	UpHost        string
	Bucket        string
	TokenProvider func() string // token provider
	Key           string
	Cfg           *storage.Config
	Recorder      *ProgressRecorder
}

Jump to

Keyboard shortcuts

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