[Twisted-Python] twisted.vfs issues

James Y Knight foom at fuhm.net
Wed Sep 28 21:01:26 EDT 2005

On Sep 28, 2005, at 8:04 PM, Jp Calderone wrote:

> rename() in VFS should work across filesystems,

Hm, that is going to be an interesting one to implement. I'm thinking  
in particular about what happens when you have a structure like:
/ -> adhoc.AdhocDirectory:
   tmp -> osfs.OSDirectory("/home/jknight/tmp", ...)
   home -> inmem.FakeDirectory(...)

and I ask to move a file from /tmp/foo to /home/bar.

IMO it is reasonable to say that the VFS 'rename' operation is  
allowed to cleanly fail, and not do the rename, forcing a higher  
level to do a copy/delete if it wants. This pushes the complication  
out of each VFS implementation to one implementation that will work  
across all, and furthermore can share its code with the copy  
implementation. This maps nicely to rename(2), as well, as a bonus.

> guarantee atomicity (if this is feasible - I think it is.  If not,  
> it should explicitly deny atomicity),

It isn't feasible, when renaming across filesystems. There will  
certainly have to be a time at which both 'from' and 'to' exist.  
Additionally, it may be impossible to create a file 'to+".tmp"' (or  
similar) in the target directory to atomically rename to 'to' when  
you've finished copying, because of permissions. Another reason to  
restrict "rename" to be the simple rename, rather than the  


More information about the Twisted-Python mailing list