Further work on detecting message removal when folder first selected: #3805
Needed to rethink storage strategies as I researched this and realized that a true scarce database -- where the database is sparsely populated both in columns and rows -- is not feasible due to IMAP's UID rules. The strategy now means that the database rows are contiguous from the highest (newest) message to the oldest *requested by the user*. This is a better situation than having to download the UID for the entire folder.
This commit is contained in:
parent
6b8951bfd8
commit
0533bc9700
45 changed files with 1078 additions and 412 deletions
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
public class Geary.Sqlite.Account : Geary.AbstractAccount, Geary.LocalAccount {
|
||||
private MailDatabase db;
|
||||
private ImapDatabase db;
|
||||
private FolderTable folder_table;
|
||||
private ImapFolderPropertiesTable folder_properties_table;
|
||||
private MessageTable message_table;
|
||||
|
|
@ -14,7 +14,7 @@ public class Geary.Sqlite.Account : Geary.AbstractAccount, Geary.LocalAccount {
|
|||
base ("SQLite account for %s".printf(cred.to_string()));
|
||||
|
||||
try {
|
||||
db = new MailDatabase(cred.user);
|
||||
db = new ImapDatabase(cred.user);
|
||||
} catch (Error err) {
|
||||
error("Unable to open database: %s", err.message);
|
||||
}
|
||||
|
|
@ -61,6 +61,27 @@ public class Geary.Sqlite.Account : Geary.AbstractAccount, Geary.LocalAccount {
|
|||
imap_folder_properties));
|
||||
}
|
||||
|
||||
public async void update_folder_async(Geary.Folder folder, Cancellable? cancellable = null)
|
||||
throws Error {
|
||||
Geary.Imap.Folder imap_folder = (Geary.Imap.Folder) folder;
|
||||
Geary.Imap.FolderProperties? imap_folder_properties = (Geary.Imap.FolderProperties?)
|
||||
imap_folder.get_properties();
|
||||
|
||||
// properties *must* be available
|
||||
assert(imap_folder_properties != null);
|
||||
|
||||
int64 parent_id = yield fetch_parent_id_async(folder.get_path(), cancellable);
|
||||
|
||||
FolderRow? row = yield folder_table.fetch_async(parent_id, folder.get_path().basename,
|
||||
cancellable);
|
||||
if (row == null)
|
||||
throw new EngineError.NOT_FOUND("Can't find in local store %s", folder.get_path().to_string());
|
||||
|
||||
yield folder_properties_table.update_async(row.id,
|
||||
new ImapFolderPropertiesRow.from_imap_properties(folder_properties_table, row.id,
|
||||
imap_folder_properties));
|
||||
}
|
||||
|
||||
public override async Gee.Collection<Geary.Folder> list_folders_async(Geary.FolderPath? parent,
|
||||
Cancellable? cancellable = null) throws Error {
|
||||
int64 parent_id = (parent != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue