summaryrefslogtreecommitdiff
path: root/fs/mountfs.py
diff options
context:
space:
mode:
authorrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2010-01-19 06:44:05 +0000
committerrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2010-01-19 06:44:05 +0000
commit626bab33ac0c8d1ad63da6cb880b8646f5222d84 (patch)
treefb66302f5f3bfe976862bace14372b79cac74d73 /fs/mountfs.py
parent94ca0e25c3846d21a06b2e520e6eb248b2ca5f2e (diff)
downloadpyfilesystem-626bab33ac0c8d1ad63da6cb880b8646f5222d84.tar.gz
MountFS: fast-path copy/move/copydir/movedir if src and dst are in same FS
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@321 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/mountfs.py')
-rw-r--r--fs/mountfs.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/mountfs.py b/fs/mountfs.py
index 1dbc4b2..df2ae8f 100644
--- a/fs/mountfs.py
+++ b/fs/mountfs.py
@@ -229,6 +229,42 @@ class MountFS(FS):
raise UnsupportedError("rename resource", path=src)
@synchronize
+ def move(self,src,dst,**kwds):
+ fs1, mount_path1, delegate_path1 = self._delegate(src)
+ fs2, mount_path2, delegate_path2 = self._delegate(dst)
+ if fs1 is fs2 and fs1 is not self:
+ fs1.move(delegate_path1,delegate_path2,**kwds)
+ else:
+ super(MountFS,self).move(src,dst,**kwds)
+
+ @synchronize
+ def movedir(self,src,dst,**kwds):
+ fs1, mount_path1, delegate_path1 = self._delegate(src)
+ fs2, mount_path2, delegate_path2 = self._delegate(dst)
+ if fs1 is fs2 and fs1 is not self:
+ fs1.movedir(delegate_path1,delegate_path2,**kwds)
+ else:
+ super(MountFS,self).movedir(src,dst,**kwds)
+
+ @synchronize
+ def copy(self,src,dst,**kwds):
+ fs1, mount_path1, delegate_path1 = self._delegate(src)
+ fs2, mount_path2, delegate_path2 = self._delegate(dst)
+ if fs1 is fs2 and fs1 is not self:
+ fs1.copy(delegate_path1,delegate_path2,**kwds)
+ else:
+ super(MountFS,self).copy(src,dst,**kwds)
+
+ @synchronize
+ def copydir(self,src,dst,**kwds):
+ fs1, mount_path1, delegate_path1 = self._delegate(src)
+ fs2, mount_path2, delegate_path2 = self._delegate(dst)
+ if fs1 is fs2 and fs1 is not self:
+ fs1.copydir(delegate_path1,delegate_path2,**kwds)
+ else:
+ super(MountFS,self).copydir(src,dst,**kwds)
+
+ @synchronize
def mountdir(self, path, fs):
"""Mounts a host FS object on a given path.