diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-19 18:55:21 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-19 18:55:21 +0200 |
commit | 4a14a6fade947aa830d3f21598a4a6ba7316b933 (patch) | |
tree | c6b340bf1c6284e5501d371f65b58e3a69391a26 /common/entitybuffer.cpp | |
parent | 1deac558af4b1c9f04352ede7f8e172f11a70a6b (diff) | |
download | sink-4a14a6fade947aa830d3f21598a4a6ba7316b933.tar.gz sink-4a14a6fade947aa830d3f21598a4a6ba7316b933.zip |
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.
Diffstat (limited to 'common/entitybuffer.cpp')
-rw-r--r-- | common/entitybuffer.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
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 | |||
26 | return mEntity; | 26 | return mEntity; |
27 | } | 27 | } |
28 | 28 | ||
29 | const Sink::Entity &EntityBuffer::entity() | 29 | const Sink::Entity &EntityBuffer::entity() const |
30 | { | 30 | { |
31 | Q_ASSERT(mEntity); | 31 | Q_ASSERT(mEntity); |
32 | return *mEntity; | 32 | return *mEntity; |
@@ -84,3 +84,15 @@ void EntityBuffer::assembleEntityBuffer( | |||
84 | auto entity = Sink::CreateEntity(fbb, metadata, resource, local); | 84 | auto entity = Sink::CreateEntity(fbb, metadata, resource, local); |
85 | Sink::FinishEntityBuffer(fbb, entity); | 85 | Sink::FinishEntityBuffer(fbb, entity); |
86 | } | 86 | } |
87 | |||
88 | Sink::Operation EntityBuffer::operation() const | ||
89 | { | ||
90 | const auto metadataBuffer = readBuffer<Sink::Metadata>(mEntity->metadata()); | ||
91 | return metadataBuffer ? metadataBuffer->operation() : Sink::Operation_Creation; | ||
92 | } | ||
93 | |||
94 | qint64 EntityBuffer::revision() const | ||
95 | { | ||
96 | const auto metadataBuffer = readBuffer<Sink::Metadata>(mEntity->metadata()); | ||
97 | return metadataBuffer ? metadataBuffer->revision() : -1; | ||
98 | } | ||