Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
HTTPClient provides an interface allowing us to perform HTTP requests.
type Loader ¶
Loader implements a Load method that provides data as byte slice for a given byte range chunk.
Load should be safe to call from multiple goroutines.
If err is nil, the returned byte slice must always exactly as many bytes as was asked for, i.e. len([]byte) returned must always be equal to br.Length().
func WrapLoaderWithLRUCache ¶
WrapLoaderWithLRUCache wraps a loader to cache the results returned by the inner loader in an LRU cache of the given slot count. For best results, wrap the returned Loader with WrapLoaderWithSingleFlight to make sure multiple calls are not make while the cache is being filled. If the given slots count is negative, zero is used.
func WrapLoaderWithSingleFlight ¶
WrapLoaderWithSingleFlight wraps a Loader to ensure that only one call at a time for a given byte range is made to the wrapped loader.
type LoaderFunc ¶
LoaderFunc converts a Load function into a Loader type.
type RangedSource ¶
type RangedSource struct {
// contains filtered or unexported fields
}
func NewRangedSource ¶
func NewRangedSource(length int64, loader Loader, ranger Ranger) RangedSource
func (RangedSource) Reader ¶
func (r RangedSource) Reader() ReaderSeekerReadAt
type RangingHTTPClient ¶
type RangingHTTPClient struct { HTTPClient // contains filtered or unexported fields }
RangingHTTPClient wraps another HTTP client to issue all requests based on the Ranges provided.
func NewRangingHTTPClient ¶
func NewRangingHTTPClient(ranger Ranger, client HTTPClient, parallelism int) RangingHTTPClient