Rename yield_leader with yield_leadship and its variants

This commit is contained in:
Pradeep Chhetri 2023-11-06 23:04:10 +08:00
parent 361472b29e
commit 74b53218b8
5 changed files with 13 additions and 13 deletions

View File

@ -172,8 +172,8 @@ void FourLetterCommandFactory::registerCommands(KeeperDispatcher & keeper_dispat
FourLetterCommandPtr feature_flags_command = std::make_shared<FeatureFlagsCommand>(keeper_dispatcher);
factory.registerCommand(feature_flags_command);
FourLetterCommandPtr yield_leader_command = std::make_shared<YieldLeaderCommand>(keeper_dispatcher);
factory.registerCommand(yield_leader_command);
FourLetterCommandPtr yield_leadership_command = std::make_shared<YieldLeadershipCommand>(keeper_dispatcher);
factory.registerCommand(yield_leadership_command);
factory.initializeAllowList(keeper_dispatcher);
factory.setInitialize(true);
@ -582,9 +582,9 @@ String FeatureFlagsCommand::run()
return ret.str();
}
String YieldLeaderCommand::run()
String YieldLeadershipCommand::run()
{
return keeper_dispatcher.yieldLeader() ? "Sent yield leadership request to leader." : "Failed to send yield leadership request to leader.";
return keeper_dispatcher.yieldLeadership() ? "Sent yield leadership request to leader." : "Failed to send yield leadership request to leader.";
}
}

View File

@ -415,17 +415,17 @@ struct FeatureFlagsCommand : public IFourLetterCommand
~FeatureFlagsCommand() override = default;
};
/// Yield to be leader.
struct YieldLeaderCommand : public IFourLetterCommand
/// Yield leadership and become follower.
struct YieldLeadershipCommand : public IFourLetterCommand
{
explicit YieldLeaderCommand(KeeperDispatcher & keeper_dispatcher_)
explicit YieldLeadershipCommand(KeeperDispatcher & keeper_dispatcher_)
: IFourLetterCommand(keeper_dispatcher_)
{
}
String name() override { return "ydld"; }
String run() override;
~YieldLeaderCommand() override = default;
~YieldLeadershipCommand() override = default;
};
}

View File

@ -237,10 +237,10 @@ public:
return server->requestLeader();
}
/// Yield to be leader.
bool yieldLeader()
/// Yield leadership and become follower.
bool yieldLeadership()
{
return server->yieldLeader();
return server->yieldLeadership();
}
void recalculateStorageStats()

View File

@ -1087,7 +1087,7 @@ bool KeeperServer::requestLeader()
return isLeader() || raft_instance->request_leadership();
}
bool KeeperServer::yieldLeader()
bool KeeperServer::yieldLeadership()
{
return isLeader() && raft_instance->yield_leadership();
}

View File

@ -141,7 +141,7 @@ public:
bool requestLeader();
bool yieldLeader();
bool yieldLeadership();
void recalculateStorageStats();
};