mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
Initial commit
This commit is contained in:
20
src/core/utils/runOp.h
Normal file
20
src/core/utils/runOp.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#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 = co_await op.handle(__VA_ARGS__); \
|
||||
if (result.hasError()) { \
|
||||
guard.reportWithCode(result.error().code()); \
|
||||
LOG_OP_ERR(op, "failed: {}. latency: {}", result.error(), *guard.latency()); \
|
||||
CO_RETURN_ERROR(result); \
|
||||
} else { \
|
||||
guard.reportWithCode(StatusCode::kOK); \
|
||||
LOG_OP_##NORMAL_PATH_LOG_LEVEL(op, "succeeded. latency: {}", *guard.latency()); \
|
||||
co_return result; \
|
||||
}
|
||||
|
||||
#define CO_INVOKE_OP_INFO(...) CO_INVOKE_OP(INFO, __VA_ARGS__)
|
||||
#define CO_INVOKE_OP_DBG(...) CO_INVOKE_OP(DBG, __VA_ARGS__)
|
||||
Reference in New Issue
Block a user