[Tutor] Fwd: Is this possible and should it be done?
alan.gauld at btinternet.com
Mon May 21 19:24:39 CEST 2012
On 21/05/12 15:23, wolfrage8765 at gmail.com wrote:
> if any of these formats offer file locking with in them, ;et me say
> that better. Can I open a, as example, tar file and lock a file with
> in it, with out locking the entire tar archive?
No and you probably shouldn't.
If two users are accessing the same file at once and one of them is
modifying it (writing) while the other is trying to read it bad things
are very likely to happen. Remember that these virtual files inside the
tar file(say) are really just blocks of data within a single file.
If you want to try modifying blocks inside a single store you will be
better with a database. But that's not usually a single file (Access,
SQLite etc excepted). Actually SQLite might do what you want by locking
at the table row level, I haven't checked. You would need a single table
of BLOB records where each BLOB represented a virtual file...
Version control tools like CVS and SVN don't quite fit your needs either
since they use multiple files not a single file. Although they do
usually store all the historic versions of each file in one. So if it is
really only historic data you need CVS, SVN, RCS etc may work.
Author of the Learn to Program web site
More information about the Tutor