text stringlengths 1 24.5M |
|---|
#pragma once
#include <memory>
#include "common/utils/Address.h"
namespace hf3fs::stubs {
template <typename IStub>
class IStubFactory {
public:
using Stub = IStub;
virtual ~IStubFactory() = default;
virtual std::unique_ptr<IStub> create(net::Address addr) = 0;
};
} // namespace hf3fs::stubs
|
#pragma once
#include "IStubFactory.h"
#include "common/serde/ClientContext.h"
namespace hf3fs::stubs {
using ClientContextCreator = std::function<serde::ClientContext(net::Address)>;
template <template <typename Ctx> typename Stub>
requires requires { typename Stub<serde::ClientContext>::InterfaceType; }
class Real... |
#pragma once
#include <string>
#include <variant>
#include "common/serde/ClientContext.h"
#include "common/serde/ClientMockContext.h"
#include "fbs/mgmtd/MgmtdTypes.h"
namespace hf3fs::stubs {
using flat::NodeId;
template <typename IStub>
struct StubMockContext {};
template <template <typename Ctx> typename StubIm... |
#pragma once
#include <functional>
#include "common/serde/ClientContext.h"
#include "common/utils/RobinHood.h"
#include "stubs/common/Stub.h"
namespace hf3fs::stubs {
template <template <typename Ctx> typename StubImpl, bool SupportsStubStub = false>
class SerdeStubFactory {
public:
using Stub = stubs::SerdeStub... |
#include "CoreServiceStub.h"
#include "common/serde/ClientContext.h"
#include "common/serde/ClientMockContext.h"
#include "fbs/core/service/CoreServiceClient.h"
namespace hf3fs::core {
#define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \
template <typename Ctx> ... |
#pragma once
#include "ICoreServiceStub.h"
namespace hf3fs::core {
template <typename Ctx>
class CoreServiceStub : public ICoreServiceStub {
public:
using ContextType = Ctx;
explicit CoreServiceStub(ContextType ctx)
: ctx_(std::move(ctx)) {}
#define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, re... |
#pragma once
#include "fbs/core/service/Rpc.h"
namespace hf3fs::core {
class ICoreServiceStub {
public:
using InterfaceType = ICoreServiceStub;
virtual ~ICoreServiceStub() = default;
#define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \
virtual CoTryTask<rsptype> name(const reqty... |
#pragma once
#include "common/serde/ClientContext.h"
#include "common/serde/MessagePacket.h"
#include "common/utils/Coroutine.h"
#include "fbs/meta/Common.h"
#include "fbs/meta/Service.h"
namespace hf3fs::meta {
class IMetaServiceStub {
public:
using InterfaceType = IMetaServiceStub;
virtual ~IMetaServiceStub(... |
#include "MetaServiceStub.h"
#include "common/serde/ClientContext.h"
#include "common/serde/ClientMockContext.h"
#include "common/utils/Coroutine.h"
#include "common/utils/UtcTimeSerde.h"
#include "fbs/meta/Service.h"
#define IMPL_META_STUB_METHOD(NAME, REQ, RESP) \
templat... |
#pragma once
#include "common/serde/ClientContext.h"
#include "fbs/meta/Service.h"
#include "stubs/MetaService/IMetaServiceStub.h"
namespace hf3fs::meta {
template <typename Ctx>
class MetaServiceStub : public IMetaServiceStub {
public:
explicit MetaServiceStub(Ctx ctx)
: context_(std::move(ctx)) {}
#defin... |
#pragma once
#include <folly/concurrency/AtomicSharedPtr.h>
#include <optional>
#include "common/serde/ClientContext.h"
#include "common/serde/MessagePacket.h"
#include "common/utils/Coroutine.h"
#include "common/utils/Result.h"
#include "fbs/meta/Service.h"
#include "fbs/mgmtd/ChainRef.h"
#include "stubs/MetaService... |
#pragma once
#include "fbs/mgmtd/Rpc.h"
namespace hf3fs::mgmtd {
class IMgmtdServiceStub {
public:
using InterfaceType = IMgmtdServiceStub;
virtual ~IMgmtdServiceStub() = default;
#define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \
virtual CoTryTask<rsptype> name(const reqtype ... |
#include "MgmtdServiceStub.h"
#include "common/serde/ClientContext.h"
#include "common/serde/ClientMockContext.h"
#include "fbs/mgmtd/MgmtdServiceClient.h"
namespace hf3fs::mgmtd {
#define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \
template <typename Ctx> ... |
#pragma once
#include "IMgmtdServiceStub.h"
namespace hf3fs::mgmtd {
template <typename Ctx>
class MgmtdServiceStub : public IMgmtdServiceStub {
public:
using ContextType = Ctx;
explicit MgmtdServiceStub(ContextType ctx)
: ctx_(std::move(ctx)) {}
#define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, i... |
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/logging/xlog.h>
#include "client/meta/MetaClient.h"
#include "client/mgmtd/MgmtdClientForClient.h"
#include "common/logging/LogInit.h"
#include "common/net/Client.h"
#include "common/net/ib/IBDevice.h"
#include "common/utils/ConfigBase.h"
#include "comm... |
#pragma once
#include "client/meta/MetaClient.h"
namespace hf3fs::tools {
void setDirLayout(meta::client::MetaClient &metaClient, const flat::UserInfo &ui);
void createWithLayout(meta::client::MetaClient &metaClient, const flat::UserInfo &ui);
} // namespace hf3fs::tools
|
#include <folly/experimental/coro/BlockingWait.h>
#include "Commands.h"
#include "Layout.h"
DEFINE_string(path, "", "Path of file/directory to set layout");
DEFINE_bool(create_dir, false, "True to create a directory, false to create a file");
DEFINE_bool(recursive, false, "If to recursively create intermediate direct... |
#include "Layout.h"
DEFINE_int32(chain_table_id, 0, "Chain table id for the file layout");
DEFINE_int32(chain_table_ver, 0, "Chain table for the file layout");
DEFINE_string(chunk_size, "0", "Chunk size for the file layout");
DEFINE_int32(stripe_size, 0, "Stripe size for the file layout");
DEFINE_string(chain_index_li... |
#pragma once
#include <folly/String.h>
#include "fbs/meta/Schema.h"
namespace hf3fs::tools {
meta::Layout layoutFromFlags();
} // namespace hf3fs::tools
|
#include <folly/experimental/coro/BlockingWait.h>
#include "Commands.h"
#include "Layout.h"
DEFINE_string(dir_path, "", "Path of directory to set default layout");
namespace hf3fs::tools {
void setDirLayout(meta::client::MetaClient &metaClient, const flat::UserInfo &ui) {
auto layout = layoutFromFlags();
auto re... |
#include <folly/Random.h>
#include <folly/ScopeGuard.h>
#include <folly/Synchronized.h>
#include <folly/concurrency/AtomicSharedPtr.h>
#include <memory>
#include <set>
#include <vector>
#include "client/mgmtd/ICommonMgmtdClient.h"
#include "client/mgmtd/RoutingInfo.h"
#include "common/app/ClientId.h"
#include "common/... |
#pragma once
#include <folly/experimental/TestUtil.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <gtest/gtest.h>
#define ASSERT_OK(code_to_run) \
do { \
auto &&_status = code_to_run; \
ASSERT_TRUE... |
#include <arrow/io/file.h>
#include <folly/logging/xlog.h>
#include <optional>
#include <parquet/schema.h>
#include "analytics/SerdeObjectReader.h"
#include "analytics/SerdeObjectWriter.h"
#include "fbs/core/user/User.h"
#include "fbs/meta/Schema.h"
#include "fbs/storage/Common.h"
#include "tests/GtestHelpers.h"
name... |
#include <folly/logging/xlog.h>
#include <parquet/schema.h>
#include <string_view>
#include "analytics/SerdeObjectVisitor.h"
#include "fbs/meta/Schema.h"
#include "fbs/storage/Common.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::analytics {
class DebugObjectVisitor : public BaseObjectVisitor<DebugObjectVisitor... |
#include <arrow/io/file.h>
#include <folly/logging/xlog.h>
#include <parquet/schema.h>
#include "analytics/SerdeObjectWriter.h"
#include "fbs/meta/Schema.h"
#include "fbs/storage/Common.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::analytics {
TEST(TestSerdeObjectWriter, ChunkMeta) {
auto writer = SerdeObjec... |
#include <folly/logging/xlog.h>
#include <parquet/schema.h>
#include "analytics/SerdeSchemaBuilder.h"
#include "fbs/meta/Schema.h"
#include "fbs/storage/Common.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::analytics {
using namespace parquet;
TEST(TestSerdeSchemaBuilder, ChunkMeta) {
SerdeSchemaBuilder<stora... |
#include <folly/logging/xlog.h>
#include <parquet/schema.h>
#include "analytics/SerdeStructVisitor.h"
#include "fbs/meta/Schema.h"
#include "fbs/storage/Common.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::analytics {
class DebugStructVisitor : public BaseStructVisitor<DebugStructVisitor> {
public:
// defau... |
#include <folly/logging/xlog.h>
#include "analytics/StructuredTraceLog.h"
#include "common/monitor/ScopedMetricsWriter.h"
#include "fbs/storage/Common.h"
#include "meta/event/Event.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::analytics {
TEST(TestStructuredTraceLog, Open) {
StructuredTraceLog<storage::Stora... |
#pragma once
#include "client/mgmtd/MgmtdClientForServer.h"
#include "stubs/common/RealStubFactory.h"
#include "stubs/mgmtd/MgmtdServiceStub.h"
namespace hf3fs::client {
struct MgmtdClientWithConfig {
MgmtdClient::Config config;
String clusterId;
stubs::ClientContextCreator clientContextCreator;
std::shared_... |
#pragma once
#include "client/mgmtd/MgmtdClientForServer.h"
#include "common/kv/mem/MemKVEngine.h"
#include "meta/service/MetaServer.h"
#include "mgmtd/MgmtdServer.h"
namespace hf3fs {
template <typename ServerT>
struct ServerWithConfig {
typename ServerT::Config config;
String clusterId;
flat::NodeId nodeId;
... |
#include <algorithm>
#include <array>
#include <atomic>
#include <chrono>
#include <cstdint>
#include <fcntl.h>
#include <fmt/core.h>
#include <folly/Random.h>
#include <folly/concurrency/UnboundedQueue.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <fol... |
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Sleep.h>
#include "client/mgmtd/MgmtdClient.h"
#include "fbs/mgmtd/NodeConversion.h"
#include "tests/GtestHelpers.h"
#include "tests/stubs/DummyMgmtdServiceStub.h"
namespace hf3fs::client::tests {
namespace {
class MgmtdClientTest : p... |
#include <chrono>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Sleep.h>
#include "common/kv/mem/MemKVEngine.h"
#include "meta/service/MetaServer.h"
#include "mgmtd/MgmtdServer.h"
#include "stubs/common/RealStubFactory.h"
#include "stubs/mgmtd/MgmtdServiceStub.h"
#include "tests/G... |
#include <folly/experimental/coro/BlockingWait.h>
#include <gtest/gtest.h>
#include <string_view>
#include "common/kv/IKVEngine.h"
#include "common/kv/WithTransaction.h"
#include "common/utils/Coroutine.h"
#include "common/utils/DefaultRetryStrategy.h"
#include "common/utils/Result.h"
#include "tests/GtestHelpers.h"
... |
#include <atomic>
#include <chrono>
#include <folly/Random.h>
#include <folly/concurrency/ConcurrentHashMap.h>
#include <folly/portability/GTest.h>
#include <functional>
#include <thread>
namespace hf3fs::test {
namespace {
struct Dummy {
std::array<uint8_t, 64u> x;
};
TEST(TestConcurrentHashMap, Normal) {
const... |
#include <chrono>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Collect.h>
#include <folly/experimental/coro/CurrentExecutor.h>
#include <folly/experimental/coro/FutureUtil.h>
#include <folly/experimental/coro/Invoke.h>
#include <folly/experimental/coro/Promise.h>
#include <folly/i... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appl... |
#include <chrono>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Collect.h>
#include <folly/experimental/coro/FutureUtil.h>
#include <folly/experimental/coro/Promise.h>
#include <folly/portability/GTest.h>
#include <thread>
#include <vector>
using namespace folly::coro;
TEST(CoroW... |
#include <gtest/gtest.h>
#include <string>
#include "common/kv/KeyPrefix.h"
#include "fdb/FDB.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::tests {
namespace {
TEST(KeyPrefixTest, test) {
ASSERT_EQ(static_cast<uint32_t>(kv::KeyPrefix::Inode), kv::makePrefixValue("INOD"));
ASSERT_EQ(kv::toStr(kv::KeyPrefix::... |
#pragma once
#include <gtest/gtest.h>
#include <memory>
#include <thread>
#include "fdb/FDB.h"
#include "fdb/FDBContext.h"
#include "gtest/gtest.h"
#include "tests/fdb/SetupFDB.h"
namespace hf3fs::kv {
class FDBTestBase : public testing::SetupFDB {
protected:
void SetUp() override {
auto cluster = std::getenv... |
#include <cstdint>
#include <fmt/core.h>
#include <folly/Random.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/logging/xlog.h>
#include <gtest/gtest.h>
#include <optional>
#include <string_view>
#include <unistd.h>
#include <utility>
#include <vector>
#include "FDBTestBase.h"
namespace hf3fs::kv... |
#include <gtest/gtest.h>
#include "FDBTestBase.h"
#include "fdb/FDBKVEngine.h"
namespace hf3fs::kv {
class TestFDBKVEngine : public FDBTestBase {};
TEST_F(TestFDBKVEngine, Construct) {
ASSERT_EQ(db_.error(), 0);
FDBKVEngine engine(std::move(db_));
ASSERT_TRUE(engine.createReadonlyTransaction() != nullptr);
... |
#include <chrono>
#include <cstdint>
#include <folly/CancellationToken.h>
#include <folly/Random.h>
#include <folly/ScopeGuard.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <gtest/gtest.h>
#include <nume... |
#include <double-conversion/utils.h>
#include <folly/Conv.h>
#include <folly/Random.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <gtest/gtest.h>
#include <string>
#include <string_view>
#include "commo... |
#include <folly/json.h>
#include <folly/logging/LogConfig.h>
#include <folly/logging/LogConfigParser.h>
#include <folly/logging/LogLevel.h>
#include <gtest/gtest.h>
#include "common/logging/LogConfig.h"
namespace hf3fs::test {
namespace {
using namespace ::hf3fs::logging;
void checkConfig(std::string config, std::st... |
#include <chrono>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <folly/logging/xlog.h>
#include <gtest/gtest.h>
#include <memory>
#include <optional>
#include <ratio>
#include <thread>
#include <vector>
#include "common/monitor/Monitor.h"
#include "common... |
#include <chrono>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <folly/logging/xlog.h>
#include <gtest/gtest.h>
#include <memory>
#include <optional>
#include <ratio>
#include <thread>
#include <vector>
#include "common/monitor/Monitor.h"
#include "common... |
#include <chrono>
#include <gtest/gtest.h>
#include "common/monitor/Monitor.h"
namespace hf3fs::monitor::test {
namespace {
/*
TEST(TestTaosClient, Normal) {
constexpr auto kInsertCount = 10000;
const std::string kDatabase = "unittest";
TaosClient::Config config;
config.set_db(kDatabase);
TaosClient clien... |
#pragma once
#include "common/net/ib/RDMABuf.h"
#include "common/serde/Service.h"
namespace hf3fs::net::test {
struct EchoReq {
SERDE_STRUCT_FIELD(val, std::string{});
SERDE_STRUCT_FIELD(rdma_bufs, std::vector<RDMARemoteBuf>{});
};
struct EchoRsp {
SERDE_STRUCT_FIELD(val, std::string{});
};
struct HelloReq {... |
#include <chrono>
#include <folly/Random.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/executors/IOThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Collect.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <folly/experimental/c... |
#include <gtest/gtest.h>
#include "common/net/EventLoop.h"
#include "common/net/Network.h"
#include "common/utils/FdWrapper.h"
namespace hf3fs::net::test {
namespace {
TEST(TestEventLoop, Normal) {
auto eventLoop = EventLoop::create();
ASSERT_TRUE(eventLoop->start());
eventLoop->stopAndJoin();
}
TEST(TestEven... |
#include <folly/net/NetworkSocket.h>
#include <gtest/gtest.h>
#include "common/net/IOWorker.h"
#include "common/net/Network.h"
#include "common/net/Processor.h"
#include "common/net/Transport.h"
namespace hf3fs::net {
TEST(TestIOWorker, Normal) {
CPUExecutorGroup procExecutor(2, "");
CPUExecutorGroup ioExecutor(... |
#include <atomic>
#include <cstdint>
#include <folly/experimental/coro/Collect.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <folly/experimental/coro/Sleep.h>
#include <folly/futures/Future.h>
#include <gtest/gtest.h>
#include "common/net/Client.h"
#include "common/net/Network.h"
#include "common/net/S... |
#include "common/net/Client.h"
#include "common/net/RDMAControl.h"
#include "common/net/RequestOptions.h"
#include "common/net/Server.h"
#include "common/serde/ClientContext.h"
#include "tests/GtestHelpers.h"
#include "tests/common/net/ib/SetupIB.h"
namespace hf3fs::net::test {
namespace {
struct RDMAControlService :... |
#include <chrono>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <gtest/gtest.h>
#include <thread>
#include "common/net/Waiter.h"
#include "common/utils/Coroutine.h"
namespace hf3fs::net::test {
namespace {
using namespace std::chrono_literals;
TEST(Test... |
#pragma once
#include <folly/logging/xlog.h>
#include <gtest/gtest.h>
#include "common/net/ib/IBDevice.h"
#include "common/utils/ConfigBase.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::net::test {
class SetupIB : public ::testing::Test {
public:
static void SetUpTestSuite() {
static IBConfig config;
... |
#include <algorithm>
#include <array>
#include <atomic>
#include <chrono>
#include <cstdlib>
#include <fmt/compile.h>
#include <fmt/core.h>
#include <folly/Conv.h>
#include <folly/IPAddressV4.h>
#include <folly/Random.h>
#include <folly/ScopeGuard.h>
#include <folly/String.h>
#include <folly/experimental/coro/GtestHelp... |
#include <chrono>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Collect.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <folly/experimental/coro/Invoke.h>
#include <folly/logging/xlog.h>
#include <gflags/gflags.h>
#include <gtest/gtest.h>
#include <memory>
#include <t... |
#include <algorithm>
#include <atomic>
#include <bits/types/struct_iovec.h>
#include <boost/thread/barrier.hpp>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <fmt/core.h>
#include <folly/IPAddress.h>
#include <folly/IPAddressV4.h>
#include <folly/Random.h>
#include <folly/Range.h>
#include <folly/Sco... |
#include <algorithm>
#include <chrono>
#include <folly/Executor.h>
#include <folly/Random.h>
#include <folly/ScopeGuard.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/executors/IOThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Collect.h>
#... |
#include <atomic>
#include <chrono>
#include <folly/Random.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <gtest/gtest.h>
#include <map>
#include <thread>
#include <vector>
#include "SetupIB.h"
#include "common/net/ib/IBDevice.h"
#include "common/net/ib/... |
#include "common/serde/BigEndian.h"
#include "common/serde/Serde.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::serde::test {
namespace {
TEST(TestSerde, BigEndian) {
{
using BigSize = BigEndian<std::size_t>;
BigSize size{0x123456789ABCDEF0ul};
auto out = serde::serialize(size);
ASSERT_EQ(out.s... |
#include "common/serde/MessagePacket.h"
#include "common/serde/Serde.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::serde::test {
namespace {
struct Demo {
bool operator==(const Demo &) const = default;
SERDE_STRUCT_FIELD(foo, int{}, nullptr);
SERDE_STRUCT_FIELD(bar, std::string{}, nullptr);
};
TEST(Test... |
#include <folly/json.h>
#include "common/serde/Serde.h"
#include "common/utils/DownwardBytes.h"
#include "common/utils/Reflection.h"
#include "common/utils/Result.h"
#include "common/utils/RobinHood.h"
#include "common/utils/StrongType.h"
#include "fbs/mgmtd/RoutingInfo.h"
#include "tests/GtestHelpers.h"
namespace hf... |
#include <folly/container/OrderedMap.h>
#include "common/net/ib/RDMABuf.h"
#include "common/serde/Serde.h"
#include "common/utils/Address.h"
#include "common/utils/Path.h"
#include "common/utils/Result.h"
#include "common/utils/Size.h"
#include "common/utils/StrongType.h"
#include "tests/GtestHelpers.h"
namespace hf3... |
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Sleep.h>
#include <tuple>
#include <type_traits>
#include <utility>
#include "common/net/Client.h"
#include "common/net/Server.h"
#include "common/net/Transport.h"
#include "common/net/WriteItem.h"
#include "common/net/sync/Client.h"
#... |
#include <boost/intrusive/intrusive_fwd.hpp>
#include "common/serde/TypeName.h"
#include "common/utils/Nameof.hpp"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
static_assert(serde::type_name_v<int> == "int");
static_assert(serde::type_name_v<float> == "float");
static_assert(serde::type_name_v... |
#include <folly/json.h>
#include "common/serde/Serde.h"
#include "common/serde/Visit.h"
#include "common/utils/Nameof.hpp"
#include "tests/GtestHelpers.h"
template <>
class hf3fs::serde::VisitOut<void> {
public:
auto tableBegin() { XLOGF(INFO, "start a table"); }
void tableEnd() { XLOGF(INFO, "end a table"); }
... |
#include "common/utils/Address.h"
#include "common/utils/ConfigBase.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::net::test {
namespace {
TEST(TestAddress, Normal) {
constexpr std::string_view str = "IPoIB://192.168.1.1:8000";
auto addr = Address::fromString(str);
ASSERT_TRUE(addr.isTCP());
ASSERT_EQ(ad... |
#include <folly/experimental/coro/GtestHelpers.h>
#include "common/utils/AtomicValue.h"
namespace hf3fs::test {
namespace {
using namespace std::chrono_literals;
TEST(TestAtomicValue, Normal) {
AtomicValue<uint64_t> a;
ASSERT_EQ(a, 0);
a = 1;
ASSERT_EQ(a, 1);
AtomicValue<uint64_t> b = a;
ASSERT_EQ(b, ... |
#include <chrono>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <gtest/gtest.h>
#include <thread>
#include "common/utils/BoundedQueue.h"
#include "common/utils/Coroutine.h"
namespace hf3fs::test {
namespace {
using namespace std::chrono_literals;
TEST(T... |
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/Baton.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Invoke.h>
#include <folly/experimental/coro/Sleep.h>
#include <folly/experimental/coro/Timeout.h>
#include <gtest/gtest.h>
#include "common/u... |
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Timeout.h>
#include "common/utils/ConcurrencyLimiter.h"
#include "common/utils/Duration.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::net::test {
namespace {
TEST(TestConcurrencyLimiter, Normal) {
ConcurrencyLimiterConfig con... |
#include <chrono>
#include <folly/experimental/TestUtil.h>
#include <folly/logging/xlog.h>
#include <gtest/gtest.h>
#include <type_traits>
#include "common/utils/ConfigBase.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
enum class Channel { Red, Green, Blue };
class Config : public ConfigBas... |
#include <folly/executors/CPUThreadPoolExecutor.h>
#include "common/utils/CoroSynchronized.h"
#include "common/utils/CountDownLatch.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
folly::CPUThreadPoolExecutor &getExecutor() {
static folly::CPUThreadPoolExecutor executor(4, std::make_shared<fo... |
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include "common/utils/CoroutinesPool.h"
#include "common/utils/CountDownLatch.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
void testCoroutinesPool(bool enableWorkStealing) {
struct Job {
... |
#include <folly/experimental/coro/BlockingWait.h>
#include <gtest/gtest.h>
#include "common/utils/DefaultRetryStrategy.h"
namespace hf3fs::tests {
namespace {
using namespace std::chrono_literals;
struct MockSleeper {
CoTask<void> operator()(std::chrono::milliseconds d) {
records.push_back(d);
co_return;
... |
#include "common/net/Allocator.h"
#include "common/utils/DownwardBytes.h"
#include "common/utils/Size.h"
#include "tests/GtestHelpers.h"
namespace hf3fs {
namespace {
std::vector<std::pair<size_t, bool>> logger;
struct Allocator {
public:
static constexpr size_t kDefaultSize = 1_MB;
static std::uint8_t *allocat... |
#include <folly/logging/xlog.h>
#include "common/utils/ConfigBase.h"
#include "common/utils/Duration.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
static_assert(config::IsPrimitive<Duration>, "duration is not primitive");
class Config : public ConfigBase<Config> {
CONFIG_HOT_UPDATED_ITEM(... |
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/Baton.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Invoke.h>
#include <folly/experimental/coro/Sleep.h>
#include "common/utils/Duration.h"
#include "common/utils/DynamicCoroutinesPool.h"
#incl... |
#include <atomic>
#include <chrono>
#include <fmt/core.h>
#include <folly/Random.h>
#include <folly/concurrency/UnboundedQueue.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/executors/IOThreadPoolExecutor.h>
#include <folly/experimental/coro/AsyncGenerator.h>
#include <folly/experimental/coro/Bat... |
#include <gtest/gtest.h>
#include "common/utils/FdWrapper.h"
namespace hf3fs::test {
namespace {
TEST(TestFdWrapper, Normal) {
int p[2];
ASSERT_EQ(::pipe(p), 0);
FdWrapper fd;
ASSERT_EQ(fd, -1);
fd = p[0];
fd = FdWrapper{p[1]}; // p[0] is closed.
ASSERT_EQ(fd, p[1]);
fd = FdWrapper{}; // p[1] is... |
#include <fmt/chrono.h>
#include <fmt/format.h>
#include <fmt/ranges.h>
#include <gtest/gtest.h>
namespace hf3fs::tests {
namespace {
TEST(Fmt, testFormat) {
ASSERT_EQ(fmt::format("Hello {}", "world"), "Hello world");
ASSERT_EQ(fmt::format("{}", std::vector<std::string>{"\naan"}), "[\"\\naan\"]");
ASSERT_EQ(fmt:... |
#include <folly/hash/Checksum.h>
#include <folly/logging/xlog.h>
#include "tests/GtestHelpers.h"
namespace hf3fs::tests {
namespace {
TEST(Folly, CRC32C) {
std::string a = "hello";
auto crc1 = folly::crc32c(reinterpret_cast<const uint8_t *>(a.data()), a.size(), 0);
std::string b = "world";
auto crc2 = folly... |
#include <cstdint>
#include <folly/hash/Hash.h>
#include "common/utils/RobinHoodUtils.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
TEST(HashCombine, testUint64) {
for (uint64_t x = 0; x < 64; ++x) {
auto h = folly::hash::hash_combine_generic(RobinHoodHasher{}, x);
fmt::print("x = {... |
#include <algorithm>
#include <atomic>
#include <chrono>
#include <fmt/core.h>
#include <folly/Random.h>
#include <folly/Synchronized.h>
#include <folly/Unit.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/CurrentExecutor.h>
#incl... |
#include <fmt/format.h>
#include <limits>
#include <set>
#include "common/utils/Int128.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
TEST(TestInt128, Normal) {
auto value = std::numeric_limits<uint128_t>::max();
ASSERT_EQ(fmt::format("{}", value), "340282366920938463463374607431768211455... |
#include <fcntl.h>
#include <liburing.h>
#include <liburing/io_uring.h>
#include "common/utils/FdWrapper.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
TEST(TestLibUring, Normal) {
constexpr auto N = 1024;
FdWrapper fd{::open("/dev/zero", O_RDONLY)};
ASSERT_TRUE(fd);
struct io_uring ... |
#include <chrono>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/logging/xlog.h>
#include <mutex>
#include <thread>
#include "common/utils/LockManager.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
using namespace std::chrono_literals;
TEST(TestLockManager, Normal) {
Uni... |
#include <gtest/gtest.h>
#include "common/utils/LruCache.h"
namespace hf3fs::test {
namespace {
TEST(TestLruCache, Normal) {
LruCache<int, int> cache(4);
ASSERT_TRUE(cache.empty());
ASSERT_EQ(cache.size(), 0);
ASSERT_EQ(cache.begin(), cache.end());
cache[1] = 1;
cache[2] = 2;
cache[3] = 3;
cache[4] ... |
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Collect.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <folly/experimental/coro/Sleep.h>
#include <gtest/gtest.h>
#include <thread>
#include "common/utils/Coroutine.h"
#... |
#include <gtest/gtest.h>
#include <memory>
#include "common/utils/MPSCQueue.h"
namespace hf3fs::test {
namespace {
TEST(TestMPSCQueue, Normal) {
constexpr auto N = 4096u;
MPSCQueue<size_t> que(N);
for (auto i = 0u; i < N; ++i) {
auto item = std::make_unique<size_t>(i);
ASSERT_TRUE(que.push(&item));
... |
#include <gtest/gtest.h>
#include "common/utils/ObjectPool.h"
namespace hf3fs::test {
namespace {
TEST(TestObjectPool, Normal) {
constexpr auto X = 123;
static size_t destructTimes = 0;
struct A {
~A() { ++destructTimes; }
int x = X;
};
A *rawPtr = nullptr;
{
auto a = ObjectPool<A>::get();
... |
#include <chrono>
#include <folly/Executor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <gtest/gtest.h>
#include <thread>
#include "common/utils/Coroutine.h"
#include "common/utils/PriorityUnboundedQueue.h"
namespace hf3fs::test {
namespace {
TEST(Te... |
#include <chrono>
#include <folly/logging/xlog.h>
#include <gtest/gtest.h>
#include <mutex>
#include <thread>
#include "common/utils/ReentrantLockManager.h"
namespace hf3fs::test {
namespace {
using namespace std::chrono_literals;
TEST(TestReentrantLockManager, Normal) {
ReentrantLockManager lockManager;
lockMa... |
#include "common/app/AppInfo.h"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
TEST(TestReleaseVersion, testFormat) {
auto rv = flat::ReleaseVersion::fromVersionInfoV0();
ASSERT_EQ(fmt::format("Version: v{}", rv), VersionInfo::fullV0());
rv = flat::ReleaseVersion::fromVersionInfo();
ASSE... |
#include <cstdlib>
#include "common/utils/RenderConfig.h"
#include "common/utils/Toml.hpp"
#include "tests/GtestHelpers.h"
namespace hf3fs::test {
namespace {
String toPrettyToml(const String &s) {
auto t = toml::parse(s);
std::stringstream ss;
ss << toml::toml_formatter(t, toml::toml_formatter::default_flags &... |
#include <atomic>
#include <chrono>
#include <fmt/core.h>
#include <folly/Random.h>
#include <folly/ScopeGuard.h>
#include <folly/concurrency/UnboundedQueue.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/executors/IOThreadPoolExecutor.h>
#include <folly/experimental/coro/AsyncGenerator.h>
#includ... |
#include <gtest/gtest.h>
#include <scn/scn.h>
#include <scn/tuple_return.h>
namespace hf3fs::test {
namespace {
TEST(TestScnlib, ScanString) {
std::string word;
auto result = scn::scan("Hello world!", "{}", word);
ASSERT_EQ(word, "Hello");
ASSERT_EQ(result.range_as_string(), " world!");
}
TEST(TestScnlib, Sc... |
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/experimental/coro/Collect.h>
#include <folly/experimental/coro/GtestHelpers.h>
#include <folly/experimental/coro/Sleep.h>
#include <gtest/gtest.h>
#include <thread>
#include "common/utils/Coroutine.h"
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.