summaryrefslogtreecommitdiffstats
path: root/common/domain/event.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/domain/event.cpp')
-rw-r--r--common/domain/event.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/common/domain/event.cpp b/common/domain/event.cpp
index f3abd62..d801592 100644
--- a/common/domain/event.cpp
+++ b/common/domain/event.cpp
@@ -42,23 +42,28 @@ static QMutex sMutex;
42 42
43using namespace Sink::ApplicationDomain; 43using namespace Sink::ApplicationDomain;
44 44
45void TypeImplementation<Event>::configureIndex(TypeIndex &index)
46{
47 index.addProperty<QByteArray>(Event::Uid::name);
48}
49
45static TypeIndex &getIndex() 50static TypeIndex &getIndex()
46{ 51{
47 QMutexLocker locker(&sMutex); 52 QMutexLocker locker(&sMutex);
48 static TypeIndex *index = 0; 53 static TypeIndex *index = 0;
49 if (!index) { 54 if (!index) {
50 index = new TypeIndex("event"); 55 index = new TypeIndex("event");
51 index->addProperty<QByteArray>("uid"); 56 TypeImplementation<Event>::configureIndex(*index);
52 } 57 }
53 return *index; 58 return *index;
54} 59}
55 60
56void TypeImplementation<Event>::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) 61void TypeImplementation<Event>::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction)
57{ 62{
58 return getIndex().add(identifier, bufferAdaptor, transaction); 63 return getIndex().add(identifier, bufferAdaptor, transaction);
59} 64}
60 65
61void TypeImplementation<Event>::removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) 66void TypeImplementation<Event>::removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction)
62{ 67{
63 return getIndex().remove(identifier, bufferAdaptor, transaction); 68 return getIndex().remove(identifier, bufferAdaptor, transaction);
64} 69}
@@ -83,10 +88,10 @@ QSharedPointer<WritePropertyMapper<TypeImplementation<Event>::BufferBuilder> > T
83 return propertyMapper; 88 return propertyMapper;
84} 89}
85 90
86DataStoreQuery::Ptr TypeImplementation<Event>::prepareQuery(const Sink::Query &query, Sink::Storage::Transaction &transaction) 91DataStoreQuery::Ptr TypeImplementation<Event>::prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr store)
87{ 92{
88 auto mapper = initializeReadPropertyMapper(); 93 auto mapper = initializeReadPropertyMapper();
89 return DataStoreQuery::Ptr::create(query, ApplicationDomain::getTypeName<Event>(), transaction, getIndex(), [mapper](const Sink::Entity &entity, const QByteArray &property) { 94 return DataStoreQuery::Ptr::create(query, ApplicationDomain::getTypeName<Event>(), store, getIndex(), [mapper](const Sink::Entity &entity, const QByteArray &property) {
90 95
91 const auto localBuffer = Sink::EntityBuffer::readBuffer<Buffer>(entity.local()); 96 const auto localBuffer = Sink::EntityBuffer::readBuffer<Buffer>(entity.local());
92 return mapper->getProperty(property, localBuffer); 97 return mapper->getProperty(property, localBuffer);