Documentation ¶
Overview ¶
Package ranger implements lazy io.Reader and io.Writer interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Error = errs.Class("ranger")
Error is the errs class of standard Ranger errors.
Functions ¶
This section is empty.
Types ¶
type ByteRanger ¶
type ByteRanger []byte
ByteRanger turns a byte slice into a Ranger.
func (ByteRanger) Range ¶
func (b ByteRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error)
Range implements Ranger.Range.
type ConcatOpts ¶
type ConcatOpts struct { // Prefetch, when true, will support prefetching the next range. Prefetching // won't be very useful without a non-zero PrefetchWhenBytesRemaining value. Prefetch bool // ForceReads only matters if Prefetch is true. If true, not only will the // next range be prefetched, the first few bytes will be also. ForceReads bool // PrefetchWhenBytesRemaining specifies how many bytes should be remaining // at most before prefetching the next bit. Prefetch must be true. PrefetchWhenBytesRemaining int64 }
ConcatOpts specifies a couple of concatenation options.
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
FileReader implements limit reader with io.EOF only on last read.
func (*FileReader) Close ¶
func (reader *FileReader) Close() error
Close closes the underlying file.
type Ranger ¶
type Ranger interface { Size() int64 Range(ctx context.Context, offset, length int64) (io.ReadCloser, error) }
A Ranger is a flexible data stream type that allows for more effective pipelining during seeking. A Ranger can return multiple parallel Readers for any subranges.
func ConcatWithOpts ¶
func ConcatWithOpts(opts ConcatOpts, r ...Ranger) Ranger
ConcatWithOpts concatenates Rangers with support for prefetching the next range if specified.
func FileRanger ¶
FileRanger returns a Ranger from a path.
func ReaderAtRanger ¶
ReaderAtRanger converts a ReaderAt with a given size to a Ranger.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package httpranger implements lazy io.Reader and io.Writer interfaces.
|
Package httpranger implements lazy io.Reader and io.Writer interfaces. |