-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat]: curvefs: merge two rpc into one when delete #2744
Conversation
a0aafd4
to
0ef9c99
Compare
cicheck |
sorry, now need rebase. |
c553928
to
75e591e
Compare
cicheck |
struct timespec now; | ||
clock_gettime(CLOCK_REALTIME, &now); | ||
Time* tm = new Time(); | ||
tm->set_sec(now.tv_sec); | ||
tm->set_nsec(now.tv_nsec); | ||
request.set_allocated_time(tm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These codes are repeated multiple times, e.g., L258-263, consider extra into a function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
curvefs/src/metaserver/metastore.cpp
Outdated
uint64_t now = 0; | ||
uint32_t now_ns = 0; | ||
if (request->has_time()) { | ||
now = request->time().sec(); | ||
now_ns = request->time().nsec(); | ||
} | ||
Time tm; | ||
tm.set_sec(now); | ||
tm.set_nsec(now_ns); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, repeated with L369
2f78fb7
to
147109e
Compare
cicheck |
147109e
to
f64f561
Compare
cicheck |
2 similar comments
cicheck |
cicheck |
Time* MetaServerClientImpl::CreateTime() { | ||
struct timespec now; | ||
clock_gettime(CLOCK_REALTIME, &now); | ||
Time* tm = new Time(); | ||
tm->set_sec(now.tv_sec); | ||
tm->set_nsec(now.tv_nsec); | ||
return tm; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more appropriate to do something like this,
void SetCreateTime(Time* tm) {
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
tm->set_sec(now.tv_sec);
tm->set_nsec(now.tv_nsec);
}
// caller
SetCreateTime(request.mutable_create());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
8ff8452
to
7c46d16
Compare
cicheck |
1 similar comment
cicheck |
@@ -107,6 +107,13 @@ class MetaServerClientRpcDoneBase : public google::protobuf::Closure { | |||
MetaServerClientMetric *metric_; | |||
}; | |||
|
|||
void MetaServerClientImpl::SetCreateTime(Time* tm) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetCreateTime
should not be a member function, define it as a free function is ok.
7c46d16
to
66c5af7
Compare
cicheck |
Signed-off-by: swj <1186093704@qq.com>
66c5af7
to
f546ecb
Compare
cicheck |
@SeanHai PTAL |
What problem does this PR solve?
Issue Number: #2548
Problem Summary:
What is changed and how it works?
What's Changed:
How it Works:
Side effects(Breaking backward compatibility? Performance regression?):
Check List