Documentation
¶
Index ¶
- Constants
- type Client
- type Driver
- func (handler *Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error
- func (handler *Driver) Delete(ctx context.Context, files []string) ([]string, error)
- func (handler *Driver) Get(ctx context.Context, path string) (response.RSCloser, error)
- func (handler *Driver) List(ctx context.Context, path string, recursive bool) ([]response.Object, error)
- func (handler *Driver) Put(ctx context.Context, file fsctx.FileHeader) error
- func (handler *Driver) Source(ctx context.Context, path string, baseURL url.URL, ttl int64, isDownload bool, ...) (string, error)
- func (handler *Driver) Thumb(ctx context.Context, path string) (*response.ContentResponse, error)
- func (handler *Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, ...) (*serializer.UploadCredential, error)
Constants ¶
View Source
const (
OverwriteHeader = auth.CrHeaderPrefix + "Overwrite"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// CreateUploadSession creates remote upload session
CreateUploadSession(ctx context.Context, session *serializer.UploadSession, ttl int64, overwrite bool) error
// GetUploadURL signs an url for uploading file
GetUploadURL(ttl int64, sessionID string) (string, string, error)
// Upload uploads file to remote server
Upload(ctx context.Context, file fsctx.FileHeader) error
// DeleteUploadSession deletes remote upload session
DeleteUploadSession(ctx context.Context, sessionID string) error
}
Client to operate uploading to remote slave server
type Driver ¶
type Driver struct {
Client request.Client
Policy *model.Policy
AuthInstance auth.Auth
// contains filtered or unexported fields
}
Driver 远程存储策略适配器
func NewDriver ¶
NewDriver initializes a new Driver from policy TODO: refactor all method into upload client
func (*Driver) CancelToken ¶
func (handler *Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error
取消上传凭证
func (*Driver) List ¶
func (handler *Driver) List(ctx context.Context, path string, recursive bool) ([]response.Object, error)
List 列取文件
func (*Driver) Source ¶
func (handler *Driver) Source( ctx context.Context, path string, baseURL url.URL, ttl int64, isDownload bool, speed int, ) (string, error)
Source 获取外链URL
func (*Driver) Token ¶
func (handler *Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, file fsctx.FileHeader) (*serializer.UploadCredential, error)
Token 获取上传策略和认证Token
Click to show internal directories.
Click to hide internal directories.