From 4a14a6fade947aa830d3f21598a4a6ba7316b933 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 19 Sep 2016 18:55:21 +0200 Subject: Refactored the query part of the entity reader into DataStoreQuery. DataStoreQuery now encapsulates the low-level query that operates directly on the storage. It no longer has access to the resource buffers, and is instantiated by the type implementation, so we can specialize the query alogorithm per type, but not per resource. This will allow us to implement the threading queries for the mailtype. --- common/entitybuffer.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'common/entitybuffer.cpp') diff --git a/common/entitybuffer.cpp b/common/entitybuffer.cpp index 950bc46..32583cc 100644 --- a/common/entitybuffer.cpp +++ b/common/entitybuffer.cpp @@ -26,7 +26,7 @@ bool EntityBuffer::isValid() const return mEntity; } -const Sink::Entity &EntityBuffer::entity() +const Sink::Entity &EntityBuffer::entity() const { Q_ASSERT(mEntity); return *mEntity; @@ -84,3 +84,15 @@ void EntityBuffer::assembleEntityBuffer( auto entity = Sink::CreateEntity(fbb, metadata, resource, local); Sink::FinishEntityBuffer(fbb, entity); } + +Sink::Operation EntityBuffer::operation() const +{ + const auto metadataBuffer = readBuffer(mEntity->metadata()); + return metadataBuffer ? metadataBuffer->operation() : Sink::Operation_Creation; +} + +qint64 EntityBuffer::revision() const +{ + const auto metadataBuffer = readBuffer(mEntity->metadata()); + return metadataBuffer ? metadataBuffer->revision() : -1; +} -- cgit v1.2.3