forked from blue/lmdbal
Sessions to manage db open state
This commit is contained in:
parent
3701fb92a1
commit
f9902bc0b1
13 changed files with 342 additions and 124 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "storage.h"
|
||||
#include "cache.h"
|
||||
#include "cursor.h"
|
||||
#include "session.h"
|
||||
|
||||
class CacheCursorTest : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -19,7 +20,7 @@ protected:
|
|||
db = new LMDBAL::Base("testBase");
|
||||
db->addCache<uint64_t, std::string>("table1");
|
||||
db->addCache<uint64_t, std::string>("empty");
|
||||
db->open();
|
||||
session = db->open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +31,7 @@ protected:
|
|||
static void TearDownTestSuite() {
|
||||
cursor.drop();
|
||||
transaction.terminate();
|
||||
db->close();
|
||||
session.close();
|
||||
db->removeDirectory();
|
||||
delete db;
|
||||
db = nullptr;
|
||||
|
@ -39,6 +40,7 @@ protected:
|
|||
static LMDBAL::Base* db;
|
||||
static LMDBAL::Cursor<uint64_t, std::string> cursor;
|
||||
static LMDBAL::Transaction transaction;
|
||||
static LMDBAL::Session session;
|
||||
|
||||
LMDBAL::Cache<uint64_t, std::string>* cache;
|
||||
LMDBAL::Cache<uint64_t, std::string>* emptyCache;
|
||||
|
@ -47,6 +49,7 @@ protected:
|
|||
LMDBAL::Base* CacheCursorTest::db = nullptr;
|
||||
LMDBAL::Cursor<uint64_t, std::string> CacheCursorTest::cursor;
|
||||
LMDBAL::Transaction CacheCursorTest::transaction;
|
||||
LMDBAL::Session CacheCursorTest::session;
|
||||
|
||||
static const std::map<uint64_t, std::string> data({
|
||||
{245665783, "bothering nerds"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue