>>
|
No. 181
I'm a little confused by your description. Maybe terminology is part of your difficulty identifying the problem (that can make a task feel really overwhelming).
I had written a bit of blather about your three point definition, because alone it doesn't really make sense. But the first sentence after that clears things up enough.
You need to make some arbitrary decisions, primarily about what will be kept in the cache and what will you purge. Memcached has a lot of easy ways to make decisions like this, so read up on it (and you'll feel better already). Memcached also has mechanisms to identify what it doesn't currently hold and make a call to whatever you define as the primary resource to fetch it.
So your real problem is just creating a VFS -- as in, an abstraction over the real filesystem(s) that pretends to be a real filesystem of its own complete with file system type calls for writing, retrieval, deletion, etc. You can do whatever you want, but I recommend not getting fancy -- just write a wrapper over normal filesystem functions that are already defined, and based on where the resource actually is (which requires mapping, which is your *real* task here) translates the fetch (or whatever) request into the real FS's expected call and back again.
Let me stress, you are writing a filesystem wrapper which utilizes a local cache which is already implemented by memcached (once you learn how to use it), not an independent caching mechanism or anything really crazy. Decide how your interface is going to mount/access the filesystem you're using and how it will present that filesystem to userland -- and that's about it. FUSE and memcached already have the hard parts taken care of.
As far as mapping stuff into memory, that's what memcached is for. You've got some reading and playing to do, but this isn't that hard and there are many fine examples of excellent implementation out there already. Most of them do stuff you don't need to worry about, like security implementations, versioning, replication, striping/network-fragmentation, etc. but reading a bit about their design at a higher level might be informative (AFS, Globus, GFS, NFS, etc).
blah blah. This post is a bit scattered. The docs for memcached and fuse are too (sorry... lulz). But you can get this done if you familiarize yourself with these tools. Anyway, play with this and have fun. This is the beginning of learning how really cool stuff works, so have fun, not stress.
|