text
stringlengths
1
24.5M
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerRotateLastSrvHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include <atomic> #include <cstdlib> #include <fmt/chrono.h> #include <folly/CancellationToken.h> #include <folly/Conv.h> #include <folly/Likely.h> #include <folly/Synchronized.h> #include <folly/Unit.h> #include <folly/executors/CPUThreadPoolExecutor.h> #include <folly/experimental/coro/Sleep.h> #include <folly/experi...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerScanTree(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include <folly/Conv.h> #include "AdminEnv.h" #include "ListNodes.h" #include "Utils.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "common/utils/FileUtils.h" namespace hf3fs::client::cli { namespace { const std::map<String, flat::NodeType> typeMappings = { {"MGMTD", f...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerSetConfigHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "SetLayout.h" #include "AdminEnv.h" #include "client/cli/admin/Layout.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" namespace hf3fs::client::cli { namespace { auto getParser() { argparse::ArgumentParser parser("set-layout"); parser.add_argument("path"); addLayoutArgum...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerSetLayoutHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "SetNodeTags.h" #include <folly/Conv.h> #include "AdminEnv.h" #include "Utils.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" namespace hf3fs::client::cli { namespace { const std::map<String, flat::SetTagMode> modeMap = {{"replace", flat::SetTagMode::REPLACE}, ...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerSetNodeTagsHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "SetPermission.h" #include <scn/scn.h> #include "AdminEnv.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "fbs/meta/Common.h" namespace hf3fs::client::cli { namespace { auto getParser() { argparse::ArgumentParser parser("set-perm"); parser.add_argument("-u", "-...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerSetPermissionHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "SetPreferredTargetOrder.h" #include <scn/scn.h> #include "AdminEnv.h" #include "Utils.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "common/utils/Transform.h" namespace hf3fs::client::cli { namespace { auto getParser() { argparse::ArgumentParser parser("set-pr...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerSetPreferredTargetOrderHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "ShutdownAllChains.h" #include <fmt/chrono.h> #include <string> #include "AdminEnv.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "common/kv/WithTransaction.h" #include "common/utils/ArgParse.h" #include "common/utils/Result.h" #include "common/utils/StringUtils.h"...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerShutdownAllChainsHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "Stat.h" #include <cstdlib> #include <fmt/chrono.h> #include <folly/Conv.h> #include <folly/logging/xlog.h> #include "AdminEnv.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "client/storage/StorageClient.h" #include "common/utils/Result.h" #include "common/utils/St...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerStatHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "AdminEnv.h" #include "Mkdir.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" namespace hf3fs::client::cli { namespace { auto getParser() { argparse::ArgumentParser parser("ln"); parser.add_argument("target"); parser.add_argument("linkname"); return parser; } CoTryTas...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerSymlinkHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "UnregisterNode.h" #include <folly/Conv.h> #include "AdminEnv.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "common/utils/StringUtils.h" namespace hf3fs::client::cli { namespace { const std::set<String> typeChoices(magic_enum::enum_names<flat::NodeType>().begin()...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerUnregisterNodesHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "UpdateChain.h" #include <boost/algorithm/string.hpp> #include <scn/scn.h> #include "AdminEnv.h" #include "Utils.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" namespace hf3fs::client::cli { namespace { auto getParser() { argparse::ArgumentParser parser("update-chain"); ...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerUpdateChainHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "UploadChains.h" #include <folly/Conv.h> #include "AdminEnv.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "common/utils/RapidCsv.h" namespace hf3fs::client::cli { namespace { auto getParser() { argparse::ArgumentParser parser("upload-chains"); parser.add_arg...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerUploadChainsHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "UploadChainTable.h" #include <folly/Conv.h> #include "AdminEnv.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "common/utils/RapidCsv.h" namespace hf3fs::client::cli { namespace { auto getParser() { argparse::ArgumentParser parser("upload-chain-table"); parse...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerUploadChainTableHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "Utils.h" #include <fstream> #include <sstream> namespace hf3fs::client::cli { void statNode(Dispatcher::OutputTable &table, const flat::NodeInfo &node) { table.push_back({"NodeId", fmt::format("{}", node.app.nodeId.toUnderType())}); table.push_back({"Type", String(magic_enum::enum_name(node.type))}); ...
#pragma once #include "client/cli/common/Dispatcher.h" #include "fbs/mgmtd/ChainInfo.h" #include "fbs/mgmtd/NodeInfo.h" namespace hf3fs::client::cli { void statNode(Dispatcher::OutputTable &table, const flat::NodeInfo &node); void statChainInfo(Dispatcher::OutputTable &table, const flat::ChainInfo &chain); } // name...
#include "VerifyConfig.h" #include <folly/Conv.h> #include <folly/experimental/coro/Collect.h> #include "AdminEnv.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "common/utils/FileUtils.h" #include "common/utils/StringUtils.h" namespace hf3fs::client::cli { namespace { // T...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerVerifyConfigHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "WriteFile.h" #include <folly/experimental/coro/BlockingWait.h> #include <fstream> #include <sstream> #include "AdminEnv.h" #include "client/cli/admin/FileWrapper.h" #include "client/cli/admin/Layout.h" #include "client/cli/common/Dispatcher.h" #include "client/cli/common/Utils.h" #include "client/storage/St...
#pragma once #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher; CoTryTask<void> registerWriteFileHandler(Dispatcher &dispatcher); } // namespace hf3fs::client::cli
#include "client/cli/common/Dispatcher.h" #include <boost/algorithm/string.hpp> #include <chrono> #include <iostream> #include "Parser.h" #include "Printer.h" #include "Utils.h" #include "common/utils/Coroutine.h" #include "common/utils/Duration.h" #include "common/utils/Linenoise.h" namespace hf3fs::client::cli { n...
#pragma once #include <vector> #include "IEnv.h" #include "common/utils/ArgParse.h" #include "common/utils/Coroutine.h" namespace hf3fs::client::cli { class Dispatcher { public: using Args = std::vector<String>; using OutputRow = std::vector<String>; using OutputTable = std::vector<OutputRow>; using ParserG...
#pragma once namespace hf3fs::client::cli { // hide implementations, user should dynamic cast IEnv to a known concrete Env class. struct IEnv { virtual ~IEnv() = default; }; } // namespace hf3fs::client::cli
#include "Parser.h" #include <cctype> namespace hf3fs::client::cli { namespace { std::string_view drainSpaces(std::string_view s) { auto it = std::find_if(s.begin(), s.end(), [](char c) { return !std::isspace(c); }); return {it, s.end()}; } } // namespace Result<std::string> ArgsParser::parseOne() { s_ = drain...
#pragma once #include <optional> #include <string> #include <string_view> #include <vector> #include "common/utils/Result.h" namespace hf3fs::client::cli { class ArgsParser { public: explicit ArgsParser(std::string_view s) : s_(s) {} Result<std::string> parseOne(); Result<std::vector<std::string>> pars...
#include "Printer.h" namespace hf3fs::client::cli { void Printer::print(const std::vector<std::vector<String>> &table) const { static constexpr std::string_view separator = " "; std::vector<size_t> widths; for (const auto &r : table) { if (widths.size() < r.size()) { widths.resize(r.size(), 0); } ...
#pragma once #include <functional> #include "common/utils/String.h" namespace hf3fs::client::cli { class Printer { public: using OutputHandler = std::function<void(const String &)>; explicit Printer(OutputHandler handler) : stdout_(std::move(handler)), stderr_(stdout_) {} Printer(OutputHandler...
#pragma once #include "common/utils/Status.h" #define ENSURE_USAGE(condition, ...) \ do { \ if (!UNLIKELY(static_cast<bool>(condition))) ...
#pragma once #include "stubs/common/IStubFactory.h" #include "stubs/core/ICoreServiceStub.h" namespace hf3fs::client { class CoreClient { public: using CoreStub = core::ICoreServiceStub; using CoreStubFactory = stubs::IStubFactory<CoreStub>; explicit CoreClient(std::unique_ptr<CoreStubFactory> stubFactory) ...
#include "MetaClient.h" #include <algorithm> #include <cassert> #include <chrono> #include <fcntl.h> #include <fmt/format.h> #include <folly/Math.h> #include <folly/ScopeGuard.h> #include <folly/String.h> #include <folly/experimental/coro/BlockingWait.h> #include <folly/experimental/coro/Collect.h> #include <folly/exp...
#pragma once #include <fmt/core.h> #include <folly/Function.h> #include <folly/Synchronized.h> #include <folly/TimeoutQueue.h> #include <folly/concurrency/AtomicSharedPtr.h> #include <folly/executors/CPUThreadPoolExecutor.h> #include <folly/experimental/coro/Invoke.h> #include <folly/experimental/coro/Sleep.h> #includ...
#include "ServerSelectionStrategy.h" #include <algorithm> #include <fmt/format.h> #include <folly/Random.h> #include <folly/Range.h> #include <folly/SharedMutex.h> #include <folly/Synchronized.h> #include <folly/hash/Hash.h> #include <folly/logging/xlog.h> #include <folly/ssl/OpenSSLHash.h> #include <memory> #include ...
#pragma once #include <fmt/format.h> #include <folly/SharedMutex.h> #include <folly/Synchronized.h> #include <folly/Utility.h> #include <folly/logging/xlog.h> #include <memory> #include <mutex> #include <optional> #include <random> #include <set> #include <utility> #include <vector> #include "client/mgmtd/ICommonMgmt...
#pragma once #include "ICommonMgmtdClient.h" #include "MgmtdClient.h" namespace hf3fs::client { template <typename Base> class CommonMgmtdClient : public Base { public: explicit CommonMgmtdClient(std::shared_ptr<MgmtdClient> client) : client_(std::move(client)) {} CoTask<void> start(folly::Executor *backg...
#pragma once #include "RoutingInfo.h" #include "fbs/mgmtd/Rpc.h" namespace hf3fs::client { // ICommonMgmtdClient provides the common facilities: // 1. start and stop // 2. RoutingInfo class ICommonMgmtdClient { public: virtual ~ICommonMgmtdClient() = default; virtual CoTask<void> start(folly::Executor *backgrou...
#pragma once #include "ICommonMgmtdClient.h" #include "fbs/mgmtd/ChainSetting.h" #include "fbs/mgmtd/ConfigInfo.h" namespace hf3fs::client { class IMgmtdClientForAdmin : public ICommonMgmtdClient { public: virtual CoTryTask<mgmtd::SetChainsRsp> setChains(const flat::UserInfo &userInfo, ...
#pragma once #include "ICommonMgmtdClient.h" #include "fbs/mgmtd/ClientSessionData.h" namespace hf3fs::client { class IMgmtdClientForClient : public ICommonMgmtdClient { public: virtual CoTryTask<void> extendClientSession() = 0; using ConfigListener = std::function<hf3fs::Result<hf3fs::Void>(const String &, con...
#pragma once #include "ICommonMgmtdClient.h" #include "fbs/mgmtd/Rpc.h" namespace hf3fs::client { class IMgmtdClientForServer : public ICommonMgmtdClient { public: // manual calls virtual CoTryTask<mgmtd::HeartbeatRsp> heartbeat() = 0; virtual Result<Void> triggerHeartbeat() = 0; // must set before any man...
#include "MgmtdClient.h" #include <folly/Overload.h> #include <folly/Synchronized.h> #include <folly/concurrency/AtomicSharedPtr.h> #include <folly/experimental/coro/BlockingWait.h> #include <folly/experimental/coro/BoundedQueue.h> #include <folly/experimental/coro/FutureUtil.h> #include <folly/experimental/coro/Promi...
#pragma once #include "IMgmtdClientForClient.h" #include "IMgmtdClientForServer.h" #include "RoutingInfo.h" #include "common/utils/ConfigBase.h" #include "common/utils/Duration.h" #include "stubs/common/IStubFactory.h" #include "stubs/mgmtd/IMgmtdServiceStub.h" namespace hf3fs::client { class MgmtdClient { public: ...
#pragma once #include "CommonMgmtdClient.h" #include "IMgmtdClientForAdmin.h" namespace hf3fs::client { class MgmtdClientForAdmin : public CommonMgmtdClient<IMgmtdClientForAdmin> { public: struct Config : MgmtdClient::Config { Config() { set_enable_auto_refresh(false); set_enable_auto_heartbeat(fal...
#pragma once #include "CommonMgmtdClient.h" #include "IMgmtdClientForClient.h" namespace hf3fs::client { class MgmtdClientForClient : public CommonMgmtdClient<IMgmtdClientForClient> { public: struct Config : MgmtdClient::Config { Config() { set_enable_auto_refresh(true); set_enable_auto_heartbeat(f...
#pragma once #include "CommonMgmtdClient.h" #include "IMgmtdClientForServer.h" namespace hf3fs::client { class MgmtdClientForServer : public CommonMgmtdClient<IMgmtdClientForServer> { public: struct Config : MgmtdClient::Config { Config() { set_enable_auto_refresh(true); set_enable_auto_heartbeat(t...
#include "RoutingInfo.h" #include <folly/Random.h> #include "fbs/mgmtd/RoutingInfo.h" namespace hf3fs::client { RoutingInfo::RoutingInfo(std::shared_ptr<flat::RoutingInfo> info, SteadyTime refreshTime) : info_(std::move(info)), lastRefreshTime_(refreshTime) {} std::optional<flat::ChainInfo> RoutingInfo::g...
#pragma once #include "ServiceInfo.h" #include "common/utils/Selector.h" #include "common/utils/UtcTime.h" #include "fbs/mgmtd/RoutingInfo.h" namespace hf3fs::client { class RoutingInfo { public: RoutingInfo() = default; RoutingInfo(std::shared_ptr<flat::RoutingInfo> info, SteadyTime refreshTime); const auto...
#pragma once #include "common/app/AppInfo.h" #include "common/utils/Selector.h" #include "fbs/mgmtd/MgmtdTypes.h" namespace hf3fs::client { struct ServiceInfo { String name; uint16_t id{0}; flat::NodeId nodeId{0}; flat::NodeStatus nodeStatus{flat::NodeStatus::HEARTBEAT_CONNECTING}; std::vector<net::Address>...
#include <boost/core/ignore_unused.hpp> #include "StorageClientImpl.h" #include "StorageClientInMem.h" #include "common/monitor/ScopedMetricsWriter.h" #include "common/net/ib/RDMABuf.h" namespace hf3fs::storage::client { static monitor::CountRecorder iobuf_reg_success_ops{"storage_client.iobuf_reg.success_ops"}; sta...
#pragma once #include <span> #include <vector> #include "TargetSelection.h" #include "UpdateChannelAllocator.h" #include "client/mgmtd/ICommonMgmtdClient.h" #include "common/net/Client.h" #include "common/utils/Address.h" #include "common/utils/Coroutine.h" #include "common/utils/Result.h" #include "common/utils/Sema...
#pragma once #include <span> #include <vector> #include "StorageClient.h" #include "StorageMessenger.h" #include "UpdateChannelAllocator.h" #include "common/net/Client.h" #include "common/utils/Address.h" #include "common/utils/Coroutine.h" #include "common/utils/Result.h" #include "fbs/storage/Common.h" namespace h...
#include "StorageClientImpl.h" #include <boost/core/ignore_unused.hpp> #include <folly/Random.h> #include <folly/experimental/coro/Collect.h> #include <folly/experimental/coro/Sleep.h> #include <folly/experimental/symbolizer/Symbolizer.h> #include <memory> #include <random> #include "TargetSelection.h" #include "comm...
#pragma once #include <span> #include <vector> #include "StorageClient.h" #include "StorageMessenger.h" #include "UpdateChannelAllocator.h" #include "common/net/Client.h" #include "common/utils/Address.h" #include "common/utils/Coroutine.h" #include "common/utils/Result.h" #include "fbs/storage/Common.h" namespace h...
#include "StorageClientInMem.h" #include <algorithm> #include <boost/core/ignore_unused.hpp> #include <boost/range/adaptor/reversed.hpp> #include <cassert> #include <chrono> #include <folly/Random.h> #include <folly/experimental/coro/Sleep.h> #include <folly/logging/xlog.h> #include <iterator> #include <random> #inclu...
#pragma once #include <folly/Synchronized.h> #include <folly/Utility.h> #include <folly/experimental/coro/Mutex.h> #include <gtest/gtest_prod.h> #include <map> #include <mutex> #include <span> #include <unordered_map> #include <vector> #include "StorageClient.h" #include "StorageMessenger.h" #include "common/net/Clie...
#include "StorageMessenger.h" #include <boost/core/ignore_unused.hpp> #include "common/serde/ClientContext.h" #include "common/serde/Service.h" #include "fbs/storage/Service.h" namespace hf3fs::storage::client { StorageMessenger::StorageMessenger(const hf3fs::net::Client::Config &config) : client_(config) {} t...
#pragma once #include <span> #include <vector> #include "common/net/Client.h" #include "common/serde/MessagePacket.h" #include "common/utils/Address.h" #include "common/utils/Coroutine.h" #include "common/utils/Result.h" #include "fbs/storage/Common.h" namespace hf3fs::storage::client { class StorageMessenger { pu...
#include "TargetSelection.h" #include <folly/AtomicUnorderedMap.h> namespace hf3fs::storage::client { namespace { folly::AtomicUnorderedInsertMap<NodeId, folly::MutableAtom<uint64_t>> numAccumIOs{32_KB}; folly::AtomicUnorderedInsertMap<ChainId, folly::MutableAtom<uint64_t>> nextTargetIndex{1_MB}; } // namespace /...
#pragma once #include <folly/Random.h> #include <mutex> #include <vector> #include "common/utils/StatusCodeDetails.h" #include "fbs/storage/Common.h" namespace hf3fs::storage::client { /* Slim routing info */ struct SlimTargetInfo { TargetId targetId; NodeId nodeId; bool operator==(const SlimTargetInfo &oth...
#include "UpdateChannelAllocator.h" #include <folly/experimental/coro/BlockingWait.h> #include "common/monitor/Recorder.h" namespace hf3fs::storage::client { static monitor::CountRecorder num_update_channels_inuse{"storage_client.num_update_channels.inuse", false /*reset*/}; static monitor::CountRecorder num_update...
#pragma once #include <boost/core/ignore_unused.hpp> #include <mutex> #include <stack> #include "fbs/storage/Common.h" namespace hf3fs::storage::client { /* Allocate a channel id, which is used to de-duplicate updates at storage service, for example, write, truncate, remove etc. */ class UpdateChannelAllocator ...
#include "AppInfo.h" namespace hf3fs::flat { ServiceGroupInfo::ServiceGroupInfo(std::set<String> ss, std::vector<net::Address> es) : services(std::move(ss)), endpoints(std::move(es)) {} bool ServiceGroupInfo::operator==(const ServiceGroupInfo &other) const { return serde::equals(*this, other); } TagPair::T...
#pragma once #include <compare> #include <scn/tuple_return.h> #include "common/app/NodeId.h" #include "common/serde/SerdeComparisons.h" #include "common/serde/SerdeHelper.h" #include "common/utils/Address.h" #include "common/utils/UtcTime.h" #include "common/utils/VersionInfo.h" namespace hf3fs::flat { struct Servi...
#include "common/app/ApplicationBase.h" #include <folly/init/Init.h> #include <iostream> #include <sys/signal.h> #include "common/app/ConfigManager.h" #include "common/app/Thread.h" #include "common/utils/OptionalUtils.h" #include "common/utils/RenderConfig.h" #include "common/utils/StringUtils.h" #include "memory/co...
#pragma once #include "common/app/AppInfo.h" #include "common/app/ConfigStatus.h" #include "common/app/ConfigUpdateRecord.h" #include "common/logging/LogConfig.h" #include "common/monitor/Monitor.h" #include "common/net/Server.h" #include "common/serde/Serde.h" #include "common/utils/ConfigBase.h" #include "common/uti...
#pragma once #include "common/serde/Serde.h" #include "common/utils/String.h" #include "common/utils/SysResource.h" #include "common/utils/Uuid.h" namespace hf3fs { struct ClientId { SERDE_STRUCT_TYPED_FIELD(Uuid, uuid, hf3fs::Uuid{}); SERDE_STRUCT_TYPED_FIELD(String, hostname, "<unknown host>"); public: Cli...
#include "ConfigManager.h" #include "common/utils/ConfigBase.h" #include "common/utils/RenderConfig.h" #include "common/utils/StringUtils.h" namespace hf3fs::app { #define RETURN_AND_RECORD_CONFIG_UPDATE(ret, desc) \ Result<Void> _r = (ret); ...
#pragma once #include <optional> #include "ConfigStatus.h" #include "ConfigUpdateRecord.h" namespace hf3fs::config { struct IConfig; } namespace hf3fs::flat { struct AppInfo; } namespace hf3fs::app { struct ConfigManager { void updateConfigRecord(Status status, String desc); void updateConfigContent(config::IC...
#pragma once #include <cstdint> namespace hf3fs { enum class ConfigStatus : uint8_t { NORMAL = 0, DIRTY = 1, FAILED = 2, UNKNOWN = 3, STALE = 4 }; }
#pragma once #include "common/serde/Serde.h" #include "common/utils/UtcTime.h" namespace hf3fs::app { struct ConfigUpdateRecord { SERDE_STRUCT_FIELD(updateTime, UtcTime{}); SERDE_STRUCT_FIELD(result, Status(StatusCode::kOK)); SERDE_STRUCT_FIELD(description, String{}); }; } // namespace hf3fs::app
#include <gflags/gflags.h> DEFINE_bool(release_version, false, "Display release version"); DEFINE_string(app_cfg, "", "Path to .toml config file which contains specific config to this node"); DEFINE_bool(dump_default_app_cfg, false, "Dump default app config to stdout"); DEFINE_string(launcher_cfg, "", "Path to .toml...
#pragma once #include "common/utils/StrongType.h" namespace hf3fs::flat { STRONG_TYPEDEF(uint32_t, NodeId); }
#pragma once #include <iostream> #include "AppInfo.h" #include "ApplicationBase.h" #include "Utils.h" #include "common/logging/LogInit.h" #include "common/net/Server.h" #include "common/net/ib/IBDevice.h" #include "common/utils/LogCommands.h" #include "common/utils/SysResource.h" DECLARE_string(app_cfg); DECLARE_boo...
#include "common/app/Thread.h" #include <sys/signal.h> namespace hf3fs { /** * Block signals SIGINT and SIGTERM for the calling pthread. * * Note: Blocked signals will be inherited by child threads. * * Note: This is important to make, because Linux can direct a SIGINT to any thread that has a * handler regist...
#pragma once namespace hf3fs { class Thread { public: static bool blockInterruptSignals(); static bool unblockInterruptSignals(); }; } // namespace hf3fs
#pragma once #include <fmt/format.h> #include "Utils.h" #include "common/app/ApplicationBase.h" #include "common/utils/LogCommands.h" DECLARE_string(cfg); DECLARE_bool(dump_default_cfg); DECLARE_bool(use_local_cfg); namespace hf3fs { template <typename Server> class TwoPhaseApplication : public ApplicationBase { ...
#include "Utils.h" #include "common/logging/LogInit.h" #include "common/utils/FileUtils.h" #include "common/utils/RenderConfig.h" DECLARE_string(cfg); DECLARE_bool(dump_cfg); DECLARE_bool(dump_default_cfg); DECLARE_bool(use_local_cfg); DECLARE_string(cfg_persist_prefix); extern "C" { // jemalloc __attribute__((weak)...
#pragma once #include "ApplicationBase.h" namespace hf3fs::app_detail { Result<Void> parseFlags(int *argc, char ***argv, ApplicationBase::ConfigFlags &appConfigFlags, ApplicationBase::ConfigFlags &launcherConfigFlags, Appl...
#pragma once #include <memory> #include "common/kv/ITransaction.h" namespace hf3fs::kv { class IKVEngine { public: virtual ~IKVEngine() = default; virtual std::unique_ptr<IReadOnlyTransaction> createReadonlyTransaction() = 0; virtual std::unique_ptr<IReadWriteTransaction> createReadWriteTransaction() = 0; };...
#include "ITransaction.h" #include <folly/logging/xlog.h> #include "common/utils/StringUtils.h" namespace hf3fs::kv { bool TransactionHelper::isTransactionError(const Status &error) { return StatusCode::typeOf(error.code()) == StatusCodeType::Transaction; } bool TransactionHelper::isRetryable(const Status &error,...
#pragma once #include <cstdint> #include <folly/Utility.h> #include <folly/logging/xlog.h> #include <optional> #include <string_view> #include <vector> #include "common/utils/Coroutine.h" #include "common/utils/Result.h" #include "common/utils/Status.h" #include "common/utils/String.h" #include "common/utils/Transfor...
#ifndef DEFINE_PREFIX #define DEFINE_PREFIX(...) #endif // clang-format off DEFINE_PREFIX(Inode, "INOD") DEFINE_PREFIX(Dentry, "DENT") DEFINE_PREFIX(MetaDistributor, "META") DEFINE_PREFIX(User, "USER") DEFINE_PREFIX(NodeTable, "NODE") // Single is used for some single keys (not...
#pragma once #include <cstdint> #include <string_view> namespace hf3fs::kv { // fixed size prefix inline constexpr uint32_t makePrefixValue(const char (&s)[5]) { return s[0] + (static_cast<uint32_t>(s[1]) << 8) + (static_cast<uint32_t>(s[2]) << 16) + (static_cast<uint32_t>(s[3]) << 24); } // use enum for ...
#pragma once #include "common/utils/ConfigBase.h" #include "common/utils/Duration.h" namespace hf3fs::kv { struct TransactionRetry : ConfigBase<TransactionRetry> { CONFIG_HOT_UPDATED_ITEM(max_backoff, 1_s); CONFIG_HOT_UPDATED_ITEM(max_retry_count, 10u); }; } // namespace hf3fs::kv
#pragma once #include <folly/Utility.h> #include <folly/logging/xlog.h> #include <memory.h> #include <memory> #include <type_traits> #include <utility> #include "common/kv/ITransaction.h" #include "common/utils/Coroutine.h" #include "common/utils/Result.h" namespace hf3fs::kv { template <typename RetryStrategy> cla...
#pragma once #include <array> #include <atomic> #include <cstdint> #include <cstring> #include <folly/Synchronized.h> #include <folly/lang/Bits.h> #include <folly/logging/xlog.h> #include <limits> #include <map> #include <mutex> #include <optional> #include <queue> #include <shared_mutex> #include <string> #include <u...
#pragma once #include "MemKV.h" #include "MemTransaction.h" #include "common/kv/IKVEngine.h" namespace hf3fs::kv { class MemKVEngine : public IKVEngine { public: MemKVEngine() = default; std::unique_ptr<IReadOnlyTransaction> createReadonlyTransaction() override { return createReadWriteTransaction(); } std::...
#pragma once #include <algorithm> #include <cassert> #include <folly/Likely.h> #include <folly/Synchronized.h> #include <folly/experimental/coro/Sleep.h> #include <folly/logging/xlog.h> #include <functional> #include <iostream> #include <limits> #include <mutex> #include <optional> #include <string> #include <string_v...
/* * 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...