diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-24 23:38:12 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-24 23:38:12 +0100 |
commit | 9b744da32e64d8a6cd342faba8fc3232884d60f2 (patch) | |
tree | a22558b6c869ba777292d3ce231222408614d5b3 /common | |
parent | b36ae2d0e0b0ee9865fdc7e628374853d160b55a (diff) | |
download | sink-9b744da32e64d8a6cd342faba8fc3232884d60f2.tar.gz sink-9b744da32e64d8a6cd342faba8fc3232884d60f2.zip |
Uid index + query using that index.
...and a couple of other fixes.
Diffstat (limited to 'common')
-rw-r--r-- | common/CMakeLists.txt | 1 | ||||
-rw-r--r-- | common/clientapi.h | 2 | ||||
-rw-r--r-- | common/commands/modifyentity.fbs | 4 | ||||
-rw-r--r-- | common/entitybuffer.cpp | 1 | ||||
-rw-r--r-- | common/resourceaccess.cpp | 2 | ||||
-rw-r--r-- | common/storage_lmdb.cpp | 5 |
6 files changed, 11 insertions, 4 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 6f8fee3..3d3a2b7 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt | |||
@@ -32,6 +32,7 @@ set(command_SRCS | |||
32 | storage_common.cpp | 32 | storage_common.cpp |
33 | threadboundary.cpp | 33 | threadboundary.cpp |
34 | messagequeue.cpp | 34 | messagequeue.cpp |
35 | index.cpp | ||
35 | ${storage_SRCS}) | 36 | ${storage_SRCS}) |
36 | 37 | ||
37 | add_library(${PROJECT_NAME} SHARED ${command_SRCS}) | 38 | add_library(${PROJECT_NAME} SHARED ${command_SRCS}) |
diff --git a/common/clientapi.h b/common/clientapi.h index 546f210..659ae91 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -228,7 +228,7 @@ public: | |||
228 | } | 228 | } |
229 | 229 | ||
230 | virtual QVariant getProperty(const QString &key) const { return mAdaptor->getProperty(key); } | 230 | virtual QVariant getProperty(const QString &key) const { return mAdaptor->getProperty(key); } |
231 | virtual void setProperty(const QString &key, const QVariant &value){ mChangeSet.insert(key, value); } | 231 | virtual void setProperty(const QString &key, const QVariant &value){ mChangeSet.insert(key, value); mAdaptor->setProperty(key, value); } |
232 | 232 | ||
233 | private: | 233 | private: |
234 | QSharedPointer<BufferAdaptor> mAdaptor; | 234 | QSharedPointer<BufferAdaptor> mAdaptor; |
diff --git a/common/commands/modifyentity.fbs b/common/commands/modifyentity.fbs index b4edb12..d26051e 100644 --- a/common/commands/modifyentity.fbs +++ b/common/commands/modifyentity.fbs | |||
@@ -3,9 +3,9 @@ namespace Akonadi2; | |||
3 | table ModifyEntity { | 3 | table ModifyEntity { |
4 | revision: ulong; | 4 | revision: ulong; |
5 | entityId: string; | 5 | entityId: string; |
6 | deletions: [string]; | 6 | deletions: [string]; //A list of deleted properties |
7 | domainType: string; | 7 | domainType: string; |
8 | delta: [ubyte]; | 8 | delta: [ubyte]; //Contains an entity buffer with all changed properties set |
9 | } | 9 | } |
10 | 10 | ||
11 | root_type ModifyEntity; | 11 | root_type ModifyEntity; |
diff --git a/common/entitybuffer.cpp b/common/entitybuffer.cpp index 4af84ef..5ba4afe 100644 --- a/common/entitybuffer.cpp +++ b/common/entitybuffer.cpp | |||
@@ -58,7 +58,6 @@ void EntityBuffer::extractResourceBuffer(void *dataValue, int dataSize, const st | |||
58 | 58 | ||
59 | void EntityBuffer::assembleEntityBuffer(flatbuffers::FlatBufferBuilder &fbb, void const *metadataData, size_t metadataSize, void const *resourceData, size_t resourceSize, void const *localData, size_t localSize) | 59 | void EntityBuffer::assembleEntityBuffer(flatbuffers::FlatBufferBuilder &fbb, void const *metadataData, size_t metadataSize, void const *resourceData, size_t resourceSize, void const *localData, size_t localSize) |
60 | { | 60 | { |
61 | qDebug() << "res size: " << resourceSize; | ||
62 | auto metadata = fbb.CreateVector<uint8_t>(static_cast<uint8_t const*>(metadataData), metadataSize); | 61 | auto metadata = fbb.CreateVector<uint8_t>(static_cast<uint8_t const*>(metadataData), metadataSize); |
63 | auto resource = fbb.CreateVector<uint8_t>(static_cast<uint8_t const*>(resourceData), resourceSize); | 62 | auto resource = fbb.CreateVector<uint8_t>(static_cast<uint8_t const*>(resourceData), resourceSize); |
64 | auto local = fbb.CreateVector<uint8_t>(static_cast<uint8_t const*>(localData), localSize); | 63 | auto local = fbb.CreateVector<uint8_t>(static_cast<uint8_t const*>(localData), localSize); |
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 5f04db8..73a01ca 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp | |||
@@ -298,6 +298,7 @@ bool ResourceAccess::processMessageBuffer() | |||
298 | { | 298 | { |
299 | static const int headerSize = Commands::headerSize(); | 299 | static const int headerSize = Commands::headerSize(); |
300 | if (d->partialMessageBuffer.size() < headerSize) { | 300 | if (d->partialMessageBuffer.size() < headerSize) { |
301 | qWarning() << "command too small"; | ||
301 | return false; | 302 | return false; |
302 | } | 303 | } |
303 | 304 | ||
@@ -306,6 +307,7 @@ bool ResourceAccess::processMessageBuffer() | |||
306 | const uint size = *(int*)(d->partialMessageBuffer.constData() + sizeof(int) + sizeof(uint)); | 307 | const uint size = *(int*)(d->partialMessageBuffer.constData() + sizeof(int) + sizeof(uint)); |
307 | 308 | ||
308 | if (size > (uint)(d->partialMessageBuffer.size() - headerSize)) { | 309 | if (size > (uint)(d->partialMessageBuffer.size() - headerSize)) { |
310 | qWarning() << "command too small"; | ||
309 | return false; | 311 | return false; |
310 | } | 312 | } |
311 | 313 | ||
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index bede6aa..b7fbfed 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -218,6 +218,11 @@ bool Storage::write(void const *keyPtr, size_t keySize, void const *valuePtr, si | |||
218 | return false; | 218 | return false; |
219 | } | 219 | } |
220 | 220 | ||
221 | if (!keyPtr || keySize == 0) { | ||
222 | std::cerr << "tried to write empty key." << std::endl; | ||
223 | return false; | ||
224 | } | ||
225 | |||
221 | const bool implicitTransaction = !d->transaction || d->readTransaction; | 226 | const bool implicitTransaction = !d->transaction || d->readTransaction; |
222 | if (implicitTransaction) { | 227 | if (implicitTransaction) { |
223 | if (!startTransaction()) { | 228 | if (!startTransaction()) { |