News for hackers. Stuff that matters.
Re:Show HN: A versioned filesystem inspired by Git by halayli on Tuesday August 28, 2012 @04:19PM (#4445685)
No, you cannot achieve atomicity using these calls. By the time you receive a notification the file might have been edited twice.
Re:Show HN: A versioned filesystem inspired by Git by spartango on Tuesday August 28, 2012 @05:30PM (#4445978)
This is true, but not without drawbacks:

* Using FUSE you gain the atomicity through synchronicity; when a write occurs, you stand between the disk and request. In so doing, you introduce the potential for latency (nevermind the latency inherent to FUSE).

* Using fsevents, you get notifications asynchronously, so there's no I/O performance hit. You may not get the events right away, but with fsevent APIs there's a bounded queue so you generally don't miss events, unless there are too many and the buffer is overflowed[1,2]. The events don't contain the actual file data, so you will lose intermediate edit data.

Thinking about this, it would be cool to exploit a Copy-on-Write filesystem (like ZFS) to scalably add the edit data to fsevent apis. I suppose you could preserve write buffers in memory temporarily instead of CoW, but that would have a nasty memory footprint.

[1]http://msdn.microsoft.com/en-us/library/system.io.filesystem... - Internal buffer size

[2]http://docs.oracle.com/javase/7/docs/api/java/nio/file/Watch... (see the watchkey queue and overflow)

Re:Show HN: A versioned filesystem inspired by Git by gwern on Tuesday August 28, 2012 @04:44PM (#4445809)
If the file is changing that fast, do we really care? I'd be happy to have all my files tracked at only 5s temporal resolution...
Re:Show HN: A versioned filesystem inspired by Git by rhizome on Tuesday August 28, 2012 @04:53PM (#4445848)
Sure, but which 5s? :)