geary/src/engine/api/Account.vala
Jim Nelson d179cb9bdd Persist messages locally: #3742
This completes the heavy lifting of persisting messages locally.  The strategy is that the local database may be sparsely populated, both in the availability of messages in a folder and the fields of a message that is partially stored.  As data is pulled from the remote server it's always stored in the database.  Future requests will always go to the database first, preventing unnecessary network traffic.

Also, this patch will detect when a message is stored in multiple folders on the server.  The database uses soft links from the folder to the message, so the message is stored only once in the database.  This technique relies heavily on the availability and validity of the Message-ID header, but we expect this to be reliable the vast majority of the time.
2011-06-23 19:07:04 -07:00

46 lines
2 KiB
Vala

/* Copyright 2011 Yorba Foundation
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
public interface Geary.Account : Object {
public signal void folders_added_removed(Gee.Collection<Geary.Folder>? added,
Gee.Collection<Geary.Folder>? removed);
protected virtual void notify_folders_added_removed(Gee.Collection<Geary.Folder>? added,
Gee.Collection<Geary.Folder>? removed) {
folders_added_removed(added, removed);
}
/**
* This method returns which Geary.Email.Field fields must be available in a Geary.Email to
* write (or save or store) the message to the backing medium. Different implementations will
* have different requirements, which must be reconciled.
*
* In this case, Geary.Email.Field.NONE means "any".
*
* If a write operation is attempted on an email that does not have all these fields fulfilled,
* an EngineError.INCOMPLETE_MESSAGE will be thrown.
*/
public abstract Geary.Email.Field get_required_fields_for_writing();
public abstract async void create_folder_async(Geary.Folder? parent, Geary.Folder folder,
Cancellable? cancellable = null) throws Error;
public abstract async void create_many_folders_async(Geary.Folder? parent,
Gee.Collection<Geary.Folder> folders, Cancellable? cancellable = null) throws Error;
public abstract async Gee.Collection<Geary.Folder> list_folders_async(Geary.Folder? parent,
Cancellable? cancellable = null) throws Error;
public abstract async Geary.Folder fetch_folder_async(Geary.Folder? parent, string folder_name,
Cancellable? cancellable = null) throws Error;
public abstract async void remove_folder_async(Geary.Folder folder, Cancellable? cancellable = null)
throws Error;
public abstract async void remove_many_folders_async(Gee.Set<Geary.Folder> folders,
Cancellable? cancellable = null) throws Error;
}