Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Akonadi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
Akonadi
Commits
8398a688
Commit
8398a688
authored
Oct 17, 2010
by
Tobias Koenig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache the ancestor chain for items from the same collection.
svn path=/trunk/KDE/kdepimlibs/; revision=1186758
parent
c9e5fffb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
protocolhelper.cpp
protocolhelper.cpp
+20
-1
protocolhelper_p.h
protocolhelper_p.h
+9
-0
No files found.
protocolhelper.cpp
View file @
8398a688
...
...
@@ -79,6 +79,25 @@ QByteArray ProtocolHelper::cachePolicyToByteArray(const CachePolicy & policy)
return
rv
;
}
void
ProtocolHelper
::
parseAncestorsCached
(
const
QByteArray
&
data
,
Entity
*
entity
,
Collection
::
Id
parentCollection
,
ProtocolHelperValuePool
*
pool
,
int
start
)
{
if
(
!
pool
||
parentCollection
==
-
1
)
{
// if no pool or parent collection id is provided we can't cache anything, so continue as usual
parseAncestors
(
data
,
entity
,
start
);
return
;
}
if
(
pool
->
ancestorCollections
.
contains
(
parentCollection
)
)
{
// ancestor chain is cached already, so use the cached value
entity
->
setParentCollection
(
pool
->
ancestorCollections
.
value
(
parentCollection
)
);
}
else
{
// not cached yet, parse the chain
parseAncestors
(
data
,
entity
,
start
);
pool
->
ancestorCollections
.
insert
(
parentCollection
,
entity
->
parentCollection
()
);
}
}
void
ProtocolHelper
::
parseAncestors
(
const
QByteArray
&
data
,
Entity
*
entity
,
int
start
)
{
Q_UNUSED
(
start
);
...
...
@@ -355,7 +374,7 @@ void ProtocolHelper::parseItemFetchResult( const QList<QByteArray> &lineTokens,
ImapParser
::
parseDateTime
(
lineTokens
[
i
+
1
],
datetime
);
item
.
setModificationTime
(
datetime
);
}
else
if
(
key
==
"ANCESTORS"
)
{
ProtocolHelper
::
parseAncestors
(
lineTokens
[
i
+
1
],
&
item
);
ProtocolHelper
::
parseAncestors
Cached
(
lineTokens
[
i
+
1
],
&
item
,
cid
,
valuePool
);
}
else
{
int
version
=
0
;
QByteArray
plainKey
(
key
);
...
...
protocolhelper_p.h
View file @
8398a688
...
...
@@ -42,6 +42,7 @@ struct ProtocolHelperValuePool
FlagPool
flagPool
;
MimeTypePool
mimeTypePool
;
QHash
<
Collection
::
Id
,
Collection
>
ancestorCollections
;
};
/**
...
...
@@ -81,6 +82,14 @@ class ProtocolHelper
*/
static
void
parseAncestors
(
const
QByteArray
&
data
,
Entity
*
entity
,
int
start
=
0
);
/**
Convert a ancestor chain from its protocol representation into an Entity object.
This method allows to pass a @p valuePool which acts as cache, so ancestor paths for the
same @p parentCollection don't have to be parsed twice.
*/
static
void
parseAncestorsCached
(
const
QByteArray
&
data
,
Entity
*
entity
,
Collection
::
Id
parentCollection
,
ProtocolHelperValuePool
*
valuePool
=
0
,
int
start
=
0
);
/**
Parse a collection description.
@param data The input data.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment