fs: add RangeSeeker interface

This commit is contained in:
Fabian Möller 2018-01-21 18:33:58 +01:00 committed by Nick Craig-Wood
parent 334bf49d30
commit a647c54888

View file

@ -672,6 +672,19 @@ type ListRer interface {
ListR(dir string, callback ListRCallback) error ListR(dir string, callback ListRCallback) error
} }
// RangeSeeker is the interface that wraps the RangeSeek method.
//
// Some of the returns from Object.Open() may optionally implement
// this method for efficiency purposes.
type RangeSeeker interface {
// RangeSeek behaves like a call to Seek(offset int64, whence
// int) with the output wrapped in an io.LimitedReader
// limiting the total length to limit.
//
// RangeSeek with a limit of < 0 is equivalent to a regular Seek.
RangeSeek(offset int64, whence int, length int64) (int64, error)
}
// ObjectsChan is a channel of Objects // ObjectsChan is a channel of Objects
type ObjectsChan chan Object type ObjectsChan chan Object