[SEH] 20061030 -- The re-written and much-improved template vfs which I presented at Tcl'2006 [http://www.tcl.tk/community/tcl2006/abstracts/thu-pm1-2.html], and the collection of virtual filesystems built from it, have been uploaded to the CVS repository of the TclVFS project. They have also been released in a zip file as a subsidiary project on the sourceforge project page of [the FILTR] [http://sourceforge.net/project/showfiles.php?group_id=17456]. The new template vfs sacrifices simplicity somewhat, in exchange for API's and functions intended to make it as easy as possible to write functional, scalable new virtual filesystems. There is a new, greatly simplified programming interface which allows one to author a new vfs merely by overloading a few simple procs. Error handling is significantly improved. A complete set of caching functions is included with user-settable cache dwell times. These are intended to make virtual filesystems operating over networks much more efficient. I hope the availability of this template will prompt more people to start writing virtual filesystems of their own. They are an incredible problem-solving tool. On to the core! ''[jcw] - Wow. FWIW, I'm working towards a distributed model for Metakit-like views in the context of the [Vlerq] / [Ratcl] / [Tequila] project. Once that comes within reach, it will all hopefully slot right into several of your VFS designs.'' ---- [SEH] 20060110 -- An update of this code has been posted to a Sourceforge project site [http://filtr.sourceforge.net/]. All future updates will be placed there as well. ---- [SEH] As a self-teaching exercise, I wrote a sample virtual filesystem that utilizes as much of the [Tclvfs] API as possible, although its function is trivially simple. The virtual filesystems included with the Tclvfs distribution are instructive, but they take a lot of shortcuts. ---- Discussion moved to [Template tclvfs Discussion] Because it simply mirrors a real filesystem location, I believe this [vfs] is maximally featureful. My aim for this vfs is to use it as a template for rapid development of new and more complex filesystems. The Mount, Unmount and handler procedures are completely generic and should never need customization for new filesystems. Thus the task of creating a new virtual filesystem is reduced to filling in the procedures for handling the eight subcommands of the Tclvfs API, as well as mounting and unmounting specifics. ---- [SEH] -- 10/14/04 -- I tidied things up a bit, and added an execution [trace] to the 'close' command so that it will throw a proper error if an error occurs in the close callback procedure. Not too relevant for this vfs, but for more complex ones built on the template. I also added a "-volume" option to the Mount command, so you can now do things like: ::vfs::template::Mount -volume $env(HOME) C:/ on Unix, and make pathnames originating on Windows acceptable. Problems syncing cross-platform filesystems solved! Schweet! 12/07/04 -- I had to rewrite the Access procedure to correct a misunderstanding about how the access handler worked; I took the opportunity to optimize it to minimize the number of disk reads required. 12/22/04 -- I made it more of a real template by removing references to "::vfs::template" within procedure bodies and replaced them with [[namespace current]]. Now the Mount, Unmount and handler procedures can be copied and pasted directly into new vfs code without editing. ---- # templatevfs.tcl -- # # The template vfs simply mirrors a real directory to a virtual location. # # Usage: Mount ?-volume? # # Written by Stephen Huntley (stephen.huntley@alum.mit.edu) ---- 20040720 [CMcC]: I just saw a real use for this - a trace fs. Someone was trying to work out why copy -force was failing, it would have been nice to be able to say to them: mount this on your directory and look at the log. Trivial addition to this template - log each argument to, and result from, underlying file system. [snitvfs] has a reimplementation of this, in [Snit]. ---- [[ [Category Example] | [Category VFS] ]]