Documentation
¶
Overview ¶
Package object object/copy.go
Package object object/delete.go
Package object object/errors.go
Package object object/get.go
Package object object/list.go
Package object object/multipart.go
Package object object/object.go
Package object object/options.go
Package object object/put.go
Package object object/service.go
Package object object/stat.go
Package object object/utils.go
Index ¶
- Variables
- func WithVersionID(versionID string) interface{}
- type CommonPrefix
- type CopyOption
- type CopyOptions
- type DeleteOption
- type DeleteOptions
- type GetOption
- type GetOptions
- type ListBucketV2Result
- type ListOption
- type ListOptions
- type PutOption
- func WithContentDisposition(disposition string) PutOption
- func WithContentEncoding(encoding string) PutOption
- func WithContentType(contentType string) PutOption
- func WithPartSize(size uint64) PutOption
- func WithStorageClass(class string) PutOption
- func WithUserMetadata(metadata map[string]string) PutOption
- func WithUserTags(tags map[string]string) PutOption
- type PutOptions
- type Service
- type StatOption
- type StatOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBucketName 无效的桶名 ErrInvalidBucketName = errors.New("invalid bucket name") // ErrInvalidObjectName 无效的对象名 ErrInvalidObjectName = errors.New("invalid object name") // ErrObjectNotFound 对象不存在 ErrObjectNotFound = errors.New("object not found") // ErrNotImplemented 功能未实现 ErrNotImplemented = errors.New("not implemented yet") )
Functions ¶
func WithVersionID ¶
func WithVersionID(versionID string) interface{}
WithVersionID 设置版本 ID(用于 Get/Stat/Delete)
Types ¶
type CopyOption ¶
type CopyOption func(*CopyOptions)
CopyOption 复制选项函数
func WithCopyMetadata ¶
func WithCopyMetadata(metadata map[string]string, replace bool) CopyOption
WithCopyMetadata 设置复制元数据
func WithCopySourceVersionID ¶
func WithCopySourceVersionID(versionID string) CopyOption
WithCopySourceVersionID 设置源版本 ID
type CopyOptions ¶
type CopyOptions struct {
// 源版本 ID
SourceVersionID string
// 目标元数据
UserMetadata map[string]string
UserTags map[string]string
// 替换元数据
ReplaceMetadata bool
ReplaceTagging bool
// 内容类型
ContentType string
ContentEncoding string
ContentDisposition string
CacheControl string
Expires time.Time
// 存储类
StorageClass string
// 匹配条件
MatchETag string
NotMatchETag string
MatchModified time.Time
NotModified time.Time
// 自定义头
CustomHeaders http.Header
}
CopyOptions 复制选项
type DeleteOptions ¶
type DeleteOptions struct {
// 版本 ID
VersionID string
// 强制删除
ForceDelete bool
// 自定义头
CustomHeaders http.Header
}
DeleteOptions 删除选项
type GetOptions ¶
type GetOptions struct {
// Range 请求范围
RangeStart int64
RangeEnd int64
SetRange bool
// 版本 ID
VersionID string
// 匹配条件
MatchETag string
NotMatchETag string
MatchModified time.Time
NotModified time.Time
// 自定义头
CustomHeaders http.Header
}
GetOptions 下载选项
type ListBucketV2Result ¶
type ListBucketV2Result struct {
XMLName xml.Name `xml:"ListBucketResult"`
Name string `xml:"Name"`
Prefix string `xml:"Prefix"`
KeyCount int `xml:"KeyCount"`
MaxKeys int `xml:"MaxKeys"`
Delimiter string `xml:"Delimiter"`
IsTruncated bool `xml:"IsTruncated"`
Contents []types.ObjectInfo `xml:"Contents"`
CommonPrefixes []CommonPrefix `xml:"CommonPrefixes"`
ContinuationToken string `xml:"ContinuationToken"`
NextContinuationToken string `xml:"NextContinuationToken"`
StartAfter string `xml:"StartAfter"`
}
ListBucketV2Result 列出存储桶 V2 响应结果
type ListOptions ¶
type ListOptions struct {
// 前缀
Prefix string
// 递归列出
Recursive bool
// 最大键数
MaxKeys int
// 起始位置
StartAfter string
// 使用 V2 API
UseV2 bool
// 包含版本
WithVersions bool
// 包含元数据
WithMetadata bool
// 自定义头
CustomHeaders http.Header
}
ListOptions 列出对象选项
type PutOption ¶
type PutOption func(*PutOptions)
PutOption 上传选项函数
func WithContentDisposition ¶
WithContentDisposition 设置内容处置
func WithContentEncoding ¶
WithContentEncoding 设置内容编码
func WithUserMetadata ¶
WithUserMetadata 设置用户元数据
type PutOptions ¶
type PutOptions struct {
// 内容类型
ContentType string
// 内容编码
ContentEncoding string
// 内容处置
ContentDisposition string
// 内容语言
ContentLanguage string
// 缓存控制
CacheControl string
// 过期时间
Expires time.Time
// 用户元数据
UserMetadata map[string]string
// 用户标签
UserTags map[string]string
// 存储类
StorageClass string
// 自定义头
CustomHeaders http.Header
// 发送 Content-MD5
SendContentMD5 bool
// 禁用 Content-SHA256
DisableContentSHA256 bool
// 分片大小
PartSize uint64
// 并发数
NumThreads uint
}
PutOptions 上传选项
type Service ¶
type Service interface {
// Put 上传对象
Put(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts ...PutOption) (types.UploadInfo, error)
// Get 下载对象
Get(ctx context.Context, bucketName, objectName string, opts ...GetOption) (io.ReadCloser, types.ObjectInfo, error)
// Stat 获取对象信息
Stat(ctx context.Context, bucketName, objectName string, opts ...StatOption) (types.ObjectInfo, error)
// Delete 删除对象
Delete(ctx context.Context, bucketName, objectName string, opts ...DeleteOption) error
// List 列出对象
List(ctx context.Context, bucketName string, opts ...ListOption) <-chan types.ObjectInfo
// Copy 复制对象
Copy(ctx context.Context, destBucket, destObject, srcBucket, srcObject string, opts ...CopyOption) (types.CopyInfo, error)
}
Service Object 服务接口
func NewService ¶
func NewService(executor *core.Executor, locationCache *cache.LocationCache) Service
NewService 创建 Object 服务
type StatOptions ¶
StatOptions 获取对象信息选项