44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package oss
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
// OSSProvider 对象存储提供者接口
|
|
type OSSProvider interface {
|
|
// Upload 上传文件
|
|
Upload(ctx context.Context, key string, reader io.Reader, options *UploadOptions) (*UploadResult, error)
|
|
|
|
// Download 下载文件
|
|
Download(ctx context.Context, key string, writer io.Writer) error
|
|
|
|
// Delete 删除文件
|
|
Delete(ctx context.Context, key string) error
|
|
|
|
// DeleteMultiple 批量删除文件
|
|
DeleteMultiple(ctx context.Context, keys []string) (*DeleteResult, error)
|
|
|
|
// GetFileInfo 获取文件信息
|
|
GetFileInfo(ctx context.Context, key string) (*FileInfo, error)
|
|
|
|
// ListFiles 列举文件
|
|
ListFiles(ctx context.Context, options *ListOptions) (*ListResult, error)
|
|
|
|
// GetSignedURL 获取预签名URL(用于私有文件分享)
|
|
GetSignedURL(ctx context.Context, key string, expiresIn time.Duration) (string, error)
|
|
|
|
// Copy 复制文件
|
|
Copy(ctx context.Context, sourceKey, targetKey string) error
|
|
|
|
// Move 移动/重命名文件
|
|
Move(ctx context.Context, sourceKey, targetKey string) error
|
|
|
|
// Exists 检查文件是否存在
|
|
Exists(ctx context.Context, key string) (bool, error)
|
|
|
|
// Close 关闭连接
|
|
Close() error
|
|
}
|