MCPcopy Create free account
hub / github.com/apache/mesos / elect

Method elect

src/log/coordinator.cpp:143–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142
143Future<Option<uint64_t>> CoordinatorProcess::elect()
144{
145 if (state == ELECTING) {
146 return electing;
147 } else if (state == ELECTED) {
148 return index - 1; // The last learned position!
149 } else if (state == WRITING) {
150 return Failure("Coordinator already elected, and is currently writing");
151 }
152
153 CHECK_EQ(state, INITIAL);
154
155 state = ELECTING;
156
157 electing = getLastProposal()
158 .then(defer(self(), &Self::updateProposal, lambda::_1))
159 .then(defer(self(), &Self::runPromisePhase))
160 .then(defer(self(), &Self::checkPromisePhase, lambda::_1))
161 .onReady(defer(self(), &Self::electingFinished, lambda::_1))
162 .onFailed(defer(self(), &Self::electingFailed))
163 .onDiscarded(defer(self(), &Self::electingAborted));
164
165 return electing;
166}
167
168
169Future<uint64_t> CoordinatorProcess::getLastProposal()

Callers 2

_startMethod · 0.80
TEST_FFunction · 0.80

Calls 4

FailureClass · 0.85
deferFunction · 0.85
dispatchFunction · 0.50
thenMethod · 0.45

Tested by 1

TEST_FFunction · 0.64