summaryrefslogtreecommitdiffstats
path: root/tests/pipelinebenchmark.cpp
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 /tests/pipelinebenchmark.cpp
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 'tests/pipelinebenchmark.cpp')
-rw-r--r--tests/pipelinebenchmark.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/pipelinebenchmark.cpp b/tests/pipelinebenchmark.cpp
index 0c0b9e6..16806c7 100644
--- a/tests/pipelinebenchmark.cpp
+++ b/tests/pipelinebenchmark.cpp
@@ -47,7 +47,7 @@
47 47
48// class IndexUpdater : public Sink::Preprocessor { 48// class IndexUpdater : public Sink::Preprocessor {
49// public: 49// public:
50// void newEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE 50// void newEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::DataStore::Transaction &transaction) Q_DECL_OVERRIDE
51// { 51// {
52// for (int i = 0; i < 10; i++) { 52// for (int i = 0; i < 10; i++) {
53// Index ridIndex(QString("index.index%1").arg(i).toLatin1(), transaction); 53// Index ridIndex(QString("index.index%1").arg(i).toLatin1(), transaction);
@@ -56,11 +56,11 @@
56// } 56// }
57// 57//
58// void modifiedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity, 58// void modifiedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity,
59// Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE 59// Sink::Storage::DataStore::Transaction &transaction) Q_DECL_OVERRIDE
60// { 60// {
61// } 61// }
62// 62//
63// void deletedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE 63// void deletedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, Sink::Storage::DataStore::Transaction &transaction) Q_DECL_OVERRIDE
64// { 64// {
65// } 65// }
66// }; 66// };
@@ -83,9 +83,8 @@ class PipelineBenchmark : public QObject
83 { 83 {
84 TestResource::removeFromDisk(resourceIdentifier); 84 TestResource::removeFromDisk(resourceIdentifier);
85 85
86 auto pipeline = QSharedPointer<Sink::Pipeline>::create(resourceIdentifier); 86 auto pipeline = QSharedPointer<Sink::Pipeline>::create(Sink::ResourceContext{resourceIdentifier, "test"});
87 pipeline->setPreprocessors("mail", preprocessors); 87 pipeline->setPreprocessors("mail", preprocessors);
88 pipeline->setResourceType("test");
89 88
90 QTime time; 89 QTime time;
91 time.start(); 90 time.start();
@@ -112,7 +111,7 @@ class PipelineBenchmark : public QObject
112 // Print memory layout, RSS is what is in memory 111 // Print memory layout, RSS is what is in memory
113 // std::system("exec pmap -x \"$PPID\""); 112 // std::system("exec pmap -x \"$PPID\"");
114 // 113 //
115 std::cout << "Size: " << Sink::Storage(Sink::storageLocation(), resourceIdentifier, Sink::Storage::ReadOnly).diskUsage() / 1024 << " [kb]" << std::endl; 114 std::cout << "Size: " << Sink::Storage::DataStore(Sink::storageLocation(), resourceIdentifier, Sink::Storage::DataStore::ReadOnly).diskUsage() / 1024 << " [kb]" << std::endl;
116 std::cout << "Time: " << allProcessedTime << " [ms]" << std::endl; 115 std::cout << "Time: " << allProcessedTime << " [ms]" << std::endl;
117 116
118 HAWD::Dataset dataset("pipeline", mHawdState); 117 HAWD::Dataset dataset("pipeline", mHawdState);