tags:

views:

17

answers:

0

Hello, all

I need to track all writes to files in order to have synchronized version of files on different place (server or just other directory, not considerable). Let it:

  • all files located in same directory
  • feel free to create some system files (e.g. SomeFileName.Ext~temp-data)
  • no one have concurrent access to synced directory; nobody spoil ours meta-files or change real-files before we do postponed writes (like a commits)
  • do not to care recovering "local" changes in case of crash; system can just rolled back to state of "server" by simple copy from it
  • significant to have it transparent to use (so programmer must just call ordinary fopen(), read(), write())

It must be guaranteed that copy of files which "server" have is consistent. That is whole files scope existed in some moment of time. They may be sufficiently outdated but it must be fair snapshot of all files at some time.

As i understand i should overload writing logic to collect data in order sent changes to "server". For example writing to temporary File~tmp. And so i have to overload reads in order program could read actual data of file.

It would be great if you suggest some existing library (java or c++, it is unimportant) or solution (VCS customizing?). Or give hints how should i write it by myself.


edit:

After some reading i have more precision requirements:

I need COW (Copy-on-write) wrapper for fopen(),fwrite(),.. or interceptor (hook) WriteFile() and other FS api system calls.

Log-structured file system in userspace would be a alternative too.