3#include <nlohmann/json.hpp>
6#include "rocksdb/options.h"
7#include "rocksdb/slice.h"
9#include "rocksdb/options.h"
10#include "rocksdb/utilities/transaction_db.h"
14using ROCKSDB_NAMESPACE::PinnableSlice;
15using ROCKSDB_NAMESPACE::ReadOptions;
16using ROCKSDB_NAMESPACE::Status;
17using ROCKSDB_NAMESPACE::WriteBatch;
18using ROCKSDB_NAMESPACE::WriteOptions;
34 Status s =
m_database->Put(WriteOptions(), key, entry);
45 Status s =
m_database->Get(ReadOptions(), hash, &value);
50 std::string dbEntryStr =
GetEntry(key);
51 nlohmann::json dbEntry = nlohmann::json::parse(dbEntryStr);
52 nlohmann::json entryToMerge = nlohmann::json::parse(entry);
53 dbEntry.merge_patch(entryToMerge);
54 std::string combinedEntry = dbEntry.dump();
58 batch.Put(key, combinedEntry);
59 Status s =
m_database->Write(WriteOptions(), &batch);
#define DB_INITIALIZATION
ERRORCODE InitializeDatabase()
std::string UpdateEntry(std::string key, std::string entry)
std::string GetEntry(std::string hash)
BOOL AddEntry(std::string key, std::string entry)
rocksdb::Options m_options
#define PANOPTES_DATABASE_PATH