mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
Initial commit
This commit is contained in:
27
src/mgmtd/service/MgmtdOperator.cc
Normal file
27
src/mgmtd/service/MgmtdOperator.cc
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "MgmtdOperator.h"
|
||||
|
||||
#include <folly/experimental/coro/BlockingWait.h>
|
||||
|
||||
#include "core/utils/runOp.h"
|
||||
#include "mgmtd/ops/Include.h"
|
||||
|
||||
#define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, method, Method, Id, Req, Rsp) \
|
||||
CoTryTask<Rsp> svc##Operator::method(Req req, const net::PeerInfo &peer) { \
|
||||
Method##Operation op(std::move(req)); \
|
||||
CO_INVOKE_OP_INFO(op, peer.str, state_); \
|
||||
}
|
||||
|
||||
namespace hf3fs::mgmtd {
|
||||
|
||||
MgmtdOperator::MgmtdOperator(std::shared_ptr<core::ServerEnv> env, const MgmtdConfig &config)
|
||||
: state_(env, config),
|
||||
backgroundRunner_(state_) {}
|
||||
|
||||
void MgmtdOperator::start() { backgroundRunner_.start(); }
|
||||
|
||||
CoTask<void> MgmtdOperator::stop() { co_await backgroundRunner_.stop(); }
|
||||
|
||||
MgmtdOperator::~MgmtdOperator() { folly::coro::blockingWait(stop()); }
|
||||
|
||||
#include "fbs/mgmtd/MgmtdServiceDef.h"
|
||||
} // namespace hf3fs::mgmtd
|
||||
Reference in New Issue
Block a user