diff options
-rw-r--r-- | common/inspection.h | 15 | ||||
-rw-r--r-- | common/resourceaccess.cpp | 4 | ||||
-rw-r--r-- | common/resourceaccess.h | 4 | ||||
-rw-r--r-- | common/resourcecontrol.cpp | 2 |
4 files changed, 19 insertions, 6 deletions
diff --git a/common/inspection.h b/common/inspection.h index 7abcd1c..e0321bf 100644 --- a/common/inspection.h +++ b/common/inspection.h | |||
@@ -35,6 +35,7 @@ struct Inspection | |||
35 | inspection.entityIdentifier = entity.identifier(); | 35 | inspection.entityIdentifier = entity.identifier(); |
36 | inspection.property = property; | 36 | inspection.property = property; |
37 | inspection.expectedValue = expectedValue; | 37 | inspection.expectedValue = expectedValue; |
38 | inspection.type = PropertyInspectionType; | ||
38 | return inspection; | 39 | return inspection; |
39 | } | 40 | } |
40 | 41 | ||
@@ -44,18 +45,30 @@ struct Inspection | |||
44 | inspection.resourceIdentifier = entity.resourceInstanceIdentifier(); | 45 | inspection.resourceIdentifier = entity.resourceInstanceIdentifier(); |
45 | inspection.entityIdentifier = entity.identifier(); | 46 | inspection.entityIdentifier = entity.identifier(); |
46 | inspection.expectedValue = exists; | 47 | inspection.expectedValue = exists; |
48 | inspection.type = ExistenceInspectionType; | ||
49 | return inspection; | ||
50 | } | ||
51 | |||
52 | static Inspection CacheIntegrityInspection(const Sink::ApplicationDomain::Entity &entity) | ||
53 | { | ||
54 | Inspection inspection; | ||
55 | inspection.resourceIdentifier = entity.resourceInstanceIdentifier(); | ||
56 | inspection.entityIdentifier = entity.identifier(); | ||
57 | inspection.type = CacheIntegrityInspectionType; | ||
47 | return inspection; | 58 | return inspection; |
48 | } | 59 | } |
49 | 60 | ||
50 | enum Type | 61 | enum Type |
51 | { | 62 | { |
52 | PropertyInspectionType, | 63 | PropertyInspectionType, |
53 | ExistenceInspectionType | 64 | ExistenceInspectionType, |
65 | CacheIntegrityInspectionType | ||
54 | }; | 66 | }; |
55 | QByteArray resourceIdentifier; | 67 | QByteArray resourceIdentifier; |
56 | QByteArray entityIdentifier; | 68 | QByteArray entityIdentifier; |
57 | QByteArray property; | 69 | QByteArray property; |
58 | QVariant expectedValue; | 70 | QVariant expectedValue; |
71 | int type; | ||
59 | }; | 72 | }; |
60 | } | 73 | } |
61 | } | 74 | } |
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 6dcc898..3696a93 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp | |||
@@ -353,7 +353,7 @@ KAsync::Job<void> ResourceAccess::sendRevisionReplayedCommand(qint64 revision) | |||
353 | } | 353 | } |
354 | 354 | ||
355 | KAsync::Job<void> | 355 | KAsync::Job<void> |
356 | ResourceAccess::sendInspectionCommand(const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) | 356 | ResourceAccess::sendInspectionCommand(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) |
357 | { | 357 | { |
358 | flatbuffers::FlatBufferBuilder fbb; | 358 | flatbuffers::FlatBufferBuilder fbb; |
359 | auto id = fbb.CreateString(inspectionId.toStdString()); | 359 | auto id = fbb.CreateString(inspectionId.toStdString()); |
@@ -366,7 +366,7 @@ ResourceAccess::sendInspectionCommand(const QByteArray &inspectionId, const QByt | |||
366 | s << expectedValue; | 366 | s << expectedValue; |
367 | 367 | ||
368 | auto expected = fbb.CreateString(array.toStdString()); | 368 | auto expected = fbb.CreateString(array.toStdString()); |
369 | auto location = Sink::Commands::CreateInspection(fbb, id, 0, entity, domain, prop, expected); | 369 | auto location = Sink::Commands::CreateInspection(fbb, id, inspectionType, entity, domain, prop, expected); |
370 | Sink::Commands::FinishInspectionBuffer(fbb, location); | 370 | Sink::Commands::FinishInspectionBuffer(fbb, location); |
371 | open(); | 371 | open(); |
372 | return sendCommand(Sink::Commands::InspectionCommand, fbb); | 372 | return sendCommand(Sink::Commands::InspectionCommand, fbb); |
diff --git a/common/resourceaccess.h b/common/resourceaccess.h index b9eaacd..82aa4d3 100644 --- a/common/resourceaccess.h +++ b/common/resourceaccess.h | |||
@@ -67,7 +67,7 @@ public: | |||
67 | return KAsync::null<void>(); | 67 | return KAsync::null<void>(); |
68 | }; | 68 | }; |
69 | virtual KAsync::Job<void> | 69 | virtual KAsync::Job<void> |
70 | sendInspectionCommand(const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expecedValue) | 70 | sendInspectionCommand(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expecedValue) |
71 | { | 71 | { |
72 | return KAsync::null<void>(); | 72 | return KAsync::null<void>(); |
73 | }; | 73 | }; |
@@ -103,7 +103,7 @@ public: | |||
103 | KAsync::Job<void> sendDeleteCommand(const QByteArray &uid, qint64 revision, const QByteArray &resourceBufferType) Q_DECL_OVERRIDE; | 103 | KAsync::Job<void> sendDeleteCommand(const QByteArray &uid, qint64 revision, const QByteArray &resourceBufferType) Q_DECL_OVERRIDE; |
104 | KAsync::Job<void> sendRevisionReplayedCommand(qint64 revision) Q_DECL_OVERRIDE; | 104 | KAsync::Job<void> sendRevisionReplayedCommand(qint64 revision) Q_DECL_OVERRIDE; |
105 | KAsync::Job<void> | 105 | KAsync::Job<void> |
106 | sendInspectionCommand(const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expecedValue) Q_DECL_OVERRIDE; | 106 | sendInspectionCommand(int inspectionType,const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expecedValue) Q_DECL_OVERRIDE; |
107 | /** | 107 | /** |
108 | * Tries to connect to server, and returns a connected socket on success. | 108 | * Tries to connect to server, and returns a connected socket on success. |
109 | */ | 109 | */ |
diff --git a/common/resourcecontrol.cpp b/common/resourcecontrol.cpp index ac6ddba..2be9b32 100644 --- a/common/resourcecontrol.cpp +++ b/common/resourcecontrol.cpp | |||
@@ -99,7 +99,7 @@ KAsync::Job<void> ResourceControl::inspect(const Inspection &inspectionCommand) | |||
99 | resourceAccess->open(); | 99 | resourceAccess->open(); |
100 | auto notifier = QSharedPointer<Sink::Notifier>::create(resourceAccess); | 100 | auto notifier = QSharedPointer<Sink::Notifier>::create(resourceAccess); |
101 | auto id = QUuid::createUuid().toByteArray(); | 101 | auto id = QUuid::createUuid().toByteArray(); |
102 | return resourceAccess->sendInspectionCommand(id, ApplicationDomain::getTypeName<DomainType>(), inspectionCommand.entityIdentifier, inspectionCommand.property, inspectionCommand.expectedValue) | 102 | return resourceAccess->sendInspectionCommand(inspectionCommand.type, id, ApplicationDomain::getTypeName<DomainType>(), inspectionCommand.entityIdentifier, inspectionCommand.property, inspectionCommand.expectedValue) |
103 | .template then<void>([resourceAccess, notifier, id, time](KAsync::Future<void> &future) { | 103 | .template then<void>([resourceAccess, notifier, id, time](KAsync::Future<void> &future) { |
104 | notifier->registerHandler([&future, id, time](const Notification ¬ification) { | 104 | notifier->registerHandler([&future, id, time](const Notification ¬ification) { |
105 | if (notification.id == id) { | 105 | if (notification.id == id) { |