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 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 RequestHeader ¶
RequestHeader request header
func (RequestHeader) Get ¶
func (h RequestHeader) Get(key string) 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, rang *rangers.Range) (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 downloads from source Download(ctx context.Context, url string, header RequestHeader, rang *rangers.Range) (io.ReadCloser, error) // DownloadWithResponseHeader download from source with responseHeader DownloadWithResponseHeader(ctx context.Context, url string, header RequestHeader, rang *rangers.Range) (io.ReadCloser, ResponseHeader, error) // GetLastModifiedMillis gets last modified 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 ¶
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.