pcsupload

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package pcsupload 上传包

Index

Constants

View Source
const (
	StrUploadFailed = "上传文件失败"
)
View Source
const (
	UploadingFileName = "pcs_uploading.json"
)

Variables

This section is empty.

Functions

func NewPCSUpload

func NewPCSUpload(pcs *baidupcs.BaiduPCS, targetPath string) uploader.MultiUpload

Types

type EmptyReaderLen64

type EmptyReaderLen64 struct {
}

func (EmptyReaderLen64) Len

func (e EmptyReaderLen64) Len() int64

func (EmptyReaderLen64) Read

func (e EmptyReaderLen64) Read(p []byte) (n int, err error)

type PCSUpload

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

func (*PCSUpload) CreateSuperFile

func (pu *PCSUpload) CreateSuperFile(checksumList ...string) (err error)

func (*PCSUpload) Precreate

func (pu *PCSUpload) Precreate() (err error)

Precreate do nothing

func (*PCSUpload) TmpFile

func (pu *PCSUpload) TmpFile(ctx context.Context, partseq int, partOffset int64, r rio.ReaderLen64) (checksum string, uperr error)

type StepUpload

type StepUpload int

StepUpload 上传步骤

const (
	// StepUploadInit 初始化步骤
	StepUploadInit StepUpload = iota
	// StepUploadRapidUpload 秒传步骤
	StepUploadRapidUpload
	// StepUploadUpload 正常上传步骤
	StepUploadUpload
)

type UploadStatistic

type UploadStatistic struct {
	pcsfunctions.Statistic
}

type UploadTaskUnit

type UploadTaskUnit struct {
	LocalFileChecksum *checksum.LocalFileChecksum // 要上传的本地文件详情
	Step              StepUpload
	SavePath          string // 保存路径

	PCS               *baidupcs.BaiduPCS
	UploadingDatabase *UploadingDatabase // 数据库
	Parallel          int
	NoRapidUpload     bool // 禁用秒传
	NoSplitFile       bool // 禁用分片上传

	UploadStatistic *UploadStatistic
	// contains filtered or unexported fields
}

UploadTaskUnit 上传的任务单元

func (*UploadTaskUnit) OnComplete

func (utu *UploadTaskUnit) OnComplete(lastRunResult *taskframework.TaskUnitRunResult)

func (*UploadTaskUnit) OnFailed

func (utu *UploadTaskUnit) OnFailed(lastRunResult *taskframework.TaskUnitRunResult)

func (*UploadTaskUnit) OnRetry

func (utu *UploadTaskUnit) OnRetry(lastRunResult *taskframework.TaskUnitRunResult)

func (*UploadTaskUnit) OnSuccess

func (utu *UploadTaskUnit) OnSuccess(lastRunResult *taskframework.TaskUnitRunResult)

func (*UploadTaskUnit) RetryWait

func (utu *UploadTaskUnit) RetryWait() time.Duration

func (*UploadTaskUnit) Run

func (utu *UploadTaskUnit) Run() (result *taskframework.TaskUnitRunResult)

func (*UploadTaskUnit) SetTaskInfo

func (utu *UploadTaskUnit) SetTaskInfo(taskInfo *taskframework.TaskInfo)

type Uploading

type Uploading struct {
	*checksum.LocalFileMeta
	State *uploader.InstanceState `json:"state"`
}

Uploading 未完成上传的信息

type UploadingDatabase

type UploadingDatabase struct {
	UploadingList []*Uploading `json:"upload_state"`
	Timestamp     int64        `json:"timestamp"`
	// contains filtered or unexported fields
}

UploadingDatabase 未完成上传的数据库

func NewUploadingDatabase

func NewUploadingDatabase() (ud *UploadingDatabase, err error)

NewUploadingDatabase 初始化未完成上传的数据库, 从库中读取内容

func (*UploadingDatabase) Close

func (ud *UploadingDatabase) Close() error

Close 关闭数据库

func (*UploadingDatabase) Delete

func (ud *UploadingDatabase) Delete(meta *checksum.LocalFileMeta) bool

Delete 删除

func (*UploadingDatabase) Save

func (ud *UploadingDatabase) Save() error

Save 保存内容

func (*UploadingDatabase) Search

Search 搜索

func (*UploadingDatabase) UpdateUploading

func (ud *UploadingDatabase) UpdateUploading(meta *checksum.LocalFileMeta, state *uploader.InstanceState)

UpdateUploading 更新正在上传

Jump to

Keyboard shortcuts

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