-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Extend CAS in Raft #800
Extend CAS in Raft #800
Conversation
dangleptr
commented
Aug 19, 2019
- Support more atomic operations not only cas
- We could pass the atomic operator into raft, and it will be invoked atomically.
Unit testing passed. |
auto casRet = compareAndSet(log); | ||
if (casRet.empty()) { | ||
[this] (AtomicOp op) -> std::string { | ||
auto opRet = op(); |
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.
According to my understanding, in AtomicOp, user just define whatever they want to do atomically, and return the result as a string.
Why don't we just pass the AtomicOp
instead of folly::Function<std::string(AtomicOp op)> opCB
, it seems a little bit weird.
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.
Because we will set promise value, if we implement the logic directly in Iterator, you have to pass the whole part into it. This is not what we want.
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.
LGTM
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.
LGTM
Unit testing passed. |
* optimize bfs * optimizer allpath * optimizer multi-shortestpath * optimizer multi shortest path * fix validate unit test * add some comment * fix error * fix bfs error * add comment * delete conjunct * add findpath unit test * delete useless file * delete log * remove check * multi thread executor * single shortest multi thread * add some testcases * add gflags * fix bfs error * address comment Co-authored-by: jimingquan <mingquan.ji@vesoft.com>