Re: [Chandler-dev] Issues with exporting Chandler data

"Phillip J. Eby" <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]>
Newsgroups gmane.org.osaf.devel
Message-ID <[email protected]>
At 11:57 AM 4/21/2008 -0700, Grant Baillie wrote:
>The existing code does an open() on the path to backup.chex, and
>writes the data directly to that file. Unfortunately, this means that
>your data can get erased, or left in an unusable, incomplete state if
>Chandler or the OS crashes, or even if you Cancel the progress dialog.
>I have a patch that deals with this by writing all the data into an 
>in- memory buffer, and then writes that out to disk.
>
>This means extra memory usage, but seems better than trying to deal
>with platform-dependent issues that you get when writing to a
>temporary file, and renaming it to the path you want. I Googled around
>some for ways of doing this in python, but didn't find anything
>useful. Does anyone know of something better?

The simplest thing would probably be just to always write the backup 
to a unique filename (backup-timestampint.chex?), and then delete 
older files when done.  The process that reads backup files could 
then just default to the most-recently modified one.

Writing out the file with a '.tmp' extension that then gets removed 
would prevent the restore process from reading an incompletely-written file. 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.