mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
Initial commit
This commit is contained in:
22
tests/stubs/DummyMgmtdServiceStub.h
Normal file
22
tests/stubs/DummyMgmtdServiceStub.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "stubs/mgmtd/IMgmtdServiceStub.h"
|
||||
|
||||
#define DEFINE_SERDE_SERVICE_METHOD_FULL(svc, name, Name, id, reqtype, rsptype) \
|
||||
std::function<Result<rsptype>(const reqtype &)> name##Func; \
|
||||
DummyMgmtdServiceStub &set_##name##Func(auto &&func) { \
|
||||
name##Func = std::forward<decltype(func)>(func); \
|
||||
return *this; \
|
||||
} \
|
||||
CoTryTask<rsptype> name(const reqtype &req) override { \
|
||||
if (name##Func) { \
|
||||
co_return name##Func(req); \
|
||||
} \
|
||||
co_return makeError(RPCCode::kConnectFailed); \
|
||||
}
|
||||
|
||||
namespace hf3fs::mgmtd {
|
||||
struct DummyMgmtdServiceStub : public IMgmtdServiceStub {
|
||||
#include "fbs/mgmtd/MgmtdServiceDef.h"
|
||||
};
|
||||
} // namespace hf3fs::mgmtd
|
||||
Reference in New Issue
Block a user