zmugfs caching

Tonight I finished a really lame in memory cache to store the image data. Basically it’s a dictionary keyed by the path (filename) and the values are another dictionary with image data and timestamp. There is a new configuration entry “image.memory.cache” where you list the number of images to cache in memory, defaults to 5 (about 10MB). When it hits the max size, it removes the oldest entry in the map.

Next up is disk caching. I plan to cache some of the images on disk (in $HOME/.zmugfs/cache) I could probably also use /var/cache/zmugfs for a global install but for the first cut I’ll stick with the former. This adds yet another configuration entry “image.disk.cache” specified in megabytes. Yes, I know it’s lame that the value for the two caches are specified in different units. But the idea of dealing with file sizes in the memory caches versus number of entries was not appealing.

After the disk caching, the only thing left is packaging and some setup scripts to make it easier to create your configuration file.

Marco’s 4th birthday

On Friday, we did the Rodriguez birthday ritual. The kids never get tired of getting sung Happy Birthday.

getting close …

We’re getting very close to releasing zmugfs 0.1, the read-only release. As you may recall on Monday I got zmugfs to show imgdata in nautilus.

img data

But I could only get it to work if I used the thumbnail sized imgdata. In the read() method I was logging into smugmug, reading the thumbnail imgdata, logging out of smugmug, getting the imgdata via http GET, and returning. Well, this is crazy because read gets called multiple times with different offsets. So I ended up implementing the open() and release() methods. In the open, I get the imgdata (original size) via the smugmug api and store the imgdata in an image cache (an in memory dictionary). In the read method, it now respects the offset and size attributes by reading from the image cache. Then in the release method, I delete the entry from the image cache. I know not much of a cache. 🙂 But it solved my problem. I’m putting the cache work off a bit, not sure how to approach that yet.

Next thing I wanted to try all of the command line utils (at least the ones I’ve used before) to see how they react to zmugfs. I was pleasantly surprised with the result.

command result comment
basename SUCCESS  
chgrp FAILURE chgrp method not implemented
chmod FAILURE chmod method not implemented
chown FAILURE chown method not implemented
cp from SUCCESS able to copy image from smugmug using zmugfs
cp to FAILURE mknod not implemented
file SUCCESS got appropriate file type
ln -s SUCCESS softlink created
ls SUCCESS listing appears correctly
mkdir FAILURE mkdir method not implemented
mv FAILURE copy part worked; unlink not implemented
rm FAILURE unlink not implemented
rmdir FAILURE rmdir not implemented
touch FAILURE setattr not implemented

From a readonly perspective, it is looking great. What’s left before a release you ask? Just a few things.

  • packaging
    • write spec file
    • figure out
  • design a logo
  • move code to zmugtools for branding purposes
  • work out image cache

That’s it, once I finish those things zmugfs 0.1 will be released out into the wild! I’m really excited as this is my first ever open source project. I’ve submitted patches to a few things, but never anything this extensive.

permissions and time

Tonights zmugfs update is permissions and time are now shown correctly. I defaulted the user and group to that of the user running the program (in this case me) 🙂 And I now show the date and time correctly from the api.

Update: by “in this case me” it doesn’t mean I hardcoded my uid and gid. I used os.getuid() and os.getgid()

By the way, disregard the drew and foo entries. Those are debug strings which will be removed.

perms and time

It’s alive!

After 2.5 weeks, I finally got my car back from the shop. The following things were fixed:

  • overheating
    • flushed coolant
    • fan relay
    • reprogrammed computer to turn on fans earlier to compensate for a 40 degree delta between the temp gauge sensor and the water pump sensor
  • rough idle
    • “fixed” the cat
  • maintenance
    • changed rear diff fluid (it was overdue)
  • wouldn’t start
    • new starter
    • new Optima battery (kick ass battery to replace my 6 year old Diehard)

A special thanks to Carolina Auto Masters for great work as usual.