MCPcopy Create free account
hub / github.com/XTXMarkets/ternfs / LeaderElection

Method LeaderElection

cpp/core/LogsDB.cpp:699–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

697class LeaderElection {
698public:
699 LeaderElection(Env& env, LogsDBStats& stats, bool noReplication, bool avoidBeingLeader, ReplicaId replicaId, LogMetadata& metadata, DataPartitions& data, ReqResp& reqResp) :
700 _env(env),
701 _stats(stats),
702 _noReplication(noReplication),
703 _avoidBeingLeader(avoidBeingLeader),
704 _replicaId(replicaId),
705 _metadata(metadata),
706 _data(data),
707 _reqResp(reqResp),
708 _state(LeadershipState::FOLLOWER),
709 _leaderLastActive(_noReplication ? 0 :ternNow()) {}
710
711 bool isLeader() const {
712 return _state == LeadershipState::LEADER;

Callers

nothing calls this directly

Calls 1

ternNowFunction · 0.85

Tested by

no test coverage detected