RouteFS 1.1.2

A FUSE API wrapper based on URL routing
URLs were inspired by filesystems. RouteFS is here to return the favor. By describing read-only FUSE filesystems in terms of the directory tree instead of the syscall interface provided by FUSE, developers can write custom filesystems much more efficiently.

RouteFS uses the Routes library developed for the Pylons web development framework.

The canonical location for the RouteFS source code is here at Github. The source tree contains several examples of RouteFS, all corresponding to real use cases of RouteFS. Bugs against RouteFS can be reported at http://bugs.ebroder.net/projects/routefs

Here is an example filesystem written in RouteFS. This is a /home automounter that will automatically create symlinks from /home/user to user’s homedir whenever the /home path is accessed.

#!/usr/bin/python
"""
RouteFS Example: HomeFS

If you work on a system where home directories are on network storage
(i.e. not in /home), mount HomeFS on /home. It's an automounter that
will automatically create symlinks from user -> their homedir whenever
/home/user is accessed in any way.
"""

import pwd
import routefs
from routes import Mapper

class HomeFS(routefs.RouteFS):
 def __init__(self, *args, **kwargs):
 super(HomeFS, self).__init__(*args, **kwargs)
 self.cache = {}

 def make_map(self):
 m = Mapper()
 m.connect('', controller='getList')
 m.connect(':action', controller='getUser')
 return m

 def getUser(self, action, **kwargs):
 try:
 if action not in self.cache:
 self.cache[action] = pwd.getpwnam(action).pw_dir
 return routefs.Symlink(self.cache[action])
 except KeyError:
 return

 def getList(self, **kwargs):
 return self.cache.keys()

if __name__ == '__main__':
 routefs.main(HomeFS)


RouteFS has a dual-license, under Version 1.1 of the MPL and Version 2 (or later) of the GPL.

last updated on:
July 6th, 2010, 16:48 GMT
price:
FREE!
homepage:
github.com
license type:
MPL (Mozilla Public License) 
developed by:
Evan Broder
category:
ROOT \ System \ Filesystems
RouteFS
Download Button

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Rate it!

Add your review!

SUBMIT