[Kde-pim] Review Request: An IMAP parser that (in the future) can be used to write out the payload data to a file as it comes, without the need to store all the data in memory first. As a sideeffect it makes possible to write nicer handler codes.

Andras Mantia amantia at kde.org
Thu Feb 26 09:33:40 GMT 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/191/
-----------------------------------------------------------

(Updated 2009-02-26 01:33:40.186901)


Review request for KDE PIM.


Changes
-------

Added unit test for some methods, fixed bugs found with the unit test, API fix (parseXXX->readXXX), remove some unused code.


Summary
-------

This is the first version of the "streaming" IMAP parser. It works directly on the socket and reads the data from there as it needs it. The data parsing is done only when the handler requests some data using the read*() methods. If the handler doesn't know the real data sequence or it can accept more then one type, it can use the has*() methods to check if the next data is what it wants to be. There is a special case for literals and lists. For literals, it is possible to read it in small sequences (currently 4096 bytes) and this way the sequences can be directly streamed out in a file. For list, there are simple methods to detect a list opening and ending character. The handler can use these and the literal reading to stream out data from lists as well.
Currently the real memory saving is not in effect as the internal m_data is not cleared when the handler reads the data. The idea is to clear whatever it was already parsed, e.g. after each read*() is done.
Some methods like setData, readRemainingData are now in order to make easier the testing and to have a possibility to mix the old handlers and imap parser with the new one. The change in akonadiconnection does exactly that.
The akonadiconnection will change as soon as all handlers are ported and support the ImapStreamParser.
Only one handler is ported, the UID handler. For its subhandlers it read the whole data and passes to them like before. This is more a proof of concept.

PS: Sorry for the whitespace changes in the other files.


Diffs (updated)
-----

  trunk/kdesupport/akonadi/server/CMakeLists.txt 931987 
  trunk/kdesupport/akonadi/server/src/akonadiconnection.h 931987 
  trunk/kdesupport/akonadi/server/src/akonadiconnection.cpp 931987 
  trunk/kdesupport/akonadi/server/src/handler.h 931987 
  trunk/kdesupport/akonadi/server/src/handler.cpp 931987 
  trunk/kdesupport/akonadi/server/src/handler/store.h 931987 
  trunk/kdesupport/akonadi/server/src/handler/store.cpp 931987 
  trunk/kdesupport/akonadi/server/src/handler/uid.h 931987 
  trunk/kdesupport/akonadi/server/src/handler/uid.cpp 931987 
  trunk/kdesupport/akonadi/server/src/imapstreamparser.h PRE-CREATION 
  trunk/kdesupport/akonadi/server/src/imapstreamparser.cpp PRE-CREATION 
  trunk/kdesupport/akonadi/server/tests/unittest/CMakeLists.txt 931987 
  trunk/kdesupport/akonadi/server/tests/unittest/imapstreamparsertest.h PRE-CREATION 
  trunk/kdesupport/akonadi/server/tests/unittest/imapstreamparsertest.cpp PRE-CREATION 

Diff: http://reviewboard.kde.org/r/191/diff


Testing
-------

Tested with kontactmanager, changing an existing (large) entry works, just like before.


Thanks,

Andras

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list