1
0
Fork 0
forked from blue/lmdbal

Sessions to manage db open state

This commit is contained in:
Blue 2025-05-06 00:22:03 +03:00
parent 3701fb92a1
commit f9902bc0b1
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
13 changed files with 342 additions and 124 deletions

View file

@ -3,6 +3,7 @@
#include "base.h"
#include "storage.h"
#include "cursor.h"
#include "session.h"
class StorageCursorTest : public ::testing::Test {
protected:
@ -18,7 +19,7 @@ protected:
db = new LMDBAL::Base("testBase");
db->addStorage<uint64_t, std::string>("table1");
db->addStorage<uint64_t, std::string>("empty");
db->open();
session = db->open();
}
}
@ -29,7 +30,7 @@ protected:
static void TearDownTestSuite() {
cursor.drop();
transaction.terminate();
db->close();
session.close();
db->removeDirectory();
delete db;
db = nullptr;
@ -38,6 +39,7 @@ protected:
static LMDBAL::Base* db;
static LMDBAL::Cursor<uint64_t, std::string> cursor;
static LMDBAL::Transaction transaction;
static LMDBAL::Session session;
LMDBAL::Storage<uint64_t, std::string>* table;
LMDBAL::Storage<uint64_t, std::string>* emptyTable;
@ -46,6 +48,7 @@ protected:
LMDBAL::Base* StorageCursorTest::db = nullptr;
LMDBAL::Cursor<uint64_t, std::string> StorageCursorTest::cursor;
LMDBAL::Transaction StorageCursorTest::transaction = LMDBAL::Transaction();
LMDBAL::Session StorageCursorTest::session = LMDBAL::Session();
static const std::map<uint64_t, std::string> data({
{245665783, "bothering nerds"},