Akonadi::Server::PreprocessorManager

Search for usage in LXR

Akonadi::Server::PreprocessorManager Class Reference

#include <preprocessormanager.h>

Inheritance diagram for Akonadi::Server::PreprocessorManager:

Public Member Functions

 PreprocessorManager (Tracer &tracer)
 
 ~PreprocessorManager () override
 
void beginHandleItem (const PimItem &item, const DataStore *dataStore)
 
bool isActive ()
 
bool isEnabled () const
 
void registerInstance (const QString &id)
 
void setEnabled (bool enabled)
 
void unregisterInstance (const QString &id)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

void preProcessorFinishedHandlingItem (PreprocessorInstance *preProcessor, qint64 itemId)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Protected Attributes

bool mEnabled = false
 
QTimermHeartbeatTimer = nullptr
 
QMutex mMutex
 
QList< PreprocessorInstance * > mPreprocessorChain
 
TracermTracer
 
QHash< const DataStore *, std::deque< qint64 > * > mTransactionWaitQueueHash
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 

Detailed Description

The manager for preprocessor agents.

This class takes care of synchronizing the preprocessor agents.

The preprocessors see the incoming PimItem objects before the user can see them (as long as the UI applications honor the hidden attribute). The items are marked as hidden (by the Append and AkAppend handlers) and then enqueued to the preprocessor chain via this class. Once all the preprocessors have done their work the item is unhidden again.

Preprocessing isn't designed for critical tasks. There may be circumstances under that the Akonadi server fails to push an item to all the preprocessors. Most notably after a server restart all the items for that preprocessing was interrupted are just unhidden without any attempt to resume the preprocessor jobs.

The enqueue requests may or may not arrive from "inside" a database transaction. The uncommitted transaction would "hide" the newly created items from the preprocessor instances (which are separate processes). This class, then, takes care of holding the newly arrived items in a wait queue until their transaction is committed (or rolled back).

Definition at line 57 of file preprocessormanager.h.

Constructor & Destructor Documentation

◆ PreprocessorManager()

PreprocessorManager::PreprocessorManager ( Tracer & tracer)
explicit

Creates an instance of PreprocessorManager.

Definition at line 45 of file preprocessormanager.cpp.

◆ ~PreprocessorManager()

PreprocessorManager::~PreprocessorManager ( )
override

Destroys the instance of PreprocessorManager and frees all the relevant resources.

Definition at line 61 of file preprocessormanager.cpp.

Member Function Documentation

◆ beginHandleItem()

void PreprocessorManager::beginHandleItem ( const PimItem & item,
const DataStore * dataStore )

Trigger the preprocessor chain for the specified item.

The item should have been added to the Akonadi database via the specified DataStore object. If the DataStore is in a transaction then this class will put the item in a wait queue until the transaction is committed. If the transaction is rolled back the whole wait queue will be discarded. If the DataStore is not in a transaction then the item will be pushed directly to the preprocessing chain.

You should make sure that the preprocessor chain isActive() before calling this method. The items you pass to this method, also, should have the hidden attribute set.

This function is thread-safe.

Definition at line 165 of file preprocessormanager.cpp.

◆ isActive()

bool PreprocessorManager::isActive ( )

Returns true if preprocessing is active in this Akonadi server.

This means that we have at least one active preprocessor and preprocessing hasn't been explicitly disabled via configuration (so if isActive() returns true then also isEnabled() will return true).

This function is thread-safe.

Definition at line 73 of file preprocessormanager.cpp.

◆ isEnabled()

bool Akonadi::Server::PreprocessorManager::isEnabled ( ) const
inline

Returns true if this preprocessor hasn't been explicitly disabled via setEnabled( false ).

This is used to disable preprocessing via configuration even if we have a valid chain of preprocessors.

Please note that this flag doesn't tell if we actually have some registered preprocessors and thus we can do some meaningful job. You should use isActive() for this purpose.

Definition at line 131 of file preprocessormanager.h.

◆ preProcessorFinishedHandlingItem()

void PreprocessorManager::preProcessorFinishedHandlingItem ( PreprocessorInstance * preProcessor,
qint64 itemId )
protected

This is called by PreprocessorInstance to signal that a certain preprocessor has finished handling an item.

This function is thread-safe.

Definition at line 324 of file preprocessormanager.cpp.

◆ registerInstance()

void PreprocessorManager::registerInstance ( const QString & id)

This is called via D-Bus from AgentManager to register a preprocessor instance.

This function is thread-safe.

Definition at line 94 of file preprocessormanager.cpp.

◆ setEnabled()

void Akonadi::Server::PreprocessorManager::setEnabled ( bool enabled)
inline

Explicitly enables or disables the preprocessing in this Akonadi server.

The PreprocessorManager starts in enabled state but can be disabled at a later stage: this is mainly used to disable preprocessing via configuration.

Please note that setting this to true doesn't interrupt the currently running preprocessing jobs. Anything that was enqueued will be processed anyway. However, in Akonadi this is only invoked very early, when no preprocessors are alive yet.

Definition at line 147 of file preprocessormanager.h.

◆ unregisterInstance()

void PreprocessorManager::unregisterInstance ( const QString & id)

This is called via D-Bus from AgentManager to unregister a preprocessor instance.

This function is thread-safe.

Definition at line 121 of file preprocessormanager.cpp.

Member Data Documentation

◆ mEnabled

bool Akonadi::Server::PreprocessorManager::mEnabled = false
protected

Is preprocessing enabled at all in this Akonadi server instance? This is true by default and can be set via setEnabled().

Mainly used to disable preprocessing via configuration file.

Definition at line 85 of file preprocessormanager.h.

◆ mHeartbeatTimer

QTimer* Akonadi::Server::PreprocessorManager::mHeartbeatTimer = nullptr
protected

The heartbeat timer.

Used mainly to expire preprocessor jobs.

Definition at line 96 of file preprocessormanager.h.

◆ mMutex

QMutex Akonadi::Server::PreprocessorManager::mMutex
protected

The mutex used to protect the internals of this class (mainly the mPreprocessorChain member).

Definition at line 91 of file preprocessormanager.h.

◆ mPreprocessorChain

QList<PreprocessorInstance *> Akonadi::Server::PreprocessorManager::mPreprocessorChain
protected

The preprocessor chain.

The pointers inside the list are owned.

In all the algorithms we assume that this list is actually very short (say 3-4 elements) and reverse lookup (pointer->index) is really fast.

Definition at line 78 of file preprocessormanager.h.

◆ mTracer

Tracer& Akonadi::Server::PreprocessorManager::mTracer
protected

Definition at line 98 of file preprocessormanager.h.

◆ mTransactionWaitQueueHash

QHash<const DataStore *, std::deque<qint64> *> Akonadi::Server::PreprocessorManager::mTransactionWaitQueueHash
protected

The hashtable of transaction wait queues.

There is one wait queue for each DataStore that is currently in a transaction.

Definition at line 69 of file preprocessormanager.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:11:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.