[Rd] Read/write file locking mechanism using SQL?

From: Henrik Bengtsson <hb_at_stat.berkeley.edu>
Date: Wed, 30 Apr 2008 17:10:23 +0200


Hi,

I've got data stored in multiple files on a shared file system. I wish to have multiple processes/hosts read and write to these files simultaneously. When a process wish to write to a file no other processes may write to nor read from the file. If no process is writing to the file, any number of processes may read from it. ...and the solution should be very simple and work automagically in the background (no/minimal setup required by the user).

The above can be achieved via file locking mechanism where writers need to require a write lock before writing, and readers need to require a read lock before reading. Any number of read locks can be handed out, but only if no write lock is already in place. Write locks can only be obtained if no other locks (read or write) are handed out. The locking mechanism is per file.

I am locking for a cross platform solution in R that works on any file system, i.e. I am not in control of the operating systems of the hosts nor the file system where the data files are stored. I've been suggested to use, for instance, RSQLite database since it provides atomic transactions (and is available on Windows, *nix & OSX). I can image to have a table where each entry is indexed by a file and it keeps track of how many read and write locks are active.

Does anyone know of existing solution for this, or has ideas how this could be implemented? I appreciate any references/comments.

/Henrik



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 30 Apr 2008 - 15:58:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Apr 2008 - 17:31:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive