file

package
v3.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProgressReader

func NewProgressReader(r io.Reader, fn func(current int64)) io.Reader

Types

type AuthSignParts added in v3.4.0

type AuthSignParts struct {
	Sign  *third.SignPart
	Times []time.Time
}

type Bitmap

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

func NewBitmap

func NewBitmap(size int) *Bitmap

func ParseBitmap

func ParseBitmap(p []byte, size int) *Bitmap

func (*Bitmap) Clear

func (b *Bitmap) Clear(index int)

func (*Bitmap) Get

func (b *Bitmap) Get(index int) bool

func (*Bitmap) Serialize

func (b *Bitmap) Serialize() []byte

func (*Bitmap) Set

func (b *Bitmap) Set(index int)

func (*Bitmap) Size

func (b *Bitmap) Size() int

type File

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

func NewFile

func NewFile(database db_interface.DataBase, loginUserID string) *File

func (*File) UploadFile

func (f *File) UploadFile(ctx context.Context, req *UploadFileReq, cb UploadFileCallback) (*UploadFileResp, error)

type Md5Reader

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

func NewMd5Reader

func NewMd5Reader(r io.Reader) *Md5Reader

func (*Md5Reader) Md5

func (r *Md5Reader) Md5() string

func (*Md5Reader) Read

func (r *Md5Reader) Read(p []byte) (n int, err error)

type ReadFile

type ReadFile interface {
	io.Reader
	io.Closer
	Size() int64
	StartSeek(whence int) error
}

func Open

func Open(req *UploadFileReq) (ReadFile, error)

type Reader

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

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

type UploadFileCallback

type UploadFileCallback interface {
	Open(size int64)                                                    // 文件打开的大小
	PartSize(partSize int64, num int)                                   // 分片大小,数量
	HashPartProgress(index int, size int64, partHash string)            // 每块分片的hash值
	HashPartComplete(partsHash string, fileHash string)                 // 分块完成,服务端标记hash和文件最终hash
	UploadID(uploadID string)                                           // 上传ID
	UploadPartComplete(index int, partSize int64, partHash string)      // 上传分片进度
	UploadComplete(fileSize int64, streamSize int64, storageSize int64) // 整体进度
	Complete(size int64, url string, typ int)                           // 上传完成
}

type UploadFileReq

type UploadFileReq struct {
	Filepath    string `json:"filepath"`
	Name        string `json:"name"`
	ContentType string `json:"contentType"`
	Cause       string `json:"cause"`
	Uuid        string `json:"uuid"`
}

type UploadFileResp

type UploadFileResp struct {
	URL string `json:"url"`
}

type UploadInfo added in v3.4.0

type UploadInfo struct {
	PartNum int
	Bitmap  *Bitmap
	DBInfo  *model_struct.LocalUpload
	Resp    *third.InitiateMultipartUploadResp
	//Signs   *AuthSignParts
	CreateTime   time.Time
	BatchSignNum int32
	// contains filtered or unexported fields
}

func (*UploadInfo) GetPartSign added in v3.4.0

func (u *UploadInfo) GetPartSign(ctx context.Context, partNumber int32) (*url.URL, http.Header, error)

Jump to

Keyboard shortcuts

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