providers

package
v1.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TypeOSS = "oss"
	TypeCOS = "cos"
	TypeS3  = "s3"
)

存储类型常量

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Upload(ctx context.Context, key string, reader io.Reader, opts ...UploadOptionFunc) error
	Download(ctx context.Context, key string, opts ...DownloadOptionFunc) (io.ReadCloser, error)
	Delete(ctx context.Context, key string) error
	Exists(ctx context.Context, key string) (bool, error)
	Stat(ctx context.Context, key string) (*ObjectInfo, error)
	SignedURL(ctx context.Context, key string, expire time.Duration, opts ...SignOptionFunc) (string, error)
	InitMultipart(ctx context.Context, key string, opts ...UploadOptionFunc) (*MultipartUpload, error)
	UploadPart(ctx context.Context, uploadID string, partNum int, reader io.Reader, opts ...UploadOptionFunc) (*PartInfo, error)
	CompleteMultipart(ctx context.Context, uploadID string, parts []*PartInfo, opts ...UploadOptionFunc) error
	AbortMultipart(ctx context.Context, uploadID string) error
	DeleteBatch(ctx context.Context, keys []string) error
}

Client 存储客户端接口

type Config

type Config struct {
	Type              string
	AccessKeyID       string
	AccessKeySecret   string
	Bucket            string
	Region            string
	Endpoint          string
	DefaultSignExpire time.Duration
}

Config 存储配置

func (*Config) Validate

func (c *Config) Validate() error

Validate 验证配置

type DownloadOption

type DownloadOption struct{}

DownloadOption 下载选项

type DownloadOptionFunc

type DownloadOptionFunc func(*DownloadOption)

DownloadOptionFunc 下载选项函数

type MultipartUpload

type MultipartUpload struct {
	UploadID string
	Key      string
	Bucket   string
}

MultipartUpload 分片上传信息

type ObjectInfo

type ObjectInfo struct {
	Key          string
	Size         int64
	LastModified time.Time
	ETag         string
	ContentType  string
}

ObjectInfo 对象元数据

type PartInfo

type PartInfo struct {
	PartNumber int
	ETag       string
}

PartInfo 分片信息

type SignOption

type SignOption struct {
	Method string
}

SignOption 签名选项

type SignOptionFunc

type SignOptionFunc func(*SignOption)

SignOptionFunc 签名选项函数

type UploadOption

type UploadOption struct {
	ContentType string
}

UploadOption 上传选项

type UploadOptionFunc

type UploadOptionFunc func(*UploadOption)

UploadOptionFunc 上传选项函数

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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