summaryrefslogtreecommitdiffstats
path: root/common/domain/mail.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-16 14:55:20 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-21 09:02:21 +0200
commit237b9ae4113e7a9f489632296941becb71afdb45 (patch)
tree01cde58f495944f01cad9d282391d4efd2897141 /common/domain/mail.h
parent95d11bf0be98a4e3c08502fe23417b800233ce14 (diff)
downloadsink-237b9ae4113e7a9f489632296941becb71afdb45.tar.gz
sink-237b9ae4113e7a9f489632296941becb71afdb45.zip
Refactor how the storage is used.
This is the initial refactoring to improve how we deal with the storage. It does a couple of things: * Rename Sink::Storage to Sink::Storage::DataStore to free up the Sink::Storage namespace * Introduce a Sink::ResourceContext to have a single object that can be passed around containing everything that is necessary to operate on a resource. This is a lot better than the multiple separate parameters that we used to pass around all over the place, while still allowing for dependency injection for tests. * Tie storage access together using the new EntityStore that directly works with ApplicationDomainTypes. This gives us a central place where main storage, indexes and buffer adaptors are tied together, which will also give us a place to implement external indexes, such as a fulltextindex using xapian. * Use ApplicationDomainTypes as the default way to pass around entities. Instead of using various ways to pass around entities (buffers, buffer adaptors, ApplicationDomainTypes), only use a single way. The old approach was confusing, and was only done as: * optimization; really shouldn't be necessary and otherwise I'm sure we can find better ways to optimize ApplicationDomainType itself. * a way to account for entities that have multiple buffers, a concept that I no longer deem relevant. While this commit does the bulk of the work to get there, the following commits will refactor more stuff to get things back to normal.
Diffstat (limited to 'common/domain/mail.h')
-rw-r--r--common/domain/mail.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/common/domain/mail.h b/common/domain/mail.h
index ea3ef9e..6c1f670 100644
--- a/common/domain/mail.h
+++ b/common/domain/mail.h
@@ -21,7 +21,7 @@
21#include "applicationdomaintype.h" 21#include "applicationdomaintype.h"
22 22
23#include "storage.h" 23#include "storage.h"
24#include "datastorequery.h" 24#include "storage/entitystore.h"
25 25
26class ResultSet; 26class ResultSet;
27class QByteArray; 27class QByteArray;
@@ -32,6 +32,8 @@ class ReadPropertyMapper;
32template<typename T> 32template<typename T>
33class WritePropertyMapper; 33class WritePropertyMapper;
34 34
35class TypeIndex;
36
35namespace Sink { 37namespace Sink {
36 class Query; 38 class Query;
37 39
@@ -46,10 +48,11 @@ class TypeImplementation<Sink::ApplicationDomain::Mail> {
46public: 48public:
47 typedef Sink::ApplicationDomain::Buffer::Mail Buffer; 49 typedef Sink::ApplicationDomain::Buffer::Mail Buffer;
48 typedef Sink::ApplicationDomain::Buffer::MailBuilder BufferBuilder; 50 typedef Sink::ApplicationDomain::Buffer::MailBuilder BufferBuilder;
49 static QSharedPointer<DataStoreQuery> prepareQuery(const Sink::Query &query, Sink::Storage::Transaction &transaction); 51 static void configureIndex(TypeIndex &index);
52 static QSharedPointer<DataStoreQuery> prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr storage);
50 static QSet<QByteArray> indexedProperties(); 53 static QSet<QByteArray> indexedProperties();
51 static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction); 54 static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction);
52 static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction); 55 static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction);
53 static QSharedPointer<ReadPropertyMapper<Buffer> > initializeReadPropertyMapper(); 56 static QSharedPointer<ReadPropertyMapper<Buffer> > initializeReadPropertyMapper();
54 static QSharedPointer<WritePropertyMapper<BufferBuilder> > initializeWritePropertyMapper(); 57 static QSharedPointer<WritePropertyMapper<BufferBuilder> > initializeWritePropertyMapper();
55}; 58};