Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fs: add RangeSeeker interface

Fabian Möllera647c5488830
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