From bed01a303f7267e4a68263b168d324de82531405 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 8 Nov 2015 15:27:55 +0000 Subject: [PATCH] Add UnWrapper interface and implement in LimitedFs --- fs/fs.go | 6 ++++++ fs/limited.go | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/fs/fs.go b/fs/fs.go index a8c55775b..5188870e3 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -198,6 +198,12 @@ type DirMover interface { DirMove(src Fs) error } +// UnWrapper is an optional interfaces for Fs +type UnWrapper interface { + // UnWrap returns the Fs that this Fs is wrapping + UnWrap() Fs +} + // ObjectsChan is a channel of Objects type ObjectsChan chan Object diff --git a/fs/limited.go b/fs/limited.go index ad30c0b00..c37d4954d 100644 --- a/fs/limited.go +++ b/fs/limited.go @@ -130,9 +130,15 @@ func (f *Limited) Move(src Object, remote string) (Object, error) { return fMove.Move(src, remote) } +// UnWrap returns the Fs that this Fs is wrapping +func (f *Limited) UnWrap() Fs { + return f.fs +} + // Check the interfaces are satisfied var ( - _ Fs = (*Limited)(nil) - _ Copier = (*Limited)(nil) - _ Mover = (*Limited)(nil) + _ Fs = (*Limited)(nil) + _ Copier = (*Limited)(nil) + _ Mover = (*Limited)(nil) + _ UnWrapper = (*Limited)(nil) )