text
stringlengths
1
24.5M
#include "TracingEvent.h" namespace hf3fs::tracing { std::string_view toString(uint64_t event) { switch (event) { #define EVENT(category, name, value) \ case makeValue(TRACING_EVENT_PREFIX(category), value): \ return #category "::" #name; #define PAIR_EVENT(category, name, value) ...
#pragma once #include <cstdint> #include <string_view> namespace hf3fs::tracing { inline constexpr uint64_t kEventPrefixShift = 32; inline constexpr uint64_t kPairEventShift = kEventPrefixShift - 2; inline constexpr uint64_t kEventValueMask = (static_cast<uint64_t>(1) << kPairEventShift) - 1; inline constexpr uint64...
#ifndef EVENT #define EVENT(...) #endif #ifndef PAIR_EVENT #define PAIR_EVENT(...) #endif PAIR_EVENT(Fdb, NewTransaction, 0); PAIR_EVENT(Fdb, CommitTransaction, 1); PAIR_EVENT(Fdb, CancelTransaction, 2); PAIR_EVENT(Meta, LoadInode, 0); PAIR_EVENT(Meta, SnapshotLoadInode, 1); PAIR_EVENT(Meta, LoadDirEntry, 2); PAIR_E...
#pragma once #include <span> #include "TypeTraits.h" namespace hf3fs { template <template <typename...> typename DstContainer, typename T, typename F> auto transformTo(std::span<T> src, F &&transformer) { using R = std::invoke_result_t<F, const T &>; if constexpr (std::is_same_v<DstContainer<R>, std::vector<R>>)...
#pragma once #include <folly/sorted_vector_types.h> #include <map> #include <optional> #include <set> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <variant> #include <vector> #include "common/utils/RobinHood.h" namespace hf3fs { template <class T, template <class...> class Prima...
///////////////////////// ankerl::unordered_dense::{map, set} ///////////////////////// // A fast & densely stored hashmap and hashset based on robin-hood backward shift deletion. // Version 2.0.1 // https://github.com/martinus/unordered_dense // // Licensed under the MIT License <http://opensource.org/licenses/MIT>. ...
#include <common/utils/UtcTime.h> #include <ctime> namespace hf3fs { UtcTime UtcClock::now() noexcept { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); int64_t val = static_cast<int64_t>(ts.tv_sec) * 1000000 + ts.tv_nsec / 1000; return UtcTime::fromMicroseconds(val); } std::time_t UtcClock::to_time_t(...
#pragma once #include <chrono> #include <cstdint> #include <fmt/chrono.h> #include <folly/Math.h> #include <folly/io/async/HHWheelTimer.h> #include "common/utils/Duration.h" namespace hf3fs { class UtcTime; // UtcClock is similar to std::chrono::system_clock except that it's based on UTC. // UtcClock only provides m...
#pragma once #include "UtcTime.h" #include "common/serde/Serde.h" namespace hf3fs::serde { template <> struct SerdeMethod<UtcTime> { static auto serdeTo(UtcTime t) { return t.toMicroseconds(); } static Result<UtcTime> serdeFrom(int64_t t) { return UtcTime::fromMicroseconds(t); } }; } // namespace hf3fs::serde
/* The latest version of this library is available on GitHub; * https://github.com/sheredom/utf8.h */ /* This is free and unencumbered software released into the public domain. * * Anyone is free to copy, modify, publish, use, compile, sell, or * distribute this software, either in source code form or as a compile...
#include "common/utils/Uuid.h" #include <boost/uuid/random_generator.hpp> #include "common/utils/RobinHood.h" size_t std::hash<hf3fs::Uuid>::operator()(const hf3fs::Uuid &uuid) const { return robin_hood::hash_bytes(uuid.data, uuid.static_size()); } namespace hf3fs { thread_local boost::uuids::random_generator Uui...
#pragma once #include <boost/lexical_cast.hpp> #include <boost/lexical_cast/bad_lexical_cast.hpp> #include <boost/uuid/nil_generator.hpp> #include <boost/uuid/random_generator.hpp> #include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid_io.hpp> #include <cstring> #include <optional> #include <string> #include <string...
#pragma once #include <cstdint> #include <fmt/format.h> namespace hf3fs { struct Varint32 { uint32_t value; Varint32() = default; Varint32(uint32_t value) : value(value) {} operator uint32_t &() { return value; } operator uint32_t() const { return value; } }; } // namespace hf3fs FMT_BEGIN_NAMES...
#pragma once #include <cstdint> #include <fmt/format.h> namespace hf3fs { struct Varint64 { uint64_t value; Varint64() = default; Varint64(uint64_t value) : value(value) {} operator uint64_t &() { return value; } operator uint64_t() const { return value; } }; } // namespace hf3fs FMT_BEGIN_NAMES...
#pragma once #include <cstdint> #include <string_view> namespace hf3fs { struct VersionInfo { static std::string_view fullV0(); static std::string_view full(); static uint8_t versionMajor(); static uint8_t versionMinor(); static uint8_t versionPatch(); static uint64_t buildTimeInSeconds(); static uint3...
#pragma once #include <folly/Random.h> #include <folly/Synchronized.h> #include <folly/executors/task_queue/UnboundedBlockingQueue.h> #include "common/utils/SimpleSemaphore.h" namespace hf3fs { namespace details { template <typename EndPredicate, typename T> class EndValueHolder { public: explicit EndValueHolder(...
#pragma once #define ZSTD_STATIC_LINKING_ONLY #include "third_party/zstd/lib/zstd.h"
#include "LauncherUtils.h" #include <folly/experimental/coro/BlockingWait.h> #include "common/utils/SysResource.h" #include "common/utils/VersionInfo.h" namespace hf3fs::core::launcher { flat::AppInfo buildBasicAppInfo(flat::NodeId nodeId, const String &clusterId) { auto hostnameResult = SysResource::hostname(); ...
#pragma once #include "common/app/AppInfo.h" namespace hf3fs::core::launcher { flat::AppInfo buildBasicAppInfo(flat::NodeId nodeId, const String &clusterId); } // namespace hf3fs::core::launcher
#include "MgmtdClientFetcher.h" #include <folly/experimental/coro/BlockingWait.h> #include "common/app/ApplicationBase.h" #include "stubs/common/RealStubFactory.h" #include "stubs/mgmtd/MgmtdServiceStub.h" namespace hf3fs::core::launcher { MgmtdClientFetcher::MgmtdClientFetcher(String clusterId, ...
#pragma once #include "LauncherUtils.h" #include "client/mgmtd/MgmtdClient.h" #include "common/net/Client.h" namespace hf3fs::core::launcher { struct MgmtdClientFetcher { MgmtdClientFetcher(String clusterId, const net::Client::Config &clientCfg, const client::MgmtdClient::C...
#include "ServerAppConfig.h" #include "common/app/ApplicationBase.h" namespace hf3fs::core { void ServerAppConfig::init(const String &filePath, bool dump, const std::vector<config::KeyValue> &updates) { auto res = ApplicationBase::initConfig(*this, filePath, dump, updates); XLOGF_IF(FATAL, !res, "Init app config ...
#pragma once #include "common/app/NodeId.h" #include "common/net/ib/IBDevice.h" #include "common/utils/ConfigBase.h" namespace hf3fs::core { struct ServerAppConfig : public ConfigBase<ServerAppConfig> { CONFIG_ITEM(node_id, 0); CONFIG_ITEM(allow_empty_node_id, true); public: using Base = ConfigBase<ServerAppC...
#include "ServerEnv.h" namespace hf3fs::core { namespace { template <typename Ptr> void setPtr(Ptr &src, Ptr &dst) { if (src.get() != dst.get()) { src.reset(); src = std::move(dst); } } } // namespace void ServerEnv::setAppInfo(flat::AppInfo appInfo) { appInfo_ = appInfo; } void ServerEnv::setKvEngine(...
#pragma once #include "common/app/AppInfo.h" #include "common/kv/IKVEngine.h" #include "common/utils/CPUExecutorGroup.h" #include "stubs/common/IStubFactory.h" #include "stubs/mgmtd/IMgmtdServiceStub.h" namespace hf3fs::core { class ServerEnv { public: const flat::AppInfo &appInfo() const { return appInfo_; } v...
#include "ServerLauncher.h" namespace hf3fs::core { Result<Void> ServerLauncherBase::parseFlags(int *argc, char ***argv) { static constexpr std::string_view appConfigPrefix = "--app_config."; static constexpr std::string_view launcherConfigPrefix = "--launcher_config."; RETURN_ON_ERROR(ApplicationBase::parseFlag...
#pragma once #include "LauncherUtils.h" #include "common/app/ApplicationBase.h" #include "common/utils/ConstructLog.h" #include "fbs/mgmtd/ConfigInfo.h" DECLARE_string(app_cfg); DECLARE_bool(dump_default_app_cfg); DECLARE_string(launcher_cfg); DECLARE_bool(dump_default_launcher_cfg); namespace hf3fs::core { class S...
#include "ServerLauncherConfig.h" #include "common/app/ApplicationBase.h" #include "common/app/Utils.h" namespace hf3fs::core { void ServerLauncherConfig::init(const String &filePath, bool dump, const std::vector<config::KeyValue> &updates) { app_detail::initConfigFromFile(*this, filePath, dump, updates); auto r...
#pragma once #include "client/mgmtd/MgmtdClient.h" #include "common/app/NodeId.h" #include "common/net/Client.h" #include "common/utils/ConfigBase.h" namespace hf3fs::core { struct ServerLauncherConfig : public ConfigBase<ServerLauncherConfig> { CONFIG_ITEM(cluster_id, ""); CONFIG_OBJ(ib_devices, net::IBDevice::C...
#include "ServerMgmtdClientFetcher.h" #include <folly/experimental/coro/BlockingWait.h> namespace hf3fs::core::launcher { Result<Void> ServerMgmtdClientFetcher::completeAppInfo(flat::AppInfo &appInfo) { RETURN_ON_ERROR(ensureClientInited()); return folly::coro::blockingWait([&]() -> CoTryTask<void> { auto rou...
#pragma once #include "MgmtdClientFetcher.h" namespace hf3fs::core::launcher { struct ServerMgmtdClientFetcher : public MgmtdClientFetcher { using MgmtdClientFetcher::MgmtdClientFetcher; Result<Void> completeAppInfo(flat::AppInfo &appInfo) final; }; } // namespace hf3fs::core::launcher
#include "CoreService.h" #include "core/service/ops/Include.h" #include "core/utils/runOp.h" #define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \ CoTryTask<rsptype> svc##Service::name(serde::CallContext &ctx, const reqtype &req) { \ Name##Operation op(std::move(req)); ...
#pragma once #include "common/serde/CallContext.h" #include "fbs/core/service/CoreServiceBase.h" namespace hf3fs::core { class CoreService : public serde::ServiceWrapper<CoreService, CoreServiceBase> { public: #define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \ CoTryTask<rsptype> name...
#pragma once #include "core/utils/ServiceOperation.h" #include "fbs/core/service/Rpc.h" namespace hf3fs::core { struct EchoOperation : ServiceOperationWithMetric<"CoreService", "Echo", "op"> { EchoMessage req; explicit EchoOperation(EchoMessage r) : req(std::move(r)) {} String toStringImpl() const fina...
#pragma once #include "common/app/ApplicationBase.h" #include "core/utils/ServiceOperation.h" #include "fbs/core/service/Rpc.h" namespace hf3fs::core { struct GetConfigOperation : ServiceOperationWithMetric<"CoreService", "GetConfig", "op"> { GetConfigReq req; explicit GetConfigOperation(GetConfigReq r) :...
#pragma once #include "common/app/ApplicationBase.h" #include "core/utils/ServiceOperation.h" #include "fbs/core/service/Rpc.h" namespace hf3fs::core { struct GetLastConfigUpdateRecordOperation : ServiceOperationWithMetric<"CoreService", "GetLastConfigUpdateRecord", "op"> { GetLastConfigUpdateRecordReq req; ...
#pragma once #include "common/app/ApplicationBase.h" #include "core/utils/ServiceOperation.h" #include "fbs/core/service/Rpc.h" namespace hf3fs::core { struct HotUpdateConfigOperation : ServiceOperationWithMetric<"CoreService", "HotUpdateConfig", "op"> { HotUpdateConfigReq req; explicit HotUpdateConfigOperation...
#pragma once #include "EchoOperation.h" #include "GetConfigOperation.h" #include "GetLastConfigUpdateRecordOperation.h" #include "HotUpdateConfigOperation.h" #include "RenderConfigOperation.h" #include "ShutdownOperation.h"
#pragma once #include "common/app/ApplicationBase.h" #include "core/utils/ServiceOperation.h" #include "fbs/core/service/Rpc.h" namespace hf3fs::core { struct RenderConfigOperation : ServiceOperationWithMetric<"CoreService", "RenderConfig", "op"> { RenderConfigReq req; explicit RenderConfigOperation(RenderConfi...
#pragma once #include "common/app/ApplicationBase.h" #include "common/utils/suicide.h" #include "core/utils/ServiceOperation.h" #include "fbs/core/service/Rpc.h" namespace hf3fs::core { struct ShutdownOperation : ServiceOperationWithMetric<"CoreService", "Shutdown", "op"> { ShutdownReq req_; explicit ShutdownOp...
#pragma once #include "common/utils/ConfigBase.h" #include "common/utils/LockManager.h" #include "common/utils/RobinHood.h" #include "common/utils/UtcTime.h" #include "fbs/core/user/User.h" namespace hf3fs::core { using flat::Gid; using flat::Uid; using flat::UserAttr; using flat::UserInfo; class UserCache { public...
#include "UserStore.h" #include <fmt/core.h> #include <folly/logging/xlog.h> #include "UserToken.h" #include "common/kv/KeyPrefix.h" #include "common/serde/Serde.h" #include "common/utils/Result.h" #include "common/utils/SerDeser.h" #include "core/user/UserCache.h" #include "fdb/FDBTransaction.h" namespace hf3fs::co...
#pragma once #include "common/kv/ITransaction.h" #include "core/user/UserCache.h" #include "fbs/core/user/User.h" namespace hf3fs::core { using flat::Gid; using flat::Uid; using flat::UserAttr; using flat::UserInfo; using hf3fs::kv::IReadOnlyTransaction; using hf3fs::kv::IReadWriteTransaction; class UserStore { pub...
#include "UserStoreEx.h" #include "UserToken.h" #include "common/kv/IKVEngine.h" #include "common/kv/WithTransaction.h" #include "fdb/FDBRetryStrategy.h" namespace hf3fs::core { UserStoreEx::UserStoreEx(kv::IKVEngine &kvEngine, const kv::TransactionRetry &transactionRetry, ...
#pragma once #include "UserCache.h" #include "UserStore.h" #include "common/kv/IKVEngine.h" #include "common/kv/TransactionRetry.h" namespace hf3fs::core { class UserStoreEx { public: UserStoreEx(kv::IKVEngine &kvEngine, const kv::TransactionRetry &transactionRetry, const UserCache::Config &cacheCfg); CoTryTas...
#include "UserToken.h" #include <folly/Random.h> #include <folly/base64.h> #include <folly/hash/Checksum.h> #include <folly/lang/Bits.h> #include "fdb/FDBTransaction.h" namespace hf3fs::core { namespace { const uint16_t magicNum = 0xF1DB; // clang-format off constexpr std::array<uint8_t, 18> mapping = { 12, 6, 0, ...
#pragma once #include "common/kv/ITransaction.h" #include "common/utils/Coroutine.h" #include "common/utils/Result.h" #include "fbs/core/user/User.h" namespace hf3fs::core { String encodeUserToken(uint32_t uid, uint64_t timestamp); CoTryTask<String> encodeUserToken(uint32_t uid, kv::IReadOnlyTransaction &txn); Resul...
#pragma once #include "common/utils/UtcTime.h" #define CO_INVOKE_OP(NORMAL_PATH_LOG_LEVEL, op, peer, ...) \ LOG_OP_##NORMAL_PATH_LOG_LEVEL(op, "start execution. from:{}", peer); \ auto guard = op.startRecord(); \ auto result...
#pragma once #include <fmt/format.h> #include <folly/experimental/symbolizer/Symbolizer.h> #include <folly/logging/xlog.h> #include "common/monitor/Recorder.h" #include "common/utils/NameWrapper.h" #include "common/utils/String.h" #define RETURN_AND_LOG_OP_ERR(...) RETURN_AND_LOG_OP_ERR_IMPL(return, __VA_ARGS__) #de...
#pragma once #include "Rpc.h" #include "common/serde/Service.h" namespace hf3fs::core { SERDE_SERVICE_2(CoreServiceBase, Core, 10001) { #define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \ SERDE_SERVICE_METHOD(name, id, reqtype, rsptype); #include "CoreServiceDef.h" }; } // namespace h...
#pragma once #include "CoreServiceBase.h" namespace hf3fs::core { SERDE_SERVICE_CLIENT(CoreServiceClient, CoreServiceBase); } // namespace hf3fs::core
#include "fbs/macros/SerdeDef.h" DEFINE_SERDE_SERVICE_METHOD(Core, echo, Echo, 1) DEFINE_SERDE_SERVICE_METHOD(Core, getConfig, GetConfig, 2) DEFINE_SERDE_SERVICE_METHOD(Core, renderConfig, RenderConfig, 3) DEFINE_SERDE_SERVICE_METHOD(Core, hotUpdateConfig, HotUpdateConfig, 4) DEFINE_SERDE_SERVICE_METHOD(Core, getLastC...
#pragma once #include "common/app/ApplicationBase.h" #include "common/serde/SerdeHelper.h" #include "common/utils/RobinHoodUtils.h" namespace hf3fs::core { struct EchoMessage : public serde::SerdeHelper<EchoMessage> { SERDE_STRUCT_FIELD(str, std::string{}); }; using EchoReq = EchoMessage; using EchoRsp = EchoMessa...
#include "User.h" #include "common/serde/SerdeComparisons.h" namespace hf3fs::flat { UserInfo::UserInfo(Uid uid, Gid gid, std::string token) : UserInfo(uid, gid, {}, std::move(token)) {} UserInfo::UserInfo(Uid uid, Gid gid, std::vector<Gid> groups, std::string token) : uid(uid), gid(gid), groups(...
#pragma once #include "common/serde/Serde.h" #include "common/utils/Duration.h" #include "common/utils/StrongType.h" #include "common/utils/Transform.h" #include "common/utils/UtcTimeSerde.h" namespace hf3fs::flat { STRONG_TYPEDEF(uint32_t, Uid); STRONG_TYPEDEF(uint32_t, Gid); // todo: add a format func for permissio...
#pragma once #include <sys/types.h> #include <sys/vfs.h> #include "common/serde/Serde.h" #include "common/utils/Uuid.h" namespace hf3fs::lib::agent { struct ProcessInfo { SERDE_STRUCT_TYPED_FIELD(int, pid, 0); SERDE_STRUCT_TYPED_FIELD(int, ppid, 0); }; struct TimeSpec { SERDE_STRUCT_TYPED_FIELD(time_t, sec, 0...
#pragma once #include "Schema.h" #include "fbs/core/user/User.h" #include "fbs/meta/Common.h" namespace hf3fs::lib::agent { using hf3fs::Result; template <typename ValType> struct OneValRsp { SERDE_STRUCT_TYPED_FIELD(ValType, val, ValType{}); }; using EmptyRsp = OneValRsp<Void>; struct ProcUser { SERDE_STRUCT_...
#include "common/utils/Coroutine.h" #ifdef DEFINE_FBS_SERVICE #undef DEFINE_FBS_SERVICE #endif #define DEFINE_FBS_SERVICE(name, fbsns) \ class I##name##ServiceStub { \ public: \ using InterfaceType = I##name##ServiceStub; \ ...
#include "common/utils/Result.h" #ifdef DEFINE_FBS_SERVICE #undef DEFINE_FBS_SERVICE #endif #define DEFINE_FBS_SERVICE(name, fbsns) \ class I##name##ServiceStub { \ public: \ using InterfaceType = I##name##ServiceStub; \ ...
#ifndef DEFINE_SERDE_SERVICE_METHOD_FULL #define DEFINE_SERDE_SERVICE_METHOD_FULL(ServiceName, methodName, MethodName, MethodId, RequestType, ResponseType) #endif #ifndef DEFINE_SERDE_SERVICE_METHOD #define DEFINE_SERDE_SERVICE_METHOD(ServiceName, methodName, MethodName, MethodId) \ DEFINE_SERDE_SERVICE_METHOD_FULL(...
#include "common/utils/Coroutine.h" #include "common/utils/Result.h" #ifdef DEFINE_FBS_SERVICE #undef DEFINE_FBS_SERVICE #endif #define DEFINE_FBS_SERVICE(name, fbsns) \ template <typename Ctx> \ class name##ServiceStub : public I##name##ServiceStub { \ public:...
#include "common/utils/Result.h" #ifdef DEFINE_FBS_SERVICE #undef DEFINE_FBS_SERVICE #endif #define DEFINE_FBS_SERVICE(name, fbsns) \ template <typename Ctx> \ class name##ServiceStub : public I##name##ServiceStub { \ public: ...
#ifdef DEFINE_SERDE_SERVICE_METHOD #undef DEFINE_SERDE_SERVICE_METHOD #endif #ifdef DEFINE_SERDE_SERVICE_METHOD_FULL #undef DEFINE_SERDE_SERVICE_METHOD_FULL #endif
#pragma once #include <array> #include <boost/detail/bitmask.hpp> #include <cstdint> #include <fcntl.h> #include <optional> #include <scn/scn.h> #include <scn/tuple_return.h> #include <string_view> #include <utility> #include <variant> #include "common/app/ClientId.h" #include "common/serde/Serde.h" #include "common/...
#include "FileOperation.h" #include <algorithm> #include <cassert> #include <cstdint> #include <folly/Math.h> #include <folly/logging/xlog.h> #include <limits> #include <type_traits> #include "common/utils/Result.h" #include "fmt/core.h" #define RECORD_LATENCY(name) ...
#pragma once #include <functional> #include <optional> #include <string_view> #include "client/storage/StorageClient.h" #include "client/storage/TargetSelection.h" #include "common/monitor/Recorder.h" #include "common/utils/Coroutine.h" #include "fbs/meta/Schema.h" #include "fbs/mgmtd/MgmtdTypes.h" namespace hf3fs::...
#pragma once #include "common/serde/CallContext.h" #include "common/serde/Service.h" #include "common/utils/Result.h" #include "fbs/meta/Service.h" namespace hf3fs::meta { class MockMetaService : public serde::ServiceWrapper<MockMetaService, MetaSerde> { public: virtual ~MockMetaService() = default; #define META...
#include "fbs/meta/Schema.h" #include <algorithm> #include <fmt/core.h> #include <folly/Overload.h> #include <folly/logging/xlog.h> #include <limits> #include <span> #include <variant> #include <vector> #include "common/utils/Result.h" #include "fbs/core/user/User.h" #include "fbs/meta/Common.h" #include "fbs/mgmtd/M...
#pragma once #include <atomic> #include <boost/filesystem/path.hpp> #include <cstdint> #include <fmt/core.h> #include <folly/Overload.h> #include <folly/Random.h> #include <folly/lang/Bits.h> #include <folly/logging/xlog.h> #include <folly/synchronization/DelayedInit.h> #include <limits> #include <linux/fs.h> #include...
#pragma once #include <fcntl.h> #include <folly/logging/xlog.h> #include <functional> #include <optional> #include <type_traits> #include <variant> #include <vector> #include "common/app/ClientId.h" #include "common/app/NodeId.h" #include "common/serde/Serde.h" #include "common/serde/Service.h" #include "common/utils...
#pragma once #include <array> #include <cassert> #include <cstdint> #include <folly/Conv.h> #include <folly/logging/xlog.h> #include <map> #include <optional> #include <string> #include <string_view> #include <type_traits> #include <utility> #include <variant> #include <vector> #include "common/app/NodeId.h" #include...
#include "ChainInfo.h" #include "common/serde/SerdeComparisons.h" namespace hf3fs::flat { bool ChainInfo::operator==(const ChainInfo &other) const { return serde::equals(*this, other); } } // namespace hf3fs::flat
#pragma once #include "ChainTargetInfo.h" namespace hf3fs::flat { struct ChainInfo : public serde::SerdeHelper<ChainInfo> { SERDE_STRUCT_FIELD(chainId, ChainId(0)); SERDE_STRUCT_FIELD(chainVersion, ChainVersion(0)); SERDE_STRUCT_FIELD(targets, std::vector<ChainTargetInfo>{}); SERDE_STRUCT_FIELD(preferredTarge...
#pragma once #include <fmt/core.h> #include <functional> #include "MgmtdTypes.h" #include "common/utils/StrongType.h" namespace hf3fs::flat { class ChainRef { public: ChainRef() {} ChainRef(ChainTableId tableId, ChainTableVersion tableVer, uint64_t index) : chainTableId(tableId), chainTableVersio...
#pragma once #include "ChainTargetSetting.h" namespace hf3fs::flat { struct ChainSetting : public serde::SerdeHelper<ChainSetting> { SERDE_STRUCT_FIELD(chainId, ChainId(0)); SERDE_STRUCT_FIELD(targets, std::vector<ChainTargetSetting>{}); SERDE_STRUCT_FIELD(setPreferredTargetOrder, false); }; } // namespace hf3...
#pragma once #include "ChainInfo.h" #include "common/serde/SerdeComparisons.h" namespace hf3fs::flat { struct ChainTable : public serde::SerdeHelper<ChainTable> { bool operator==(const ChainTable &other) const { return serde::equals(*this, other); } SERDE_STRUCT_FIELD(chainTableId, ChainTableId(0)); SERDE_STRU...
#pragma once #include "MgmtdTypes.h" #include "common/serde/SerdeComparisons.h" #include "common/serde/SerdeHelper.h" namespace hf3fs::flat { struct ChainTargetInfo : public serde::SerdeHelper<ChainTargetInfo> { bool operator==(const ChainTargetInfo &other) const { return serde::equals(*this, other); } SERDE_STR...
#pragma once #include "MgmtdTypes.h" #include "common/serde/SerdeComparisons.h" #include "common/serde/SerdeHelper.h" namespace hf3fs::flat { struct ChainTargetSetting : public serde::SerdeHelper<ChainTargetSetting> { SERDE_STRUCT_FIELD(targetId, TargetId(0)); auto operator<=>(const ChainTargetSetting &other) co...
#include "ClientSession.h" #include "Rpc.h" namespace hf3fs::flat { ClientSession::ClientSession(const mgmtd::ExtendClientSessionReq &req, UtcTime now) : clientId(req.clientId), configVersion(req.configVersion), start(now), lastExtend(now), universalId(req.data.universalId), descript...
#pragma once #include "ClientSessionData.h" #include "common/app/ConfigStatus.h" #include "common/utils/UtcTimeSerde.h" namespace hf3fs::mgmtd { struct ExtendClientSessionReq; } namespace hf3fs::flat { struct ClientSession : public serde::SerdeHelper<ClientSession> { SERDE_STRUCT_FIELD(clientId, String{}); SERDE...
#pragma once #include "MgmtdTypes.h" #include "common/app/AppInfo.h" #include "common/serde/SerdeComparisons.h" #include "common/serde/SerdeHelper.h" namespace hf3fs::flat { struct ClientSessionData : public serde::SerdeHelper<ClientSessionData> { bool operator==(const ClientSessionData &other) const { return serde...
#pragma once #include "MgmtdTypes.h" #include "common/serde/SerdeHelper.h" namespace hf3fs::flat { struct ConfigInfo : public serde::SerdeHelper<ConfigInfo> { SERDE_STRUCT_FIELD(configVersion, ConfigVersion(0)); SERDE_STRUCT_FIELD(content, String{}); SERDE_STRUCT_FIELD(desc, String{}); public: String genUpd...
#pragma once #include <variant> #include "LocalTargetInfo.h" #include "MgmtdTypes.h" #include "common/app/AppInfo.h" #include "common/app/ConfigStatus.h" namespace hf3fs::flat { class MetaHeartbeatInfo : public serde::SerdeHelper<MetaHeartbeatInfo> { public: static constexpr auto kTypeCode = NodeType::META; SE...
#pragma once #include "MgmtdTypes.h" #include "common/serde/SerdeComparisons.h" #include "common/serde/SerdeHelper.h" namespace hf3fs::flat { struct LocalTargetInfo : public serde::SerdeHelper<LocalTargetInfo> { bool operator==(const LocalTargetInfo &other) const { return serde::equals(*this, other); } SERDE_STR...
#pragma once #include "PersistentNodeInfo.h" #include "common/utils/UtcTimeSerde.h" namespace hf3fs::flat { struct MgmtdLeaseInfo : public serde::SerdeHelper<MgmtdLeaseInfo> { MgmtdLeaseInfo() = default; MgmtdLeaseInfo(PersistentNodeInfo primaryInfo, UtcTime leaseStart, UtcTime leaseEnd) : primary(std::move...
#pragma once #include "Rpc.h" #include "common/serde/Service.h" namespace hf3fs::mgmtd { SERDE_SERVICE_2(MgmtdServiceBase, Mgmtd, 217) { #define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \ SERDE_SERVICE_METHOD_REFL(name, id, reqtype, rsptype); #include "MgmtdServiceDef.h" }; } // name...
#pragma once #include "MgmtdServiceBase.h" namespace hf3fs::mgmtd { SERDE_SERVICE_CLIENT(MgmtdServiceClient, MgmtdServiceBase); } // namespace hf3fs::mgmtd
#include "fbs/macros/SerdeDef.h" DEFINE_SERDE_SERVICE_METHOD(Mgmtd, getPrimaryMgmtd, GetPrimaryMgmtd, 1) // 2 is deprecated DEFINE_SERDE_SERVICE_METHOD(Mgmtd, heartbeat, Heartbeat, 3) DEFINE_SERDE_SERVICE_METHOD(Mgmtd, registerNode, RegisterNode, 4) DEFINE_SERDE_SERVICE_METHOD(Mgmtd, getRoutingInfo, GetRoutingInfo, 5)...
#pragma once #include "common/app/NodeId.h" #include "common/utils/Address.h" #include "common/utils/Result.h" #include "common/utils/StrongType.h" #include "common/utils/Uuid.h" namespace hf3fs::flat { enum class PublicTargetState : uint8_t { INVALID = 0, SERVING = 1, LASTSRV = 2, SYNCING = 4, WAITING = 8,...
#include "NodeConversion.h" namespace hf3fs::flat { NodeInfo toNode(const PersistentNodeInfo &pn) { auto status = findTag(pn.tags, kDisabledTagKey) == -1 ? NodeStatus::HEARTBEAT_CONNECTING : NodeStatus::DISABLED; return NodeInfo::create(FbsAppInfo::create(pn.nodeId, pn.hostname, 0u, pn.serviceGroups), ...
#pragma once #include "NodeInfo.h" #include "PersistentNodeInfo.h" namespace hf3fs::flat { NodeInfo toNode(const PersistentNodeInfo &pn); PersistentNodeInfo toPersistentNode(const NodeInfo &node); } // namespace hf3fs::flat
#include "NodeInfo.h" namespace hf3fs::flat { std::vector<net::Address> NodeInfo::extractAddresses(const String &serviceName, std::optional<net::Address::Type> addressType) const { return flat::extractAddresses(app.serviceGroups, serviceName, addressType); } std:...
#pragma once #include <boost/algorithm/string.hpp> #include <span> #include "MgmtdTypes.h" #include "common/app/AppInfo.h" #include "common/app/ConfigStatus.h" #include "common/serde/SerdeHelper.h" #include "common/utils/Selector.h" #include "common/utils/UtcTimeSerde.h" namespace hf3fs::flat { struct NodeInfo : pu...
#pragma once #include "MgmtdTypes.h" #include "common/serde/SerdeHelper.h" #include "common/utils/UtcTimeSerde.h" namespace hf3fs::flat { struct NodeStatusChange : public serde::SerdeHelper<NodeStatusChange> { SERDE_STRUCT_FIELD(status, NodeStatus(NodeStatus::MIN)); SERDE_STRUCT_FIELD(time, UtcTime{}); }; } // n...
#pragma once #include "MgmtdTypes.h" #include "common/app/AppInfo.h" #include "common/serde/SerdeComparisons.h" #include "common/serde/SerdeHelper.h" namespace hf3fs::flat { struct PersistentNodeInfo : public serde::SerdeHelper<PersistentNodeInfo> { bool operator==(const PersistentNodeInfo &other) const { return se...
#include "RoutingInfo.h" #include <folly/logging/xlog.h> namespace hf3fs::flat { const ChainTable *RoutingInfo::getChainTable(ChainTableId tableId, ChainTableVersion tableVersion) const { auto tit = chainTables.find(tableId); if (tit == chainTables.end()) return nullptr; if (tit->second.empty()) return nullptr;...
#pragma once #include "ChainRef.h" #include "ChainTable.h" #include "MgmtdTypes.h" #include "NodeInfo.h" #include "TargetInfo.h" #include "common/utils/RobinHoodUtils.h" namespace hf3fs::flat { struct RoutingInfo : public serde::SerdeHelper<RoutingInfo> { // return nullptr if not found const ChainTable *getChainT...
#pragma once #include "ChainSetting.h" #include "ClientSession.h" #include "ClientSessionData.h" #include "ConfigInfo.h" #include "HeartbeatInfo.h" #include "NodeInfo.h" #include "PersistentNodeInfo.h" #include "RoutingInfo.h" #include "common/app/ConfigStatus.h" #include "fbs/core/user/User.h" namespace hf3fs::mgmtd...
#pragma once #include "ChainTargetInfo.h" #include "LocalTargetInfo.h" #include "common/serde/SerdeComparisons.h" namespace hf3fs::flat { struct TargetInfo : public serde::SerdeHelper<TargetInfo> { bool operator==(const TargetInfo &other) const { return serde::equals(*this, other); } SERDE_STRUCT_FIELD(targetId,...
#pragma once #include "common/serde/Serde.h" #include "common/serde/Service.h" #include "common/utils/UtcTime.h" #include "common/utils/Uuid.h" namespace hf3fs::migration { /* job state transition NotSubmitted --> Pending --> Running --> Succeeded | ^ ^ | ...