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: Formalize the ObjectUnWrapper interface

Nick Craig-Wood2eb5cfb7adf3
diff --git a/backend/crypt/crypt.go b/backend/crypt/crypt.go
index 63ce31221..f62ce9731 100644
--- a/backend/crypt/crypt.go
+++ b/backend/crypt/crypt.go
@@ -662,16 +662,17 @@ func (o *ObjectInfo) Hash(hash hash.Type) (string, error) {
// Check the interfaces are satisfied
var (
- _ fs.Fs = (*Fs)(nil)
- _ fs.Purger = (*Fs)(nil)
- _ fs.Copier = (*Fs)(nil)
- _ fs.Mover = (*Fs)(nil)
- _ fs.DirMover = (*Fs)(nil)
- _ fs.PutUncheckeder = (*Fs)(nil)
- _ fs.PutStreamer = (*Fs)(nil)
- _ fs.CleanUpper = (*Fs)(nil)
- _ fs.UnWrapper = (*Fs)(nil)
- _ fs.ListRer = (*Fs)(nil)
- _ fs.ObjectInfo = (*ObjectInfo)(nil)
- _ fs.Object = (*Object)(nil)
+ _ fs.Fs = (*Fs)(nil)
+ _ fs.Purger = (*Fs)(nil)
+ _ fs.Copier = (*Fs)(nil)
+ _ fs.Mover = (*Fs)(nil)
+ _ fs.DirMover = (*Fs)(nil)
+ _ fs.PutUncheckeder = (*Fs)(nil)
+ _ fs.PutStreamer = (*Fs)(nil)
+ _ fs.CleanUpper = (*Fs)(nil)
+ _ fs.UnWrapper = (*Fs)(nil)
+ _ fs.ListRer = (*Fs)(nil)
+ _ fs.ObjectInfo = (*ObjectInfo)(nil)
+ _ fs.Object = (*Object)(nil)
+ _ fs.ObjectUnWrapper = (*Object)(nil)
)
diff --git a/fs/fs.go b/fs/fs.go
index b743ffb94..6109cddf5 100644
--- a/fs/fs.go
+++ b/fs/fs.go
@@ -237,6 +237,13 @@ type MimeTyper interface {
MimeType() string
}
+// ObjectUnWrapper is an optional interface for Object
+type ObjectUnWrapper interface {
+ // UnWrap returns the Object that this Object is wrapping or
+ // nil if it isn't wrapping anything
+ UnWrap() Object
+}
+
// ListRCallback defines a callback function for ListR to use
//
// It is called for each tranche of entries read from the listing and