[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/akonadi/server
From: Volker Krause <vkrause () kde ! org>
Date: 2009-02-28 22:01:19
Message-ID: 1235858479.456696.29049.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 933428 by vkrause:
New item retrieval code. Much better error handling (compared to none
before) and also fixes a bunch of corner cases that were not handled
correctly so far. Hopefully also fixes thread-safety problems we had
with the old code, but this will require some more testing.
The fetch handler still needs to be changed to use this though.
M +2 -0 CMakeLists.txt
M +11 -2 src/akonadi.cpp
M +2 -0 src/akonadi.h
M +5 -0 src/exception.h
A src/storage/itemretrievalmanager.cpp [License: LGPL (v2+)]
A src/storage/itemretrievalmanager.h [License: LGPL (v2+)]
A src/storage/itemretrievalthread.cpp [License: LGPL (v2+)]
A src/storage/itemretrievalthread.h [License: LGPL (v2+)]
M +2 -4 src/storage/itemretriever.cpp
M +2 -0 src/storage/itemretriever.h
--- trunk/kdesupport/akonadi/server/CMakeLists.txt #933427:933428
@@ -105,6 +105,8 @@
src/storage/dbupdater.cpp
src/storage/itemqueryhelper.cpp
src/storage/itemretriever.cpp
+ src/storage/itemretrievalmanager.cpp
+ src/storage/itemretrievalthread.cpp
src/storage/notificationcollector.cpp
src/storage/query.cpp
src/storage/querybuilder.cpp
--- trunk/kdesupport/akonadi/server/src/akonadi.cpp #933427:933428
@@ -32,9 +32,10 @@
#include "xesammanager.h"
#include "nepomukmanager.h"
#include "debuginterface.h"
+#include "storage/itemretrievalthread.h"
-#include "../libs/xdgbasedirs_p.h"
-#include "../libs/protocol_p.h"
+#include "libs/xdgbasedirs_p.h"
+#include "libs/protocol_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
@@ -56,6 +57,7 @@
: QLocalServer( parent )
, mCacheCleaner( 0 )
, mIntervalChecker( 0 )
+ , mItemRetrievalThread( 0 )
, mDatabaseProcess( 0 )
, mAlreadyShutdown( false )
{
@@ -113,6 +115,9 @@
mIntervalChecker = new IntervalCheck( this );
mIntervalChecker->start( QThread::IdlePriority );
+ mItemRetrievalThread = new ItemRetrievalThread( this );
+ mItemRetrievalThread->start( QThread::HighPriority );
+
mSearchManager = new DummySearchManager;
new ServerAdaptor( this );
@@ -138,6 +143,8 @@
mAlreadyShutdown = true;
+ if ( mItemRetrievalThread )
+ QMetaObject::invokeMethod( mItemRetrievalThread, "quit", Qt::QueuedConnection );
if ( mCacheCleaner )
QMetaObject::invokeMethod( mCacheCleaner, "quit", Qt::QueuedConnection );
if ( mIntervalChecker )
@@ -148,6 +155,8 @@
mCacheCleaner->wait();
if ( mIntervalChecker )
mIntervalChecker->wait();
+ if ( mItemRetrievalThread )
+ mItemRetrievalThread->wait();
delete mSearchManager;
mSearchManager = 0;
--- trunk/kdesupport/akonadi/server/src/akonadi.h #933427:933428
@@ -35,6 +35,7 @@
class AkonadiConnection;
class CacheCleaner;
class AbstractSearchManager;
+class ItemRetrievalThread;
class AKONADIPRIVATE_EXPORT AkonadiServer: public QLocalServer
{
@@ -66,6 +67,7 @@
CacheCleaner *mCacheCleaner;
IntervalCheck *mIntervalChecker;
+ ItemRetrievalThread *mItemRetrievalThread;
QProcess *mDatabaseProcess;
QList< QPointer<AkonadiConnection> > mConnections;
AbstractSearchManager *mSearchManager;
--- trunk/kdesupport/akonadi/server/src/exception.h #933427:933428
@@ -21,6 +21,7 @@
#define AKONADI_EXCEPTION_H
#include <QByteArray>
+#include <QString>
#include <exception>
namespace Akonadi {
@@ -32,6 +33,8 @@
{
public:
Exception( const char *what ) throw() : mWhat( what ) {}
+ Exception( const QByteArray &what ) throw() : mWhat( what ) {}
+ Exception( const QString &what ) throw() : mWhat( what.toUtf8() ) {}
Exception( const Exception &other ) throw() : mWhat( other.what() ) {}
virtual ~Exception() throw() {}
const char* what() const throw() { return mWhat.constData(); }
@@ -45,6 +48,8 @@
{ \
public: \
classname ( const char *what ) throw() : Akonadi::Exception( what ) {} \
+ classname ( const QByteArray &what ) throw() : Akonadi::Exception( what ) {} \
+ classname ( const QString &what ) throw() : Akonadi::Exception( what ) {} \
const char* type() const throw() { return "" #classname; } \
}
--- trunk/kdesupport/akonadi/server/src/storage/itemretriever.cpp #933427:933428
@@ -20,8 +20,8 @@
#include "itemretriever.h"
#include "akonadiconnection.h"
-#include "storage/datastore.h"
#include "storage/itemqueryhelper.h"
+#include "storage/itemretrievalmanager.h"
#include "storage/parthelper.h"
#include "storage/querybuilder.h"
@@ -186,8 +186,7 @@
QStringList missingPayloadIds;
foreach ( const QString &s, missingParts )
missingPayloadIds << s.mid( 4 );
- // TODO: check result
- DataStore::self()->retrieveDataFromResource( pimItemId,
+ ItemRetrievalManager::instance()->requestItemDelivery( pimItemId,
itemQuery.query().value( itemQueryRidColumn ).toString().toUtf8(),
itemQuery.query().value( itemQueryMimeTypeColumn ).toString().toUtf8(),
itemQuery.query().value( itemQueryResouceColumn ).toString(), missingPayloadIds );
@@ -207,4 +206,3 @@
}
qDebug() << "ItemRetriever::exec() done";
}
-
--- trunk/kdesupport/akonadi/server/src/storage/itemretriever.h #933427:933428
@@ -36,6 +36,8 @@
/**
Helper class for retrieving missing items parts from remote resources.
+ Stuff in here happens in the calling thread and does not access shared data.
+
@todo make usable for Fetch by allowing to share queries
*/
class ItemRetriever
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic