After a discussion with my friend Erik and following the
consumption of much pastry, I decided to try and write a networked
filesystem using only
Ruby)
and FUSE.
After one iteration, I had everything documented and ready to go
but I wasn’t happy with the design or the architecture. In large
part, I discovered shortcomings in my own code base as I was
writing the documentation. Writing with the intent of explaining my
ideas to a newcomer gave me opportunity to find the major flaws in
my own creation. Documentation is a good thing, if only because it
makes you think about things in a whole new way. Anyway, after
rewriting things and shrinking the code base down to size, I’m
please to release the first version of RadiateFS, a networked
filesystem written in Ruby and making use of the most-excellent
FUSE bindings. Other than Ruby (tested using Ruby 1.8.7 on
Debian Lenny) and FUSE
itself, it has no other external dependencies. It used the
DRb
distributed object code bundled with the standard Ruby
distribution. This would not have been possible without the help
and inspiration of a few exceptional individuals: Erik Ordway and
the folks on freenode’s #ruby-lang channel. In particular
drbrain and
raggi. You can download a
tarball here (v0.2b)
and read the mildly-hilarious FAQ below. Does it work?Yes.
Well, sort of. It works well enough that I feel comfortable
releasing it in accordance with the principal of “release early,
release often”. Now that I’ve done the “early” bit, let’s see how
the “often” part goes. How do I install it? You’ll need a few
things. On Debian-friendly systems, you can install the
pre-requisites like so:
sudo aptitude install ruby1.8 fuse-utils libfusefs-ruby1.8 and
that should pull in what you need. After that, you can
download the tarball,
unpack it and go to town. Of course, you’ll need to do this on any
system on which you want to use RadiateFS, whether it be client or
server. How do I use it? It’s rather simple really. Once you’ve
got the required packages installed and the tarball unpacked, you
can share a directory on the server like so:
ruby radiate-server.rb -d source/ -l 0 -s host -p 54321 In this
case, we’ere sharing a directory named “source” using a loglevel of
0 on a host named “host” listening on port 54321. In the directory
you ran this in, you’ll see a log named ‘radiate-server.log’ which,
with a loglevel of 0 (debug), will have a whole lot of stuff in it.
Then, on the client, you can run this to mount the remote
directory: ruby radiatefs.rb -d test -s host -p 54321 to mount
the remote directory over a local directory named test.
Why do directories act funny? Remember that whole “release
early” bit? Well, it’s early and not everything works right. Right
now, you can get at files for which you have a proper pathname no
matter how deep in a shared directory tree you are. The problem
comes when trying to get a directory listing for directories below
the top level. Patches welcome. Is it secure? Absolutely not. I
haven’t even completely implemented support for the ACL
functionality which comes wit DRb. Don’t use this over the internet
or any insecure network. Why on earth would you write this?
First, I was interested by the idea of putting DRb and FUSE
together. Then, it was for the challenge. Looking back, it was
mostly for the lolz. What is your favorite food? Toss up
between good olives and good curry. Why is it read-only? The
way things are set up right now, the instance of the class which
specifies the FUSE mapping is shared directly. Therefore, all
methods invoked on the client are actually executed on the server.
While I *could* technically get write support working, I’d rather
wait and rewrite this piece to have the FUSE directory objects live
on the clients and connect to a broker on the server which
implements proper threading and synchronization. If I’m imagining
things correctly, it’ll add a degree of scaleability as well.
Is it documented? Yes. You can run rdoc on the source and it’ll
generate the documentation. Other than that, you can certainly go
source diving as this might be a neat way for people to learn about
DRB and/or FUSE. How is it licensed?
GPL. What’s next? Well,
I’d like to fix directory support and add auto-discovery using
Rinda. Should be neat to enable clients to automagically find the
server and connect to it. Could be cool, right?
I found a bug. What now? Please contact me and let me know
about it so I can fix the issue. If you help me fix it, I’ll gladly
give you credit for your contribution.