diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-01 11:10:37 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-01 11:10:37 +0100 |
commit | 44edbee0f0b2fcf13e2ee388a90a8dd1f84a329e (patch) | |
tree | 71d265b2bce5a15981976e334ed182fa6d37c45f /common/index.cpp | |
parent | 377c86144221ffc5b49bdaa9b8dcc3507fe4a50f (diff) | |
download | sink-44edbee0f0b2fcf13e2ee388a90a8dd1f84a329e.tar.gz sink-44edbee0f0b2fcf13e2ee388a90a8dd1f84a329e.zip |
Resolve remoteIds during sync
Remote id's need to be resolved while syncing any references.
This is done by the synchronizer by consulting the rid to entity id
mapping. If the referenced entity doesn't exist yet we create a local
id anyways, that we then need to pick up once the actual entity arrives.
Diffstat (limited to 'common/index.cpp')
-rw-r--r-- | common/index.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/index.cpp b/common/index.cpp index 2fc0fe3..f4de93c 100644 --- a/common/index.cpp +++ b/common/index.cpp | |||
@@ -38,3 +38,16 @@ void Index::lookup(const QByteArray &key, const std::function<void(const QByteAr | |||
38 | ); | 38 | ); |
39 | } | 39 | } |
40 | 40 | ||
41 | QByteArray Index::lookup(const QByteArray &key) | ||
42 | { | ||
43 | QByteArray result; | ||
44 | lookup(key, | ||
45 | [&result](const QByteArray &value) { | ||
46 | result = value; | ||
47 | }, | ||
48 | [](const Index::Error &error) { | ||
49 | qDebug() << "Error while retrieving value" << error.message; | ||
50 | }); | ||
51 | return result; | ||
52 | } | ||
53 | |||