in reply to Read / Write Server
Note: Bob will need to set the correct group and group writable permissions as well as have write access to the folder containing the file. The temp file should be in the same folder as the original, because this does not work across mount points.
The above is completely Atomic and works for line buffered files. By Atomic we mean that a reader sees one or the other versions of the file. If it's imperative that the reader always has the freshest data, then you need to use file locks. If using file locks consider using binary data as you'll incur less buffering overhead that is not doing any good.
Keep in mind after step 9, especially step 10, step 6 is accessible to anyone. During step 10 it's imperative that any new updates will be able to pass down a chain of several other updates. For this reason it may be a good idea to skip step 3 and 4, there is a lot of added complexity if there isn't a clear gain from allowing appends to not be done in a new file.
|
|---|