Documentation ¶
Index ¶
- Constants
- func Download(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, error)
- func GetContentLength(ctx context.Context, url string, header RequestHeader) (int64, error)
- func GetLastModifiedMillis(ctx context.Context, url string, header RequestHeader) (int64, error)
- func IsExpired(ctx context.Context, url string, header RequestHeader, ...) (bool, error)
- func IsSupportRange(ctx context.Context, url string, header RequestHeader) (bool, error)
- func Register(schema string, resourceClient ResourceClient)
- func UnRegister(schema string)
- type ClientManager
- type ClientManagerImpl
- func (clientMgr *ClientManagerImpl) Download(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, error)
- func (clientMgr *ClientManagerImpl) DownloadWithResponseHeader(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, ResponseHeader, error)
- func (clientMgr *ClientManagerImpl) GetContentLength(ctx context.Context, url string, header RequestHeader) (int64, error)
- func (clientMgr *ClientManagerImpl) GetLastModifiedMillis(ctx context.Context, url string, header RequestHeader) (int64, error)
- func (clientMgr *ClientManagerImpl) IsExpired(ctx context.Context, url string, header RequestHeader, ...) (bool, error)
- func (clientMgr *ClientManagerImpl) IsSupportRange(ctx context.Context, url string, header RequestHeader) (bool, error)
- func (clientMgr *ClientManagerImpl) Register(schema string, resourceClient ResourceClient)
- func (clientMgr *ClientManagerImpl) UnRegister(schema string)
- type RequestHeader
- type ResourceClient
- type ResponseHeader
Constants ¶
View Source
const ( LastModified = "Last-Modified" ETag = "ETag" )
Variables ¶
This section is empty.
Functions ¶
func Download ¶
func Download(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, error)
func GetContentLength ¶
func GetLastModifiedMillis ¶
func IsSupportRange ¶
func Register ¶
func Register(schema string, resourceClient ResourceClient)
func UnRegister ¶
func UnRegister(schema string)
Types ¶
type ClientManager ¶
type ClientManager interface { ResourceClient Register(schema string, resourceClient ResourceClient) UnRegister(schema string) }
func NewManager ¶
func NewManager() ClientManager
type ClientManagerImpl ¶
func (*ClientManagerImpl) Download ¶
func (clientMgr *ClientManagerImpl) Download(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, error)
func (*ClientManagerImpl) DownloadWithResponseHeader ¶
func (clientMgr *ClientManagerImpl) DownloadWithResponseHeader(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, ResponseHeader, error)
func (*ClientManagerImpl) GetContentLength ¶
func (clientMgr *ClientManagerImpl) GetContentLength(ctx context.Context, url string, header RequestHeader) (int64, error)
func (*ClientManagerImpl) GetLastModifiedMillis ¶
func (clientMgr *ClientManagerImpl) GetLastModifiedMillis(ctx context.Context, url string, header RequestHeader) (int64, error)
func (*ClientManagerImpl) IsExpired ¶
func (clientMgr *ClientManagerImpl) IsExpired(ctx context.Context, url string, header RequestHeader, expireInfo map[string]string) (bool, error)
func (*ClientManagerImpl) IsSupportRange ¶
func (clientMgr *ClientManagerImpl) IsSupportRange(ctx context.Context, url string, header RequestHeader) (bool, error)
func (*ClientManagerImpl) Register ¶
func (clientMgr *ClientManagerImpl) Register(schema string, resourceClient ResourceClient)
func (*ClientManagerImpl) UnRegister ¶
func (clientMgr *ClientManagerImpl) UnRegister(schema string)
type ResourceClient ¶
type ResourceClient interface { // GetContentLength get length of resource content // return -l if request fail // return task.IllegalSourceFileLen if response status is not StatusOK and StatusPartialContent GetContentLength(ctx context.Context, url string, header RequestHeader) (int64, error) // IsSupportRange checks if resource supports breakpoint continuation IsSupportRange(ctx context.Context, url string, header RequestHeader) (bool, error) // IsExpired checks if a resource received or stored is the same. IsExpired(ctx context.Context, url string, header RequestHeader, expireInfo map[string]string) (bool, error) // Download download from source Download(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, error) // DownloadWithResponseHeader download from source with responseHeader DownloadWithResponseHeader(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, ResponseHeader, error) // GetLastModified get lastModified timestamp milliseconds of resource GetLastModifiedMillis(ctx context.Context, url string, header RequestHeader) (int64, error) }
ResourceClient supply apis that interact with the source.
func LoadPlugin ¶
func LoadPlugin(schema string) (ResourceClient, error)
type ResponseHeader ¶
response header
func DownloadWithResponseHeader ¶
func DownloadWithResponseHeader(ctx context.Context, url string, header RequestHeader) (io.ReadCloser, ResponseHeader, error)
func (ResponseHeader) Get ¶
func (h ResponseHeader) Get(key string) string
Directories ¶
Path | Synopsis |
---|---|
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.