Documentation ¶
Overview ¶
Package byterange provides acceleration functions for Byte Ranges for use with HTTP Range Requests
Index ¶
- func ParseMultipartRangeResponseBody(body io.Reader, contentTypeHeader string) (MultipartByteRanges, string, Ranges, int64, error)
- type MultipartByteRange
- func (z *MultipartByteRange) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *MultipartByteRange) EncodeMsg(en *msgp.Writer) (err error)
- func (z *MultipartByteRange) MarshalMsg(b []byte) (o []byte, err error)
- func (z *MultipartByteRange) Msgsize() (s int)
- func (z *MultipartByteRange) UnmarshalMsg(bts []byte) (o []byte, err error)
- type MultipartByteRanges
- func (mbrs MultipartByteRanges) Body(fullContentLength int64, contentType string) (http.Header, []byte)
- func (mbrs MultipartByteRanges) Compress()
- func (mbrs MultipartByteRanges) ExtractResponseRange(ranges Ranges, fullContentLength int64, contentType string, body []byte) (http.Header, []byte)
- func (mbrs MultipartByteRanges) Merge(src MultipartByteRanges)
- func (mbrs MultipartByteRanges) PackableMultipartByteRanges() map[string]*MultipartByteRange
- func (mbrs MultipartByteRanges) Ranges() Ranges
- type Range
- func (br Range) ContentRangeHeader(contentLength int64) string
- func (z *Range) DecodeMsg(dc *msgp.Reader) (err error)
- func (z Range) EncodeMsg(en *msgp.Writer) (err error)
- func (br Range) Less(br2 Range) bool
- func (z Range) MarshalMsg(b []byte) (o []byte, err error)
- func (z Range) Msgsize() (s int)
- func (br Range) String() string
- func (z *Range) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Ranges
- func (brs Ranges) CalculateDelta(haves Ranges, fullContentLength int64) Ranges
- func (z *Ranges) DecodeMsg(dc *msgp.Reader) (err error)
- func (z Ranges) EncodeMsg(en *msgp.Writer) (err error)
- func (brs Ranges) Equal(brs2 Ranges) bool
- func (brs Ranges) Len() int
- func (brs Ranges) Less(i, j int) bool
- func (z Ranges) MarshalMsg(b []byte) (o []byte, err error)
- func (z Ranges) Msgsize() (s int)
- func (brs Ranges) String() string
- func (brs Ranges) Swap(i, j int)
- func (z *Ranges) UnmarshalMsg(bts []byte) (o []byte, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseMultipartRangeResponseBody ¶
func ParseMultipartRangeResponseBody(body io.Reader, contentTypeHeader string) (MultipartByteRanges, string, Ranges, int64, error)
ParseMultipartRangeResponseBody returns a MultipartByteRanges from the provided body
Types ¶
type MultipartByteRange ¶
MultipartByteRange represents one part of a list of multipart byte ranges
func (*MultipartByteRange) DecodeMsg ¶
func (z *MultipartByteRange) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*MultipartByteRange) EncodeMsg ¶
func (z *MultipartByteRange) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*MultipartByteRange) MarshalMsg ¶
func (z *MultipartByteRange) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*MultipartByteRange) Msgsize ¶
func (z *MultipartByteRange) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*MultipartByteRange) UnmarshalMsg ¶
func (z *MultipartByteRange) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type MultipartByteRanges ¶
type MultipartByteRanges map[Range]*MultipartByteRange
MultipartByteRanges is a list of type MultipartByteRange
func (MultipartByteRanges) Body ¶
func (mbrs MultipartByteRanges) Body(fullContentLength int64, contentType string) (http.Header, []byte)
Body returns http headers and body representing the subject MultipartByteRanges map, which is suitable for responding to an HTTP request for the full cached range
func (MultipartByteRanges) Compress ¶
func (mbrs MultipartByteRanges) Compress()
Compress will take a Multipart Byte Range Map and compress it such that adajecent ranges are merged
func (MultipartByteRanges) ExtractResponseRange ¶
func (mbrs MultipartByteRanges) ExtractResponseRange(ranges Ranges, fullContentLength int64, contentType string, body []byte) (http.Header, []byte)
ExtractResponseRange returns http headers and body representing the subject MultipartByteRanges map, cropped to the provided ranges
func (MultipartByteRanges) Merge ¶
func (mbrs MultipartByteRanges) Merge(src MultipartByteRanges)
Merge merges the source MultipartByteRanges map into the subject map
func (MultipartByteRanges) PackableMultipartByteRanges ¶
func (mbrs MultipartByteRanges) PackableMultipartByteRanges() map[string]*MultipartByteRange
PackableMultipartByteRanges returns a version of the subject MultipartByteRanges map that is packable by most marshallers, which may require that maps have a key type of string
func (MultipartByteRanges) Ranges ¶
func (mbrs MultipartByteRanges) Ranges() Ranges
Ranges returns a Ranges object from the MultipartByteRanges Object
type Range ¶
Range represents the start and end for a byte range object
func ParseContentRangeHeader ¶
ParseContentRangeHeader returns a Ranges list from the provided input, which must be a properly-formatted HTTP 'Content-Range' Response Header value
func (Range) ContentRangeHeader ¶
ContentRangeHeader returns a 'Content-Range' header representing the extent of the subject range
func (Range) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Ranges ¶
type Ranges []Range
Ranges represents a slice of type Range The objects in the slice may not overlap value coverage, meaning values are contained within <= 1 Range in the slice Good: [ 1-10, 21-30, 35-40 ]; Bad: [ 1-10, 10-20 ]; Bad: [ 1-10, 5-20 ]
func ParseRangeHeader ¶
ParseRangeHeader returns a Ranges list from the provided input, which must be a properly-formatted HTTP 'Range' Request Header value
func (Ranges) CalculateDelta ¶
CalculateDelta calculates the delta between two Ranges
func (Ranges) Equal ¶
Equal returns true if the compared byte range slices are equal and assumes that the Ranges are sorted
func (Ranges) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (Ranges) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message