canmove, Confirmed users
2,237
edits
(on-demand sync state diagram) |
m (→Related Bugs: update bug status) |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 58: | Line 58: | ||
Implementing these features, particularly 3a) and 3b), will have the side benefit of fixing (or partly fixing) a number of existing bugs related to messages or message parts being repeatedly downloaded: | Implementing these features, particularly 3a) and 3b), will have the side benefit of fixing (or partly fixing) a number of existing bugs related to messages or message parts being repeatedly downloaded: | ||
* {{bug|345832}} - IMAP attachments preloading (not on demand) | * <strike>{{bug|345832}}</strike> - INVALID - IMAP attachments preloading (not on demand) | ||
* {{bug|439731}} - | * <strike>{{bug|439731}}</strike> - FIXED - Reloading of read messages when using IMAP account (enable disk cache) | ||
* {{bug|405437}} - IMAP mail are not cached for offline use if message size is bigger than mail.imap.mime_parts_on_demand_threshold | * <strike>{{bug|405437}}</strike> - WFM IMAP mail are not cached for offline use if message size is bigger than mail.imap.mime_parts_on_demand_threshold | ||
* {{bug|470624}} - | * {{bug|470624}} - described in this wiki - RFE: On-demand Auto-Sync | ||
=== How To Do It === | === How To Do It === | ||
| Line 78: | Line 78: | ||
===== State Diagram ===== | ===== State Diagram ===== | ||
The finite state diagram below describes the sync states of a folder during on-demand sync. This is based on how auto-sync currently works, the notable differences are: | |||
# The SyncCompleted and SyncFailed '''end''' states. In auto-sync a folder is simply removed from the queue either because all of its messages have been downloaded or the number of retries was exceeded. | |||
# Substates are clearly defined. In auto-sync the substates ReadyToDiscover and ReadyToUpdate are inferred by a folder being in the Discover or Update queue respectively. In on-demand sync a folder's state will need to be explicitly defined either by a substate property or by a function that checks other attributes such as the state of internal queues. | |||
# Folders can only be in one state at a time. This is implied by the previous point. In auto-sync a folder can be in more than one queue at a time (I think), which as an implicit state breaks the FSM model. | |||
<small> | <small> | ||
| Line 83: | Line 89: | ||
<pre> | <pre> | ||
.---------------. | |||
. --------------- . | |||
|| SyncCompleted || | |||
' --------------- ' | |||
'---------------' | |||
^ | |||
| | | | ||
/ | |||
. discoverMessages() | |||
| .-------. | |||
syncCompleted() / \ | |||
. ' . | |||
\ pendingHeaders() > 0 | | pendingMessages() > 0 downloadMessages() | |||
------. \ .----------------. \ v .----------------. .----------------. | |||
/ ------------- / `-> --------------- / `-> --------------- / `-> ------------------ | |||
------>|IdleCompleted| |ReadyToDiscover| |ReadyToDownload| |DownloadInProgress| | |||
------------- <- / --------------- <- / --------------- <- / ------------------ | |||
^ \ `-----------------' `-----------------' `-----------------' ^ \ | |||
| \ pendingHeaders() = 0 pendingMessages() = 0 downloadOK() | \ | |||
/ \ / \ | |||
/ . . . | |||
/ | | downloadFail() | |||
/ headersOutOfDate() | | | |||
/ | | | | |||
. | retriesRemaing() > 0 | | |||
| . . . | |||
updateOK() / \ / | |||
| | \ | | |||
| v \ v | |||
| ------------- ------------ | |||
| |ReadyToUpdate| |DownloadFail| | |||
| ------------- ------------ | |||
| \ \ | |||
| \ \ | |||
| . . | |||
. | retriesRemaing() = 0 | |||
\ updateHeaders() | | |||
\ | . | |||
\ . / | |||
\ / | | |||
\ | updateFail() retriesRemaining() = 0 v | |||
\ v .-------------------------------------. .----------------------------------------. .------------. | |||
---------------- / `-> ---------- / `->. ------------ . | |||
|UpdateInProgress| |UpdateFail| || SyncFailed || | |||
---------------- <- / ---------- ' ------------ ' | |||
`--------------------------------------' '------------' | |||
retriesRemaing() > 0 | |||
</pre> | </pre> | ||