[Tutor] Fwd: Is this possible and should it be done?

2012-05-21 Thread wolfrage8...@gmail.com
-- Forwarded message --
From: wolfrage8...@gmail.com wolfrage8...@gmail.com
Date: Mon, May 21, 2012 at 2:16 PM
Subject: Re: [Tutor] Is this possible and should it be done?
To: Steven D'Aprano st...@pearwood.info


Thank you for the information. Sorry if I implied I wanted to
re-invent the wheel but actually this feedback is exactly what I was
looking for. I wanted to know existing methods to do just such
operations. Also good point about the file browsers the only
limitation to them is how much they understand the format.
So since tar looks like an excellent option for what I want to do, I
have another question before I begin my research. Do you already know
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? Just asking if you
already know if this is possible? Thank you again for the information!

SNIPED
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: Is this possible and should it be done?

2012-05-21 Thread Alan Gauld

On 21/05/12 15:23, wolfrage8...@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.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: Is this possible and should it be done?

2012-05-21 Thread Jordan


On 05/21/2012 07:24 PM, Alan Gauld wrote:
 On 21/05/12 15:23, wolfrage8...@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...

Very interesting idea, I have actually used a SQLite file in this way
before, not sure why I did not think of that possibility. SQLite's BLOB
could be the perfect already created solution. Thank you all for your
inputs.
 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.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor