diff options
Diffstat (limited to '')
-rw-r--r-- | comm/mailnews/base/public/nsIMsgFolderCache.idl | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/comm/mailnews/base/public/nsIMsgFolderCache.idl b/comm/mailnews/base/public/nsIMsgFolderCache.idl new file mode 100644 index 0000000000..b5ba40afdc --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgFolderCache.idl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIFile; +interface nsIMsgFolderCacheElement; + +/** + * nsIMsgFolderCache is a store of values which might be slow for the folder + * to calculate. For example: the number of unread messages. + * The account manager holds the cache, and each folder manipulates its cached + * properties via nsIMsgFolderCacheElement. + */ +[scriptable, uuid(78C2B6A2-E29F-44de-9543-10DBB51E245C)] +interface nsIMsgFolderCache : nsISupports +{ + /** + * Set up the cache, loading/saving to cacheFile. + * If a new-style cacheFile isn't found, it looks for an old panacea.dat, + * specified by legacyFile and migrates it to the new format. + * Neither file has to exist - it'll just start up with an empty cache. + * nsMsgFolderCache (the only implementation) will autosave to cacheFile + * when changes are made. + * + * @param cacheFile File to persist the cache data (folderCache.json). + * @param legacyFile Old panacea.dat file to check for and migrate, if + * cacheFile doesn't exist. + */ + void init(in nsIFile cacheFile, in nsIFile legacyFile); + + /** + * Return an nsIMsgFolderCacheElement for a given folder. + * Unless createIfMissing is set, a missing entry will cause failure. + */ + nsIMsgFolderCacheElement getCacheElement(in ACString key, in boolean createIfMissing); + void removeElement(in ACString key); + + /** + * Write immediately to cacheFile if any data has been changed. + * Write immediately to cacheFile if any data has been changed. + * This happens in the cache dtor anyway, but we use it during shutdown and + * in unit testing (so tests don't have to wait for JS garbage collection). + */ + void flush(); +}; |