diff options
author | Aaron Seigo <aseigo@kde.org> | 2014-12-05 10:05:19 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2014-12-05 10:05:19 +0100 |
commit | 93d1c82ffd17df45a5cecd875a01ee3cb15d9983 (patch) | |
tree | cda5c31857362ce81f3a50959024f4270d149a07 /common/storage.h | |
parent | 639fc60c100204c87b93112516cf3b3117cfff0d (diff) | |
parent | 351a66b5fb1c8659bff8ea20d60f5a6d2d3263ad (diff) | |
download | sink-93d1c82ffd17df45a5cecd875a01ee3cb15d9983.tar.gz sink-93d1c82ffd17df45a5cecd875a01ee3cb15d9983.zip |
Merge branch 'kyoto'
Conflicts:
common/storage.h
common/storage_lmdb.cpp
dummyresource/facade.cpp
store/test/CMakeLists.txt
tests/storagebenchmark.cpp
Diffstat (limited to 'common/storage.h')
-rw-r--r-- | common/storage.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/common/storage.h b/common/storage.h new file mode 100644 index 0000000..0b548fb --- /dev/null +++ b/common/storage.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include <string> | ||
4 | #include <QString> | ||
5 | |||
6 | class Storage { | ||
7 | public: | ||
8 | enum TransactionType { ReadOnly, ReadWrite }; | ||
9 | |||
10 | Storage(const QString &storageRoot, const QString &name); | ||
11 | ~Storage(); | ||
12 | bool isInTransaction() const; | ||
13 | bool startTransaction(TransactionType type = ReadWrite); | ||
14 | bool commitTransaction(); | ||
15 | void abortTransaction(); | ||
16 | bool write(const char *key, size_t keySize, const char *value, size_t valueSize); | ||
17 | bool write(const std::string &sKey, const std::string &sValue); | ||
18 | //Perhaps prefer iterators (assuming we need to be able to match multiple values | ||
19 | bool read(const std::string &sKey, const std::function<void(const std::string &value)> &); | ||
20 | bool read(const std::string &sKey, const std::function<void(void *ptr, int size)> &); | ||
21 | |||
22 | qint64 diskUsage() const; | ||
23 | void removeFromDisk() const; | ||
24 | private: | ||
25 | class Private; | ||
26 | Private * const d; | ||
27 | }; | ||
28 | |||