From a647c5488830a75e05d7736930c582f27967414f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=B6ller?= Date: Sun, 21 Jan 2018 18:33:58 +0100 Subject: [PATCH] fs: add RangeSeeker interface --- fs/fs.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/fs.go b/fs/fs.go index 6109cddf5..984b122e1 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -672,6 +672,19 @@ type ListRer interface { 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 type ObjectsChan chan Object