cont

package
v3.3.3-rc.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	UploadTypeMultipart = 1 // 分片上传
	UploadTypePresigned = 2 // 预签名上传

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func New

func New(impl s3.Interface) *Controller

func (*Controller) AccessURL

func (c *Controller) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error)

func (*Controller) AuthSign

func (c *Controller) AuthSign(ctx context.Context, uploadID string, partNumbers []int) (*s3.AuthSignResult, error)

func (*Controller) CompleteUpload

func (c *Controller) CompleteUpload(ctx context.Context, uploadID string, partHashs []string) (*UploadResult, error)

func (*Controller) GetHashObject

func (c *Controller) GetHashObject(ctx context.Context, hash string) (*s3.ObjectInfo, error)

func (*Controller) HashPath

func (c *Controller) HashPath(md5 string) string

func (*Controller) InitiateUpload

func (c *Controller) InitiateUpload(ctx context.Context, hash string, size int64, expire time.Duration, maxParts int) (*InitiateUploadResult, error)

func (*Controller) IsNotFound

func (c *Controller) IsNotFound(err error) bool

func (*Controller) NowPath

func (c *Controller) NowPath() string

func (*Controller) PartLimit

func (c *Controller) PartLimit() *s3.PartLimit

func (*Controller) PartSize

func (c *Controller) PartSize(ctx context.Context, size int64) (int64, error)

func (*Controller) UUID

func (c *Controller) UUID() string

type HashAlreadyExistsError

type HashAlreadyExistsError struct {
	Object *s3.ObjectInfo
}

func (*HashAlreadyExistsError) Error

func (e *HashAlreadyExistsError) Error() string

type InitiateUploadResult

type InitiateUploadResult struct {
	UploadID string             `json:"uploadID"` // 上传ID
	PartSize int64              `json:"partSize"` // 分片大小
	Sign     *s3.AuthSignResult `json:"sign"`     // 分片信息
}

type UploadResult

type UploadResult struct {
	Hash string `json:"hash"`
	Size int64  `json:"size"`
	Key  string `json:"key"`
}

Jump to

Keyboard shortcuts

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