From 2eb5cfb7adf34ae61a9b1b564c8ff0e8da06e14b Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 31 Jan 2018 14:22:49 +0000 Subject: [PATCH] fs: Formalize the ObjectUnWrapper interface --- backend/crypt/crypt.go | 25 +++++++++++++------------ fs/fs.go | 7 +++++++ 2 files changed, 20 insertions(+), 12 deletions(-) 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