Initial commit

This commit is contained in:
dev
2025-02-27 21:53:53 +08:00
commit 815e55e4c0
1291 changed files with 185445 additions and 0 deletions

31
tests/fdb/KvTraits.h Normal file
View File

@@ -0,0 +1,31 @@
#pragma once
#include <cstdint>
#include <map>
#include "common/kv/mem/MemKVEngine.h"
#include "fdb/FDBKVEngine.h"
namespace hf3fs::testing {
template <typename KV>
struct KVTrait {};
template <>
struct KVTrait<kv::mem::MemKV> {
using Engine = kv::MemKVEngine;
using State = uint64_t;
using Transaction = kv::MemTransaction;
static constexpr bool kSupportConflictCheck = true;
};
template <>
struct KVTrait<kv::fdb::DB> {
using Engine = kv::FDBKVEngine;
using State = std::map<String, String>;
using Transaction = kv::FDBTransaction;
static constexpr bool kSupportConflictCheck = false;
};
} // namespace hf3fs::testing

28
tests/fdb/SetupFDB.h Normal file
View File

@@ -0,0 +1,28 @@
#pragma once
#include <atomic>
#include <gtest/gtest.h>
#include <memory>
#include <thread>
#include <utility>
#include "fdb/FDB.h"
#include "fdb/FDBConfig.h"
#include "fdb/FDBContext.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::testing {
using namespace hf3fs::kv;
class SetupFDB : public ::testing::Test {
public:
static void SetUpTestSuite() {
static std::once_flag flag;
std::call_once(flag, [] {
static auto context = fdb::FDBContext::create({});
return;
});
}
};
} // namespace hf3fs::testing