mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
Initial commit
This commit is contained in:
31
tests/fdb/KvTraits.h
Normal file
31
tests/fdb/KvTraits.h
Normal 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
28
tests/fdb/SetupFDB.h
Normal 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
|
||||
Reference in New Issue
Block a user