File indexing completed on 2024-05-12 05:26:03

0001 /*
0002  * Copyright (C) 2015 Christian Mollekopf <chrigi_1@fastmail.fm>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) version 3, or any
0008  * later version accepted by the membership of KDE e.V. (or its
0009  * successor approved by the membership of KDE e.V.), which shall
0010  * act as a proxy defined in Section 6 of version 3 of the license.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public
0018  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0019  */
0020 
0021 #pragma once
0022 
0023 #include "sink_export.h"
0024 #include <QByteArray>
0025 
0026 #include <KAsync/Async>
0027 
0028 #include "inspection.h"
0029 #include "flush.h"
0030 
0031 namespace Sink {
0032 namespace ResourceControl {
0033 
0034 KAsync::Job<void> SINK_EXPORT inspect(const Inspection &inspectionCommand, const QByteArray &domainType = {});
0035 
0036 template <class DomainType>
0037 KAsync::Job<void> SINK_EXPORT inspect(const Inspection &inspectionCommand)
0038 {
0039     return inspect(inspectionCommand, ApplicationDomain::getTypeName<DomainType>());
0040 }
0041 
0042 /**
0043  * Shutdown resource.
0044  */
0045 KAsync::Job<void> SINK_EXPORT shutdown(const QByteArray &resourceIdentifier);
0046 
0047 /**
0048  * Start resource.
0049  *
0050  * The resource is ready for operation once this command completes.
0051  * This command is only necessary if a resource was shutdown previously,
0052  * otherwise the resource process will automatically start as necessary.
0053  */
0054 KAsync::Job<void> SINK_EXPORT start(const QByteArray &resourceIdentifier);
0055 
0056 /**
0057  * Flushes any pending messages to disk
0058  */
0059 KAsync::Job<void> SINK_EXPORT flushMessageQueue(const QByteArrayList &resourceIdentifier);
0060 KAsync::Job<void> SINK_EXPORT flushMessageQueue(const QByteArray &resourceIdentifier);
0061 
0062 /**
0063  * Flushes any pending messages that haven't been replayed to the source.
0064  */
0065 KAsync::Job<void> SINK_EXPORT flushReplayQueue(const QByteArrayList &resourceIdentifier);
0066 KAsync::Job<void> SINK_EXPORT flushReplayQueue(const QByteArray &resourceIdentifier);
0067 
0068 KAsync::Job<void> SINK_EXPORT flush(Flush::FlushType, const QByteArray &resourceIdentifier);
0069 
0070 }
0071 }