2017-05-20 02:57:51 +00:00
|
|
|
#ifndef BOLTDB_H
|
|
|
|
#define BOLTDB_H
|
|
|
|
|
|
|
|
#include "interop.h"
|
2017-05-20 03:47:18 +00:00
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
typedef std::function<void(QByteArray)> NameReciever;
|
2017-05-20 02:57:51 +00:00
|
|
|
|
|
|
|
class BoltDB
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
BoltDB();
|
|
|
|
|
|
|
|
GoInt64 gmsDbRef;
|
|
|
|
|
|
|
|
public:
|
2017-05-25 07:59:53 +00:00
|
|
|
static BoltDB* createFrom(QString filePath, bool readOnly, QString &errorOut);
|
2017-05-20 02:57:51 +00:00
|
|
|
|
2017-05-20 03:47:18 +00:00
|
|
|
bool listBucketsAtRoot(QString& errorOut, NameReciever cb);
|
|
|
|
|
2017-06-19 08:53:50 +00:00
|
|
|
bool listBuckets(const QList<QByteArray>& bucketPath, QString& errorOut, NameReciever cb);
|
2017-05-21 01:31:28 +00:00
|
|
|
|
2017-06-19 08:53:50 +00:00
|
|
|
bool addBucket(const QList<QByteArray>& bucketPath, QByteArray bucketName, QString& errorOut);
|
2017-05-21 05:08:15 +00:00
|
|
|
|
2017-06-19 08:53:50 +00:00
|
|
|
bool deleteBucket(const QList<QByteArray>& bucketPath, QByteArray bucketName, QString& errorOut);
|
2017-05-21 05:08:15 +00:00
|
|
|
|
2017-06-19 08:53:50 +00:00
|
|
|
bool setItem(const QList<QByteArray>& bucketPath, QByteArray keyName, QByteArray value, QString& errorOut);
|
2017-05-21 05:44:07 +00:00
|
|
|
|
2017-06-19 08:53:50 +00:00
|
|
|
bool deleteItem(const QList<QByteArray>& bucketPath, QByteArray keyName, QString& errorOut);
|
2017-05-21 05:44:07 +00:00
|
|
|
|
2017-06-19 08:53:50 +00:00
|
|
|
bool listKeys(const QList<QByteArray>& bucketPath, QString& errorOut, std::function<void(QByteArray, int64_t)> cb);
|
2017-05-21 04:15:49 +00:00
|
|
|
|
2017-06-19 08:53:50 +00:00
|
|
|
bool getData(const QList<QByteArray>& bucketPath, QByteArray key, std::function<void(QByteArray)> onSuccess, std::function<void(QString)> onError);
|
2017-05-21 04:44:44 +00:00
|
|
|
|
2017-05-21 03:49:47 +00:00
|
|
|
bool getStatsJSON(std::function<void(QByteArray)> onSuccess, std::function<void(QString)> onError);
|
2017-05-20 23:59:38 +00:00
|
|
|
|
2017-06-19 08:53:50 +00:00
|
|
|
bool getBucketStatsJSON(const QList<QByteArray>& bucketPath, std::function<void(QByteArray)> onSuccess, std::function<void(QString)> onError);
|
2017-05-21 00:39:55 +00:00
|
|
|
|
2017-05-20 02:57:51 +00:00
|
|
|
~BoltDB();
|
2017-05-21 01:31:28 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool pumpNext(GoInt64 jobRef, QString& errorOut, NameReciever cb);
|
2017-05-20 02:57:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BOLTDB_H
|