From 573051b8df4a2961b4ba8a1b7e31f1437517f9c8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 9 Feb 2016 15:47:09 +0100 Subject: Moved some API --- common/clientapi.cpp | 8 +++--- common/clientapi.h | 77 +++++++++++++++++++++++++++------------------------- 2 files changed, 44 insertions(+), 41 deletions(-) (limited to 'common') diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 73bc194..e6878a6 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp @@ -160,7 +160,7 @@ KAsync::Job Store::remove(const DomainType &domainObject) }); } -KAsync::Job Store::shutdown(const QByteArray &identifier) +KAsync::Job Resources::shutdown(const QByteArray &identifier) { Trace() << "shutdown " << identifier; auto time = QSharedPointer::create(); @@ -183,7 +183,7 @@ KAsync::Job Store::shutdown(const QByteArray &identifier) .template then([](){}); } -KAsync::Job Store::start(const QByteArray &identifier) +KAsync::Job Resources::start(const QByteArray &identifier) { Trace() << "start " << identifier; auto time = QSharedPointer::create(); @@ -231,7 +231,7 @@ KAsync::Job Store::synchronize(const Sink::Query &query) .template then([](){}); } -KAsync::Job Store::flushMessageQueue(const QByteArrayList &resourceIdentifier) +KAsync::Job Resources::flushMessageQueue(const QByteArrayList &resourceIdentifier) { Trace() << "flushMessageQueue" << resourceIdentifier; return KAsync::iterate(resourceIdentifier) @@ -247,7 +247,7 @@ KAsync::Job Store::flushMessageQueue(const QByteArrayList &resourceIdentif .template then([](){}); } -KAsync::Job Store::flushReplayQueue(const QByteArrayList &resourceIdentifier) +KAsync::Job Resources::flushReplayQueue(const QByteArrayList &resourceIdentifier) { return flushMessageQueue(resourceIdentifier); } diff --git a/common/clientapi.h b/common/clientapi.h index 19d42e0..36c923b 100644 --- a/common/clientapi.h +++ b/common/clientapi.h @@ -36,6 +36,19 @@ namespace Sink { class ResourceAccess; class Notification; +class SINKCOMMON_EXPORT Notifier { +public: + Notifier(const QSharedPointer &resourceAccess); + Notifier(const QByteArray &resourceInstanceIdentifier); + // Notifier(const QByteArrayList &resource); + void registerHandler(std::function); + +private: + class Private; + QSharedPointer d; +}; + + /** * Store interface used in the client API. */ @@ -81,30 +94,6 @@ public: */ static KAsync::Job synchronize(const Sink::Query &query); - /** - * Shutdown resource. - */ - static KAsync::Job shutdown(const QByteArray &resourceIdentifier); - - /** - * Start resource. - * - * The resource is ready for operation once this command completes. - * This command is only necessary if a resource was shutdown previously, - * otherwise the resource process will automatically start as necessary. - */ - static KAsync::Job start(const QByteArray &resourceIdentifier); - - /** - * Flushes any pending messages to disk - */ - static KAsync::Job flushMessageQueue(const QByteArrayList &resourceIdentifier); - - /** - * Flushes any pending messages that haven't been replayed to the source. - */ - static KAsync::Job flushReplayQueue(const QByteArrayList &resourceIdentifier); - /** * Removes a resource from disk. */ @@ -128,21 +117,35 @@ public: }; namespace Resources { - template - KAsync::Job SINKCOMMON_EXPORT inspect(const Inspection &inspectionCommand); -} -class SINKCOMMON_EXPORT Notifier { -public: - Notifier(const QSharedPointer &resourceAccess); - Notifier(const QByteArray &resourceInstanceIdentifier); - // Notifier(const QByteArrayList &resource); - void registerHandler(std::function); +template +KAsync::Job SINKCOMMON_EXPORT inspect(const Inspection &inspectionCommand); -private: - class Private; - QSharedPointer d; -}; +/** + * Shutdown resource. + */ +KAsync::Job SINKCOMMON_EXPORT shutdown(const QByteArray &resourceIdentifier); + +/** + * Start resource. + * + * The resource is ready for operation once this command completes. + * This command is only necessary if a resource was shutdown previously, + * otherwise the resource process will automatically start as necessary. + */ +KAsync::Job SINKCOMMON_EXPORT start(const QByteArray &resourceIdentifier); + +/** + * Flushes any pending messages to disk + */ +KAsync::Job SINKCOMMON_EXPORT flushMessageQueue(const QByteArrayList &resourceIdentifier); + +/** + * Flushes any pending messages that haven't been replayed to the source. + */ +KAsync::Job SINKCOMMON_EXPORT flushReplayQueue(const QByteArrayList &resourceIdentifier); + +} } -- cgit v1.2.3