text
stringlengths
1
24.5M
/* * 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 "common/logging/FileHandlerFactory.h" #include <folly/logging/FileWriterFactory.h> #include <folly/logging/LogHandler.h> #include <folly/logging/StandardLogHandler.h> #include <folly/logging/StandardLogHandlerFactory.h> #include <memory> #include "common/logging/FileWriterFactory.h" #include "common/logging/...
#pragma once #include <folly/Range.h> #include <folly/logging/LogHandler.h> #include <folly/logging/LogHandlerFactory.h> #include <memory> namespace hf3fs::logging { class FileHandlerFactory : public folly::LogHandlerFactory { public: folly::StringPiece getType() const override { return "file"; } std::shared_pt...
#include "FileHelper.h" #include <folly/FileUtil.h> #include <folly/String.h> #include <folly/logging/LoggerDB.h> namespace hf3fs::logging { FileHelper::~FileHelper() { close(); } void FileHelper::open(const std::string &fname, bool truncate) { close(); filename_ = fname; if (truncate) { // Truncate by o...
#pragma once #include <folly/File.h> #include <tuple> namespace hf3fs::logging { class FileHelper { public: FileHelper() = default; FileHelper(const FileHelper &) = delete; FileHelper &operator=(const FileHelper &) = delete; ~FileHelper(); void open(const std::string &fname, bool truncate = false); vo...
#include "FileWriterFactory.h" #include <folly/Conv.h> #include <folly/File.h> #include "AsyncFileWriter.h" #include "ImmediateFileWriter.h" #include "RotatingFile.h" #include "SingleFile.h" namespace hf3fs::logging { namespace { size_t getPositiveSize(folly::StringPiece v) { auto size = folly::to<size_t>(v); if...
#pragma once #include <folly/logging/StandardLogHandlerFactory.h> #include <optional> namespace hf3fs::logging { class FileWriterFactory : public folly::StandardLogHandlerFactory::WriterFactory { public: bool processOption(folly::StringPiece name, folly::StringPiece value) override; std::shared_ptr<folly::LogWr...
/* * 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...
/* * 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...
#pragma once #include <folly/FileUtil.h> #include <string> namespace hf3fs::logging { class IWritableFile { public: virtual ~IWritableFile() = default; virtual bool ttyOutput() const = 0; virtual std::string desc() const = 0; virtual ssize_t writevFull(iovec *iov, int count) = 0; virtual ssize_t writeFull...
#include "LogConfig.h" #include <algorithm> #include <cctype> #include <fmt/format.h> #include <fmt/ranges.h> #include <folly/dynamic.h> #include <folly/json.h> #include <folly/logging/xlog.h> #include <utility> #include <vector> #include "common/utils/MagicEnum.hpp" namespace hf3fs::logging { namespace { String to...
#pragma once #include <folly/logging/LogCategoryConfig.h> #include <folly/logging/LogLevel.h> #include <vector> #include "common/utils/ConfigBase.h" #include "common/utils/Size.h" #include "common/utils/String.h" namespace hf3fs::logging { struct LogLevel { LogLevel() = default; LogLevel(folly::LogLevel l) ...
#include "common/logging/LogFormatter.h" #include <fmt/chrono.h> #include <fmt/core.h> #include <folly/logging/LogMessage.h> #include <folly/system/ThreadId.h> #include <folly/system/ThreadName.h> namespace hf3fs::logging { namespace { std::string_view getLevelName(folly::LogLevel level) { if (level < folly::LogLev...
#pragma once #include <folly/logging/LogCategory.h> #include <folly/logging/LogFormatter.h> #include <folly/logging/LogMessage.h> #include <folly/logging/StandardLogHandlerFactory.h> namespace hf3fs::logging { class LogFormatter : public folly::LogFormatter { public: std::string formatMessage(const folly::LogMessa...
#pragma once #include <folly/logging/xlog.h> namespace hf3fs::logging { // set logging level to ERR if the specified condition is evaluated to be true #define ERRLOGF_IF(level, cond, fmt, ...) \ do { \ XLOGF_IF(ERR, cond, fmt __VA_OPT__...
#include "common/logging/LogInit.h" #include <folly/logging/Init.h> #include <folly/logging/LoggerDB.h> #include <memory> #include "common/logging/FileHandlerFactory.h" namespace hf3fs::logging { namespace { bool tryInitLogHandlers() { static auto inited = [] { folly::LoggerDB::get().registerHandlerFactory(std...
#pragma once #include "common/utils/String.h" namespace hf3fs::logging { void initLogHandlers(); bool init(const String &config); void initOrDie(const String &config); } // namespace hf3fs::logging
#include "RotatingFile.h" #include <stdexcept> #include <thread> #include "common/utils/Path.h" namespace hf3fs::logging { namespace { std::string genFilename(const std::string &base, size_t index) { if (index == 0) return base; auto [basename, ext] = FileHelper::splitByExtension(base); return fmt::format("{}...
#pragma once #include <mutex> #include "FileHelper.h" #include "IWritableFile.h" namespace hf3fs::logging { class RotatingFile : public IWritableFile { public: struct Options { size_t maxFiles = 0; size_t maxFileSize = 0; bool rotateOnOpen = false; }; RotatingFile(std::string path, const Options ...
#include "SingleFile.h" #include <fmt/format.h> #include <folly/FileUtil.h> namespace hf3fs::logging { bool SingleFile::ttyOutput() const { return isatty(file_.fd()); } std::string SingleFile::desc() const { return fmt::format("fd({})", file_.fd()); } ssize_t SingleFile::writevFull(iovec *iov, int count) { return f...
#pragma once #include <folly/File.h> #include "IWritableFile.h" namespace hf3fs::logging { class SingleFile : public IWritableFile { public: SingleFile(folly::File &&file) : file_(std::move(file)) {} bool ttyOutput() const override; std::string desc() const override; ssize_t writevFull(iovec *iov, in...
#include "common/monitor/ClickHouseClient.h" #include <clickhouse/client.h> #include <folly/sorted_vector_types.h> namespace hf3fs::monitor { ClickHouseClient::ClickHouseClient(const Config &config) : config_(config) {} ClickHouseClient::~ClickHouseClient() = default; Result<Void> ClickHouseClient::init() { ...
#pragma once #include "common/monitor/Reporter.h" #include "common/monitor/Sample.h" #include "common/utils/ConfigBase.h" namespace clickhouse { class Client; } // namespace clickhouse namespace hf3fs::monitor { class ClickHouseClient : public Reporter { public: struct Config : ConfigBase<Config> { CONFIG_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...
/* * 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 "common/monitor/LogReporter.h" #include <folly/logging/xlog.h> #include <regex> #include "common/utils/Size.h" namespace hf3fs::monitor { Result<Void> LogReporter::init() { auto ignore = config_.ignore(); if (!ignore.empty()) { ignore_ = std::regex(ignore); } return Void{}; } Result<Void> LogR...
#pragma once #include <regex> #include "common/monitor/Reporter.h" #include "common/utils/ConfigBase.h" namespace hf3fs::monitor { class LogReporter : public Reporter { public: struct Config : ConfigBase<Config> { CONFIG_ITEM(ignore, std::string{}); }; LogReporter(const Config &config) : config_(c...
#ifdef OVERRIDE_CXX_NEW_DELETE #undef OVERRIDE_CXX_NEW_DELETE #endif #include "common/monitor/Monitor.h" #include <chrono> #include <folly/Synchronized.h> #include <folly/logging/xlog.h> #include <folly/system/ThreadName.h> #include <map> #include <memory> #include <optional> #include <string> #include <vector> #inc...
#pragma once #include <atomic> #include <condition_variable> #include <folly/ProducerConsumerQueue.h> #include <mutex> #include <shared_mutex> #include "common/monitor/ClickHouseClient.h" #include "common/monitor/LogReporter.h" #include "common/monitor/MonitorCollectorClient.h" #include "common/monitor/Recorder.h" #i...
#include "common/monitor/MonitorCollectorClient.h" #include <folly/experimental/coro/BlockingWait.h> #include <folly/logging/xlog.h> #include "common/utils/Address.h" #include "fbs/monitor_collector/MonitorCollectorService.h" namespace hf3fs::monitor { Result<Void> MonitorCollectorClient::init() { auto serverAddr...
#pragma once #include "common/monitor/LogReporter.h" #include "common/monitor/Reporter.h" #include "common/monitor/Sample.h" #include "common/net/Client.h" #include "common/utils/Address.h" #include "common/utils/ConfigBase.h" namespace hf3fs::monitor { class MonitorCollectorClient : public Reporter { public: str...
#include "common/monitor/Recorder.h" #include <algorithm> #include <folly/Likely.h> #include <folly/logging/xlog.h> #include <optional> #include <string> #include <string_view> #include <utility> #include "common/monitor/Monitor.h" #include "common/monitor/Sample.h" namespace hf3fs::monitor { using namespace std::c...
#pragma once #include <atomic> #include <folly/Memory.h> #include <folly/ThreadLocal.h> #include <folly/concurrency/ConcurrentHashMap.h> #include <folly/container/HeterogeneousAccess.h> #include <folly/stats/DigestBuilder.h> #include <folly/stats/TDigest.h> #include <functional> #include <memory> #include <mutex> #inc...
#pragma once #include <vector> #include "common/monitor/Sample.h" #include "common/utils/Result.h" namespace hf3fs::monitor { class Reporter { public: virtual ~Reporter() = default; virtual Result<Void> init() = 0; virtual Result<Void> commit(const std::vector<Sample> &samples) = 0; }; } // namespace hf3fs...
#pragma once #include <folly/hash/Hash.h> #include <folly/sorted_vector_types.h> #include <functional> #include <string> #include <utility> #include <variant> #include "common/serde/Serde.h" #include "common/utils/UtcTime.h" namespace hf3fs::monitor { class TagSet { public: using Map = folly::sorted_vector_map<s...
#pragma once #include "Recorder.h" namespace hf3fs::monitor { class ScopedCounterWriter { public: ScopedCounterWriter(monitor::DistributionRecorder &recorder, std::atomic_int64_t &counter, int64_t value, const monitor::TagSet &tagSet) : recor...
/* #include "common/monitor/TaosClient.h" #include <chrono> #include <folly/logging/xlog.h> #include <mutex> #include <taos.h> #include <taoserror.h> #include "common/utils/Size.h" namespace hf3fs::monitor { static std::once_flag initOnce; Result<Void> TaosClient::init() { Result<Void> initResult = Void{}; std...
#pragma once #include "common/monitor/Reporter.h" #include "common/monitor/Sample.h" #include "common/utils/ConfigBase.h" namespace hf3fs::monitor { class TaosClient : public Reporter { public: struct Config : ConfigBase<Config> { CONFIG_ITEM(host, ""); CONFIG_ITEM(user, ""); CONFIG_ITEM(passwd, ""); ...
#pragma once #include <folly/Likely.h> #include <memory> #include <utility> #include "common/utils/ObjectPool.h" namespace hf3fs::net { // A memory allocator with TLS cache support. template <size_t DefaultSize = 1_KB, size_t NumTLSCachedItem = 1024, size_t NumGlobalCachedItem = 64 * 1024> class Allocator { public...
#pragma once #include <folly/concurrency/AtomicSharedPtr.h> #include <optional> #include "common/net/IOWorker.h" #include "common/net/Processor.h" #include "common/net/RDMAControl.h" #include "common/net/ThreadPoolGroup.h" #include "common/serde/ClientContext.h" #include "common/utils/ConfigBase.h" #include "common/u...
#include "common/net/EventLoop.h" #include <folly/Random.h> #include <folly/logging/xlog.h> #include <sys/epoll.h> #include <sys/eventfd.h> #include "common/net/Network.h" #include "common/utils/Size.h" namespace hf3fs::net { Result<Void> EventLoop::start(const std::string &threadName) { // 1. init epoll fd. ep...
#pragma once #include <folly/concurrency/UnboundedQueue.h> #include <list> #include <memory> #include <sys/epoll.h> #include <thread> #include "common/utils/FdWrapper.h" #include "common/utils/Result.h" #include "common/utils/TypeTraits.h" namespace hf3fs::net { // EventLoop provides a main loop that notifies Event...
#pragma once #include <cerrno> #include <folly/FBString.h> #include <folly/IPAddressV4.h> #include <folly/Range.h> #include <folly/experimental/Bits.h> #include <folly/logging/xlog.h> #include <folly/system/Shell.h> #include <ifaddrs.h> #include <map> #include <net/if.h> #include <sys/ioctl.h> #include <vector> #incl...
#include "common/net/IOWorker.h" #include <folly/Executor.h> #include <folly/experimental/coro/Sleep.h> #include <memory> #include "common/net/Transport.h" #include "common/net/tcp/TcpSocket.h" #include "common/utils/Address.h" namespace hf3fs::net { Result<Void> IOWorker::start(const std::string &name) { return ev...
#pragma once #include <folly/Executor.h> #include <folly/Synchronized.h> #include <folly/concurrency/AtomicSharedPtr.h> #include <folly/executors/IOThreadPoolExecutor.h> #include <folly/net/NetworkSocket.h> #include <memory> #include "common/net/EventLoop.h" #include "common/net/Network.h" #include "common/net/Proces...
#include "common/net/Listener.h" #include <atomic> #include <boost/filesystem/operations.hpp> #include <chrono> #include <fmt/format.h> #include <folly/ScopeGuard.h> #include <folly/executors/CPUThreadPoolExecutor.h> #include <folly/experimental/coro/AsyncGenerator.h> #include <folly/experimental/coro/BlockingWait.h> ...
#pragma once #include <atomic> #include <folly/io/coro/ServerSocket.h> #include <thread> #include "common/net/IOWorker.h" #include "common/net/Network.h" #include "common/net/Transport.h" #include "common/net/ib/IBConnectService.h" #include "common/net/ib/IBSocket.h" #include "common/utils/ConfigBase.h" namespace hf...
#include "common/net/MessageHeader.h" #include "common/net/Allocator.h" namespace hf3fs::net { namespace { using InnerAllocator = net::Allocator<kMessageReadBufferSize, 64, 64 * 64>; // at most 128MB in global cache. void freeFunction(void *buf, void *userData) { InnerAllocator::deallocate(reinterpret_cast<uint8_...
#pragma once #include <bit> #include <cstdint> #include <folly/hash/Checksum.h> #include <type_traits> #include "common/net/Network.h" #include "common/utils/Size.h" namespace hf3fs::net { constexpr uint32_t kMessageHeaderSize = 8u; constexpr uint8_t kSerdeMessageMagicNum = 0x86; // The most extreme case of storage...
#pragma once #include <fmt/core.h> #include <folly/executors/CPUThreadPoolExecutor.h> #include <folly/hash/Hash.h> #include <folly/io/async/EventBase.h> #include <folly/io/coro/ServerSocket.h> #include <folly/io/coro/Transport.h> #include <folly/logging/xlog.h> #include <folly/net/NetworkSocket.h> #include <netinet/in...
#pragma once #include "common/utils/String.h" namespace hf3fs::net { struct PeerInfo { String str; }; } // namespace hf3fs::net
#include "common/net/Processor.h" #include "common/monitor/Recorder.h" namespace hf3fs::net { namespace { monitor::CountRecorder compressedCount{"common.rpc.compressed_count"}; monitor::CountRecorder compressedBytes{"common.rpc.compressed_bytes"}; monitor::CountRecorder decompressedBytes{"common.rpc.decompressed_byt...
#pragma once #include <atomic> #include <folly/executors/CPUThreadPoolExecutor.h> #include <folly/experimental/coro/ViaIfAsync.h> #include <limits> #include <thread> #include "common/net/MessageHeader.h" #include "common/net/Network.h" #include "common/net/Transport.h" #include "common/net/Waiter.h" #include "common/...
#include "common/net/RDMAControl.h" #include "common/monitor/Recorder.h" #include "common/net/Waiter.h" #include "common/net/ib/IBSocket.h" #include "common/serde/ClientContext.h" #include "common/utils/Duration.h" namespace hf3fs::net { namespace { monitor::ValueRecorder currentRDMATransmission{"common.rdma_control...
#pragma once #include "common/serde/CallContext.h" #include "common/serde/Service.h" #include "common/utils/ConfigBase.h" #include "common/utils/Semaphore.h" namespace hf3fs::net { struct RDMATransmissionReq { SERDE_STRUCT_FIELD(uuid, size_t{}); }; struct RDMATransmissionRsp { SERDE_STRUCT_FIELD(dummy, Void{});...
#pragma once #include <utility> #include "common/serde/Serde.h" #include "common/utils/Duration.h" #include "common/utils/Size.h" namespace hf3fs::net { constexpr Duration kClientRequestDefaultTimeout = 1000_ms; constexpr Duration kClientRequestLogLongRunningThreshold = 0_ms; constexpr uint32_t kDefaultMaxRetryTime...
#include "common/net/Server.h" #include <fmt/core.h> #include <iterator> #include "common/net/ib/IBDevice.h" #include "common/utils/LogCommands.h" namespace hf3fs::net { Server::Server(const Config &config) : config_(config), tpg_("Svr", config_.thread_pool()), independentTpg_("SvrI", config_.indepe...
#pragma once #include <algorithm> #include <folly/Random.h> #include <folly/experimental/coro/Invoke.h> #include <folly/logging/xlog.h> #include <memory> #include <vector> #include "common/app/AppInfo.h" #include "common/net/ServiceGroup.h" #include "common/net/ThreadPoolGroup.h" #include "common/serde/ClientContext....
#include "common/net/ServiceGroup.h" #include <chrono> #include <folly/Random.h> #include <folly/experimental/coro/Sleep.h> namespace hf3fs::net { ServiceGroup::ServiceGroup(const Config &config, ThreadPoolGroup &tpg) : config_(config), tpg_(tpg), processor_(serdeServices_, tpg.procThreadPool(), conf...
#pragma once #include <condition_variable> #include <folly/Utility.h> #include <optional> #include "common/net/IOWorker.h" #include "common/net/Listener.h" #include "common/net/Processor.h" #include "common/net/ThreadPoolGroup.h" #include "common/serde/ClientContext.h" #include "common/serde/Services.h" #include "com...
#pragma once #include <chrono> #include <folly/Range.h> #include <memory> #include <sys/uio.h> #include "common/net/Network.h" #include "common/utils/Coroutine.h" #include "common/utils/Result.h" namespace hf3fs::net { class Socket { public: virtual ~Socket() = default; // describe this socket. virtual std:...
#include "ThreadPoolGroup.h" #include <folly/experimental/coro/Sleep.h> #include <folly/experimental/coro/ViaIfAsync.h> #include <folly/logging/xlog.h> #include "common/monitor/Recorder.h" #include "common/utils/Duration.h" namespace hf3fs::net { CoTask<void> ThreadPoolGroup::collectStatsPeriodically() { XLOGF(DB...
#pragma once #include <folly/executors/CPUThreadPoolExecutor.h> #include <folly/executors/IOThreadPoolExecutor.h> #include <folly/executors/TimekeeperScheduledExecutor.h> #include <folly/experimental/coro/WithCancellation.h> #include <folly/experimental/symbolizer/Symbolizer.h> #include <folly/synchronization/Baton.h>...
#include "common/net/Transport.h" #include <algorithm> #include <chrono> #include <cstddef> #include <cstdint> #include <folly/experimental/coro/BlockingWait.h> #include <folly/experimental/coro/Sleep.h> #include <folly/logging/xlog.h> #include <iostream> #include <memory> #include <random> #include <thread> #include...
#pragma once #include <folly/Executor.h> #include <folly/IPAddressV4.h> #include <memory> #include "common/net/EventLoop.h" #include "common/net/MessageHeader.h" #include "common/net/Socket.h" #include "common/net/WriteItem.h" #include "common/net/ib/IBSocket.h" #include "common/net/tcp/TcpSocket.h" #include "common/...
#include "common/net/TransportPool.h" #include <folly/Random.h> #include <folly/logging/xlog.h> #include "common/monitor/Recorder.h" namespace hf3fs::net { namespace { std::atomic<uint32_t> acceptedCount{}; std::atomic<uint32_t> connectedCount{}; monitor::ValueRecorder acceptedCountRecorder{"common.net.accepted_cou...
#pragma once #include <folly/Likely.h> #include <folly/ThreadLocal.h> #include "common/net/Transport.h" #include "common/utils/RobinHood.h" #include "common/utils/Shards.h" namespace hf3fs::net { class IOWorker; // A set of transports to same address for load balance. class TransportSet { public: static constex...
#include "common/net/Waiter.h" namespace hf3fs::net { static int64_t nowMS() { using namespace std::chrono; return duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count(); } Waiter &Waiter::instance() { static Waiter w; return w; } Waiter::Waiter() { thread_ = std::jthread(&Waiter::run...
#pragma once #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <folly/experimental/coro/Baton.h> #include <mutex> #include <vector> #include "common/net/Network.h" #include "common/net/RDMAControl.h" #include "common/net/Transport.h" #include "common/serde/MessagePacket.h" #i...
#include "common/net/WriteItem.h" #include <atomic> #include <utility> #include "common/monitor/Recorder.h" #include "common/net/Transport.h" #include "common/net/Waiter.h" namespace hf3fs::net { monitor::CountRecorder toIOVecCPUTime{"common_net_to_io_vec_cpu_time"}; monitor::CountRecorder advanceCPUTime{"common_ne...
#pragma once #include <atomic> #include <folly/lang/Align.h> #include <limits> #include <utility> #include "common/net/Allocator.h" #include "common/net/MessageHeader.h" #include "common/net/RequestOptions.h" #include "common/serde/MessagePacket.h" #include "common/serde/Serde.h" #include "common/utils/DownwardBytes....
#include "common/net/ib/IBConnect.h" #include <algorithm> #include <array> #include <atomic> #include <cassert> #include <cerrno> #include <chrono> #include <fmt/core.h> #include <fmt/format.h> #include <folly/IPAddressV4.h> #include <folly/Likely.h> #include <folly/Random.h> #include <folly/ScopeGuard.h> #include <fo...
#pragma once #include <array> #include <chrono> #include <cstring> #include <folly/Overload.h> #include <folly/container/BitIterator.h> #include <folly/experimental/coro/Mutex.h> #include <folly/lang/Bits.h> #include <functional> #include <infiniband/verbs.h> #include <map> #include <memory> #include <string> #include...
#pragma once #include <atomic> #include <folly/IPAddressV4.h> #include <gtest/gtest_prod.h> #include <map> #include "common/net/ib/IBConnect.h" #include "common/net/ib/IBDevice.h" #include "common/net/ib/IBSocket.h" #include "common/serde/CallContext.h" #include "common/serde/Service.h" #include "common/utils/Corouti...
#include "IBDevice.h" #include <algorithm> #include <asm-generic/errno.h> #include <bits/types/struct_itimerspec.h> #include <bits/types/struct_timespec.h> #include <cerrno> #include <chrono> #include <cstdint> #include <cstdlib> #include <cstring> #include <ctime> #include <filesystem> #include <fmt/core.h> #include ...
#pragma once #include <algorithm> #include <atomic> #include <cassert> #include <cerrno> #include <cstddef> #include <cstdint> #include <fmt/core.h> #include <fmt/format.h> #include <folly/IPAddressV4.h> #include <folly/Likely.h> #include <folly/Synchronized.h> #include <folly/Utility.h> #include <folly/detail/IPAddre...
#include "IBSocket.h" #include <algorithm> #include <array> #include <asm-generic/errno.h> #include <atomic> #include <bits/types/struct_timespec.h> #include <cassert> #include <cerrno> #include <chrono> #include <cstdint> #include <cstdlib> #include <fcntl.h> #include <fmt/core.h> #include <folly/IPAddressV4.h> #incl...
#pragma once #include <algorithm> #include <array> #include <atomic> #include <bits/types/struct_iovec.h> #include <cassert> #include <chrono> #include <cstddef> #include <cstdint> #include <fmt/core.h> #include <folly/CancellationToken.h> #include <folly/Conv.h> #include <folly/IPAddressV4.h> #include <folly/Likely.h...
#include "RDMABuf.h" #include <cstdint> #include <folly/experimental/coro/Mutex.h> #include <folly/experimental/coro/Timeout.h> #include <folly/logging/xlog.h> #include <memory> #include <mutex> #include <unistd.h> #include <utility> #include "common/monitor/Recorder.h" #include "common/net/ib/IBDevice.h" #include "m...
#pragma once #include <algorithm> #include <array> #include <asm-generic/errno-base.h> #include <atomic> #include <chrono> #include <condition_variable> #include <cstddef> #include <cstdint> #include <cstdlib> #include <deque> #include <folly/Likely.h> #include <folly/Range.h> #include <folly/Utility.h> #include <foll...
#pragma once #include "common/net/sync/ConnectionPool.h" #include "common/serde/ClientContext.h" namespace hf3fs::net::sync { class Client { public: struct Config : public ConfigBase<Config> { CONFIG_HOT_UPDATED_ITEM(default_timeout, kClientRequestDefaultTimeout); CONFIG_HOT_UPDATED_ITEM(default_send_retr...
#include "common/net/sync/ConnectionPool.h" #include "common/utils/Duration.h" #include "common/utils/FdWrapper.h" namespace hf3fs::net::sync { Result<std::unique_ptr<TcpSocket>> ConnectionPool::acquire(Address addr) { auto startTime = RelativeTime::now(); auto deadlineTime = startTime + config_.tcp_connect_time...
#pragma once #include <map> #include "common/net/Network.h" #include "common/net/tcp/TcpSocket.h" #include "common/utils/BoundedQueue.h" #include "common/utils/ConfigBase.h" namespace hf3fs::net::sync { class ConnectionPool { public: struct Config : public ConfigBase<Config> { CONFIG_HOT_UPDATED_ITEM(max_con...
#include "common/net/tcp/TcpSocket.h" #include <folly/Likely.h> #include <folly/concurrency/ConcurrentHashMap.h> #include <folly/executors/IOThreadPoolExecutor.h> #include <folly/experimental/coro/CurrentExecutor.h> #include <folly/io/async/AsyncSocket.h> #include <folly/io/coro/Transport.h> #include <folly/logging/xl...
#pragma once #include <folly/IPAddressV4.h> #include "common/net/Socket.h" #include "common/utils/Address.h" #include "common/utils/Duration.h" #include "common/utils/FdWrapper.h" namespace hf3fs::net { class TcpSocket : public Socket { public: TcpSocket() = default; explicit TcpSocket(int fd) : fd_(fd) ...
#pragma once #include "common/serde/Serde.h" namespace hf3fs::serde { template <class T> struct BigEndian { BigEndian() = default; BigEndian(T v) : value(v) {} T value; operator T() const { return value; } }; } // namespace hf3fs::serde template <class T> struct hf3fs::serde::SerdeMethod<hf3fs::ser...
#include "common/serde/CallContext.h" #include "common/monitor/Recorder.h" #include "common/serde/ClientContext.h" namespace hf3fs::serde { namespace { monitor::CountRecorder deserilizeFails{"common.rpc.deserilize.fails"}; monitor::OperationRecorder applyRDMATransmission{"common.apply_rdma_transmission"}; monitor::C...
#pragma once #include "common/net/Transport.h" #include "common/net/ib/IBSocket.h" #include "common/serde/MessagePacket.h" #include "common/utils/Coroutine.h" #include "common/utils/Size.h" #include "common/utils/Tracing.h" #include "common/utils/VersionInfo.h" namespace hf3fs::serde { class CallContext { public: ...
#include "common/serde/ClientContext.h" #include "common/net/RequestOptions.h" namespace hf3fs::serde { namespace { monitor::LatencyRecorder &getServerLatencyRecorder() { static monitor::LatencyRecorder recorder("NetClient.server_latency"); return recorder; } monitor::LatencyRecorder &getTotalLatencyRecorder() {...
#pragma once #include "common/net/IOWorker.h" #include "common/net/Transport.h" #include "common/net/Waiter.h" #include "common/net/WriteItem.h" #include "common/net/sync/ConnectionPool.h" #include "common/serde/ClientContext.h" #include "common/serde/MessagePacket.h" #include "common/serde/Serde.h" #include "common/s...
#pragma once #include <folly/experimental/coro/BlockingWait.h> #include <memory> #include "common/net/Client.h" #include "common/net/Network.h" #include "common/net/Server.h" #include "common/serde/CallContext.h" #include "common/serde/ClientContext.h" #include "common/utils/Address.h" #include "common/utils/Coroutin...
#pragma once #include "common/serde/CallContext.h" #include "common/serde/Serde.h" #include "common/serde/Service.h" namespace hf3fs::serde::echo { struct Message { SERDE_STRUCT_FIELD(str, std::string{}); }; SERDE_SERVICE(Service, 10000) { // send back which received. SERDE_SERVICE_METHOD(echo, 1, Message, Me...
#pragma once #include <type_traits> #include "common/serde/Serde.h" #include "common/utils/Duration.h" #include "common/utils/Result.h" namespace hf3fs::serde { enum EssentialFlags : uint16_t { IsReq = (1 << 0), UseCompress = (1 << 1), ControlRDMA = (1 << 2), }; struct Version { SERDE_STRUCT_FIELD(major, u...
#include "common/serde/Serde.h" #include <exception> #include <folly/dynamic.h> #include <folly/json.h> #include <sstream> #include <type_traits> #include <utility> #include "common/serde/TypeName.h" #include "common/utils/MagicEnum.hpp" #include "toml.hpp" namespace hf3fs::serde { struct JsonObject : public folly:...
#pragma once #include <algorithm> #include <folly/Likely.h> #include <iterator> #include <limits> #include <scn/scn.h> #include <string_view> #include <tuple> #include <type_traits> #include "common/net/Allocator.h" #include "common/serde/TypeName.h" #include "common/utils/DownwardBytes.h" #include "common/utils/Magi...
#pragma once #include "Serde.h" namespace hf3fs::serde { template <SerdeType T> bool equals(const T &a, const T &b) { auto handler = [&](auto field) { using Field = std::remove_cvref_t<decltype(field)>; const auto &l = a.*(Field::getter); const auto &r = b.*(Field::getter); if constexpr (SerdeType<s...
#pragma once #include "Serde.h" #include "common/kv/ITransaction.h" namespace hf3fs::serde { template <typename T> struct SerdeHelper { using Self = T; template <typename... Args> static Self create(Args &&...args) { return Self{/* base */ {}, std::forward<Args>(args)...}; } CoTryTask<void> store(kv::...
#pragma once #include "common/serde/MessagePacket.h" #include "common/serde/Serde.h" #include "common/utils/Coroutine.h" #include "common/utils/Reflection.h" namespace hf3fs::net { struct UserRequestOptions; } namespace hf3fs::serde { template <NameWrapper NAME, uint32_t ID> struct ServiceBase { static constexpr ...
#pragma once #include "common/serde/CallContext.h" #include "common/serde/Echo.h" #include "common/serde/Service.h" #include "common/utils/ConstructLog.h" #include "common/utils/Coroutine.h" #include "common/utils/Result.h" namespace hf3fs::serde { class Services { public: Services() { addService(std::make_unique...
#pragma once #include <variant> #include "common/utils/Nameof.hpp" #include "common/utils/TypeTraits.h" namespace hf3fs::serde { template <class T> inline constexpr std::string_view type_name_v = [] { if constexpr (requires { std::string_view{T::kTypeNameForSerde}; }) { return std::string_view{T::kTypeNameFor...