identt
StoreLevel.hpp
Go to the documentation of this file.
1 
33 #ifndef _IDENTT_STORE_STORELEVEL_HPP_
34 #define _IDENTT_STORE_STORELEVEL_HPP_
35 
36 #include <store/StoreBase.hpp>
37 
38 #ifdef IDENTT_BUILD_WITH_LEVELDB
39 #include <leveldb/db.h>
40 #include <leveldb/write_batch.h>
41 namespace usemydb = ::leveldb;
42 #elif IDENTT_BUILD_WITH_ROCKSDB
43 #include <rocksdb/db.h>
44 namespace usemydb = ::rocksdb;
45 #endif
46 
47 namespace identt {
48 namespace store {
49 class StoreLevel : virtual public StoreBase {
50 public:
51 #ifdef IDENTT_BUILD_WITH_LEVELDB
52  using dbpointer=std::shared_ptr<leveldb::DB>;
53 #elif IDENTT_BUILD_WITH_ROCKSDB
54  using dbpointer=std::shared_ptr<rocksdb::DB>;
55 #endif
56 
64  StoreLevel(dbpointer trydb);
65 
70  StoreLevel(const StoreLevel&) = delete;
71  StoreLevel& operator=(const StoreLevel&) = delete;
72 
73 
92  void Initialize(const std::string datadir, const size_t cache_in_mb, uint64_t& last_pkey, uint64_t& last_lkey);
93 
100  dbpointer getDB();
101 
102 protected:
103  dbpointer db;
104 
105 };
106 } // namespace store
107 } // namespace identt
108 #endif /* _IDENTT_STORE_STORELEVEL_HPP_ */
Definition: StoreLevel.hpp:49
Definition: StoreBase.hpp:58
Definition: CryptoBase.hpp:49
StoreLevel(dbpointer trydb)
Constructor.
Definition: StoreLevel.cc:58
dbpointer getDB()
getDB: Get shared pointer to DB
Definition: StoreLevel.cc:155
void Initialize(const std::string datadir, const size_t cache_in_mb, uint64_t &last_pkey, uint64_t &last_lkey)
Initialize: init main db.
Definition: StoreLevel.cc:65