When updating the database information it is often necessary to perform several edits. Initially we assume that the database is consistent and correct. After updating the database we also wish for the database to be consistent and correct. However during update this may not be true.
Consider the case of adding a new reading to the end of a contig. We need to write the new reading with it's left neighbour set to the original last reading in the contig; then need to update the original last reading's right neighbour to reference our new last reading; and finally we need to update the contig information. During this operation the database is inconsistent so should the program or system terminate unexpectedly we wish to revert back to the earlier consistent state.
This is performed by use of controlled flushing. The database internally maintains a time stamp of the last flushed state. When we open a database that contains data written after the last flush we ignore the new data and use the data written at the last flush.
io_flush
io
void flush2t(
GapIO *io)
gap_auto_flush
io_write_reading
, io_write_reading_name
, io_add_reading
and io_allocate
) automatically flush after performing the write. Note
the consequences of this action. By default this is set to 0 which disables
automatic flush. A non zero value enables automatic flush.