Store changeNumber maps with modseq in cache for subfolders

By getting the root folder/container whose properties
are stored in OpenChange DB.

This makes the synchronisation of sub-folders faster as
when we evaluate restrictions for this folder, we are able
to get the modseq from where to get the latest messages
unseen by the client.
pull/69/head
Enrique J. Hernández Blasco 2014-12-01 23:19:38 +01:00
parent 4a6daf45e0
commit 067809ef1c
3 changed files with 17 additions and 4 deletions

View File

@ -150,6 +150,7 @@
/* helpers */
- (uint64_t) idForObjectWithKey: (NSString *) childKey;
- (MAPIStoreFolder *) rootContainer;
/* subclasses */
- (MAPIStoreMessage *) createMessage;

View File

@ -1885,6 +1885,17 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
inFolderURL: [self url]];
}
- (MAPIStoreFolder *) rootContainer
{
/* Return the oldest ancestor, which does not have
container. If there is not container, it returns itself.
*/
if (container)
return [container rootContainer];
else
return self;
}
- (NSDate *) creationTime
{
return [dbFolder creationDate];

View File

@ -682,9 +682,9 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
{
/* This method should be called whenever something has changed on the folder.
Then we will perform two actions:
1 - Update its PidTagChangeNumber property.
1 - Update the PidTagChangeNumber property of the root container.
2 - Store relationship PidTagChangenumber with lastModseq value on the
mapping given as parameter */
mapping given as parameter for this folder */
uint64_t *current_cn;
struct SRow row;
struct SPropValue prop;
@ -699,10 +699,11 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
prop.value.d = 0; // It doesn't matter, it will be autogenerated
row.lpProps = ∝
/* We are doing a "touch" operation to update change number of this folder */
/* We are doing a "touch" operation to update change number of the root container.
We get the root container as it has the properties in the OpenChange DB */
username = [[self context] connectionInfo]->username;
oc_ctx = [[self context] connectionInfo]->oc_ctx;
fid = [self objectId];
fid = [[self rootContainer] objectId];
retval = openchangedb_set_folder_properties(oc_ctx, username, fid, &row);
if (retval != MAPI_E_SUCCESS)
{