Skip to content

Commit

Permalink
fix: fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
panlei-coder committed Jun 12, 2024
1 parent 4931473 commit 7bd918f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
15 changes: 7 additions & 8 deletions src/braft/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,22 +894,21 @@ void NodeImpl::unsafe_register_conf_change(const Configuration& old_conf,
return _conf_ctx.start(old_conf, new_conf, done);
}

butil::Status NodeImpl::list_peers(std::vector<PeerId>* peers) {
butil::Status NodeImpl::list_members(std::vector<PeerId>* peers, const ConfigurationEntry& conf) {
BAIDU_SCOPED_LOCK(_mutex);
if (_state != STATE_LEADER) {
return butil::Status(EPERM, "Not leader");
}
_conf.conf.list_peers(peers);
conf.conf.list_peers(peers);
return butil::Status::OK();
}

butil::Status NodeImpl::list_peers(std::vector<PeerId>* peers) {
return list_members(peers, _conf);
}

butil::Status NodeImpl::list_learners(std::vector<PeerId>* learners) {
BAIDU_SCOPED_LOCK(_mutex);
if (_state != STATE_LEADER) {
return butil::Status(EPERM, "Not leader");
}
_learner_conf.conf.list_peers(learners);
return butil::Status::OK();
return list_members(learners, _learner_conf);
}

void NodeImpl::add_peer(const PeerId& peer, Closure* done) {
Expand Down
3 changes: 2 additions & 1 deletion src/braft/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ friend class VoteBallotCtx;
// Otherwise we will specifit the error and call it.
//
void apply(const Task& task);


butil::Status list_members(std::vector<PeerId>* peers, const ConfigurationEntry& conf);
butil::Status list_peers(std::vector<PeerId>* peers);
butil::Status list_learners(std::vector<PeerId>* learners);

Expand Down

0 comments on commit 7bd918f

Please sign in to comment.