From e9dda25c6096266a8b138cdff93c3b7da0fa7104 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 8 Nov 2015 14:15:28 +0000 Subject: [PATCH] Implement Move in limited fs --- fs/limited.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/fs/limited.go b/fs/limited.go index 3c15ba20d..ad30c0b00 100644 --- a/fs/limited.go +++ b/fs/limited.go @@ -113,6 +113,26 @@ func (f *Limited) Copy(src Object, remote string) (Object, error) { return fCopy.Copy(src, remote) } +// Move src to this remote using server side move operations. +// +// This is stored with the remote path given +// +// It returns the destination Object and a possible error +// +// Will only be called if src.Fs().Name() == f.Name() +// +// If it isn't possible then return fs.ErrorCantMove +func (f *Limited) Move(src Object, remote string) (Object, error) { + fMove, ok := f.fs.(Mover) + if !ok { + return nil, ErrorCantMove + } + return fMove.Move(src, remote) +} + // Check the interfaces are satisfied -var _ Fs = &Limited{} -var _ Copier = &Limited{} +var ( + _ Fs = (*Limited)(nil) + _ Copier = (*Limited)(nil) + _ Mover = (*Limited)(nil) +)