]> git.cworth.org Git - sup/commit
refactor index access into three methods and rewrite PollManager#each_message_from
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Tue, 11 Aug 2009 19:34:50 +0000 (15:34 -0400)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Mon, 17 Aug 2009 18:41:22 +0000 (14:41 -0400)
commit906ab35e87c099d411ffb53ac7602e55c23b08ea
tree326092fa8ec7ff48c78e9107ac618305f4532956
parent7aea418a8a62b7070eee764475fcfc0bdd8d58dd
refactor index access into three methods and rewrite PollManager#each_message_from

Couple big changes in this commit, but they're all tied together.

Index.sync_message is refactored into three separate methods: add_message,
update_message and update_message_state. The intention is that add_message is
called for new messages only, update_message is called for changing the method
body on disk (e.g. when we see multiple copies of the same message, or by
DraftManager when the text of a draft is changes), and update_message_state is
called when the labels on a message change. So indexes that differentiate those
operations can exhibit more natural performance characteristics.

Also, PollManager.add_messages_from has been renamed to each_message_from and
changed significantly. It now *only* yields successive messages; it does not
load the index version of the message, and it does not auto-add the message to
the index.  (In fact, it ignores the result of the block.) There's also a new
method called add_new_message that calls Index.add_message and then relays the
update to other GUI elements.

There was a lot of refactoring of sup-sync that was part of this. Probably
not strictly necessary but it was too hard to untangle the changes.
12 files changed:
bin/sup-sync
bin/sup-sync-back
bin/sup-tweak-labels
lib/sup/draft.rb
lib/sup/ferret_index.rb
lib/sup/index.rb
lib/sup/message.rb
lib/sup/modes/thread-index-mode.rb
lib/sup/poll.rb
lib/sup/sent.rb
lib/sup/thread.rb
lib/sup/xapian_index.rb