Tim's Weblog
Tim Strehle’s links and thoughts on Web apps, software development and Digital Asset Management, since 2002.
2003-01-29

Auto-versioning file system

This should be possible even without patching Samba:

Let's scan a directory (including subdirectories) for changes. The user must put files (not symbolic links) into this directory.

Once a new file comes in, it is moved into another, invisible directory (make sure you don't move it away while it's still being written). RCS versioning is applied to the file, and a symbolic link is created in the original location. The user can now continue reading the file.

When writing to the symbolic link through Samba, the link is being replaced by a file. We can detect this and check in a new RCS version and recreate the link. If the linked file is changed directly (through local access), we can detect this as well.

Deleted files can also be detected, and we can move the RCS file into a trash directory.

Moved files can be identified using a file size/MD5 check sum index.

An automatically created subdirectory ("Versions"?) contains .url files (or static HTML files?) for version management: Comments can be added to files and versions, you can restore or download a previous version (or even do a diff). And you can peek into the trash directory here to restore or erase some or all of the files it contains.

All of this would work without a database. Probably only suited for single or a few users, and for not-too-frequent changes.