Add Cache in CachingStorage
AbandonedPublic

Authored by ervin on Oct 9 2015, 9:27 AM.

Details

Reviewers
bensi

Diff Detail

Repository
R4 Zanshin
Lint
Lint Skipped
Unit
Unit Tests Skipped
bensi updated this revision to Diff 957.Oct 9 2015, 9:27 AM
bensi retitled this revision from to Add Cache in CachingStorage.
bensi updated this object.
bensi edited the test plan for this revision. (Show Details)
bensi added a reviewer: ervin.
bensi set the repository for this revision to R4 Zanshin.
bensi added a project: Zanshin.
ervin requested changes to this revision.Oct 9 2015, 12:14 PM
ervin edited edge metadata.
ervin added inline comments.
src/akonadi/akonadicacheinterface.cpp
95–96 ↗(On Diff #957)

Doesn't really make sense with the above assert, does it?

168 ↗(On Diff #957)

Removing those asserts is a bit annoying for the AkonadiFakeData case though... they are convenient to catch programming errors early.

In the case of the cache they can indeed get in the way since we can have a partial picture of the whole data set.

Not sure how to best keep them but suggestions are welcome.

248 ↗(On Diff #957)

ditto.

src/akonadi/akonadicacheinterface.h
40 ↗(On Diff #957)

That will go away since I push you toward a value based cache. ;-)

src/akonadi/akonadicachejob.cpp
37

Why waste 50 ms here? It's not like we're the FakeJobs trying to simulate latency.

src/akonadi/akonadicachejob.h
25–26

Wrong defines

34

Is it me or this whole file and the accompanying cpp is a duplication of the fake jobs? Any chance to have only one copy?

src/akonadi/akonadicachingstorage.cpp
127

Looks like there's a lot of duplication coming from the fakestorage implementation in here. Any chance to avoid copying so much code?

src/akonadi/akonadicachingstorage.h
77

Here lies the rub... The caches (note the plural) will have to be on the live query side somehow otherwise we'll never free un-needed data from the memory.

That also makes me realize that the comment I made on one of the earlier patches about the dependencies was wrong. You don't want to inject CachingStorage everywhere through the dependency manager like that.

What you want instead is to integrate it only to those queries where it matters. So it will likely be on a case by case basis when LiveQueryHelpers ctor is called.

src/akonadi/akonadilivequeryhelpers.cpp
27–28

We shouldn't know about the cache here I think...

55–56

The cache should be fed from within the caching storage. For instance in the caching storage fetchCollections method you can connect a slot to the job before returning it to feed the cache. It'll be called first before anyone else even tries to access the cache.

This comments holds for all the changes in this file.

src/akonadi/akonadistorage.h
67 ↗(On Diff #957)

Won't be necessary anymore if my other comments are addressed.

src/akonadi/akonadistorageinterface.h
30 ↗(On Diff #957)

ditto.

93 ↗(On Diff #957)

ditto.

tests/testlib/akonadifakestorage.cpp
490 ↗(On Diff #957)

ditto.

tests/testlib/akonadifakestorage.h
65 ↗(On Diff #957)

ditto.

This revision now requires changes to proceed.Oct 9 2015, 12:14 PM
bensi updated this revision to Diff 1118.Oct 30 2015, 10:33 PM
bensi edited edge metadata.
ervin requested changes to this revision.Nov 1 2015, 1:12 PM
ervin edited edge metadata.
ervin added inline comments.
src/akonadi/akonadicachejob.cpp
37

Well, 50 ms was wasteful, but you probably need to emit after going back to the event loop first still, to keep it async(). Otherwise it's all done at start() time which the caller don't necessarily control and might need opportunity to connect() after start() has been called.

src/akonadi/akonadicachejob.h
34

My previous comment still holds.

src/akonadi/akonadicachingstorage.cpp
38

My comment regarding the Cache ctor on the previous patch will likely have an impact here, several potential solutions though, not sure which one is best I'll let you experiment.

127

I think this comment still holds as well.

src/akonadi/akonadilivequeryhelpers.cpp
48

Assuming it would be kept, turning m_cachingStorage into a QScopedPointer would be better.

src/akonadi/akonadilivequeryhelpers.h
63

Space before * not after...

But I'm not sure I see the point of this pointer seeing the code you introduced in the cpp.

src/akonadi/akonadimemorystore.cpp
94

Useless.

168

ditto

252

ditto

src/akonadi/akonadimemorystore.h
37

Would be better in the patch introducing MemoryStore. Also add an empty line after it.

This revision now requires changes to proceed.Nov 1 2015, 1:12 PM
ervin commandeered this revision.Apr 18 2017, 10:08 AM
ervin edited reviewers, added: bensi; removed: ervin.

This step is in the work in my local repository.

ervin abandoned this revision.Apr 18 2017, 10:08 AM