Documentation ¶
Index ¶
Constants ¶
const NoSkip = 64 * 1024
NoSkip holds the maximum number of bytes that we will read instead of discarding a connection in order to seek.
Variables ¶
var ( // ErrNotFound is returned by Open when the file // does not exist. ErrNotFound = errors.New("file not found") )
var SupportedResponseStatuses = []int{ http.StatusOK, http.StatusNotFound, http.StatusPartialContent, http.StatusPreconditionFailed, }
SupportedResponseStatuses holds the set of HTTP statuses that a response may legimately have.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Do sends an HTTP request to the file. // The provided header fields are added // to the request, and the given request is // send with the given method (GET or HEAD). Do(req *Request) (*Response, error) }
Client represents a client that can send HTTP requests.
type File ¶
type File struct {
// contains filtered or unexported fields
}
func Open ¶
Open opens a new file that uses the given client to issue read requests. It returns the open file and any HTTP header returned by the initial client request.
If the file is not found, it returned ErrNotFound.
The readAhead parameter governs the amount of data that will be requested before any Read calls are made. If it's zero, no data will be requested before Read calls are made. If it's -1, unlimited data will be requested; otherwise the given number of bytes will be requested.
If readAhead is less than NoSkip and not -1, all HTTP connections will be available for reuse regardless of how Seek is used.
func (*File) Close ¶
Close implements io.Closer.Close. It does not block and never returns an error.