Ticket #266 (new enhancement)
Opened 7 months ago
Rename flush() to commit, add a pure minimise_memory() method.
| Reported by: | richard | Owned by: | olly |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.1.0 |
| Component: | Library API | Version: | SVN trunk |
| Severity: | normal | Keywords: | |
| Cc: | Blocked By: | ||
| Operating System: | All | Blocking: | #267 |
Description
Currently, WritableDatabase::flush(), (which can only be called outside an explicit transaction), writes all the buffered changes to disk, and then performs a commit of the implicit transaction, making the changes visible to newly opened Database objects. This isn't really implied by the "flush" name - it would be more accurate to call the method "commit()", or similar. I suggest renaming flush to commit (but keeping flush() as an alias for backwards compatibility, for now).
Also, it would be helpful to be able to force the buffered changes to be written to disk, to reduce memory usage, but not to cause a commit(). This kind of flush would be useful when performing a large bulk change which the user wants to appear atomic. We can't call this method "flush()" because this would be a confusing change of behaviour. Olly suggests calling the method "minimise_memory", which seems fine to me, and describes the intention of the method, rather than its effects. This method would work the same whether called inside or outside an explicit transaction - it would write as many of the buffered changes as possible to disk, but not perform a commit.
Let's think about this for 1.1.0, though I'm not going to complain if this is bumped to later.
