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

Method weights

src/master/http.cpp:2161–2189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2159
2160
2161Future<Response> Master::Http::weights(
2162 const Request& request,
2163 const Option<Principal>& principal) const
2164{
2165 // TODO(greggomann): Remove this check once the `Principal` type is used in
2166 // `ReservationInfo`, `DiskInfo`, and within the master's `principals` map.
2167 // See MESOS-7202.
2168 if (principal.isSome() && principal->value.isNone()) {
2169 return Forbidden(
2170 "The request's authenticated principal contains claims, but no value "
2171 "string. The master currently requires that principals have a value");
2172 }
2173
2174 // When current master is not the leader, redirect to the leading master.
2175 if (!master->elected()) {
2176 return redirect(request);
2177 }
2178
2179 if (request.method == "GET") {
2180 return weightsHandler.get(request, principal);
2181 }
2182
2183 // Dispatch based on HTTP method to separate `WeightsHandler`.
2184 if (request.method == "PUT") {
2185 return weightsHandler.update(request, principal);
2186 }
2187
2188 return MethodNotAllowed({"GET", "PUT"}, request.method);
2189}
2190
2191
2192string Master::Http::STATE_HELP()

Callers 3

TEST_FFunction · 0.80
foreachFunction · 0.80
initializeMethod · 0.80

Calls 8

ForbiddenClass · 0.85
redirectFunction · 0.85
MethodNotAllowedClass · 0.85
electedMethod · 0.80
isSomeMethod · 0.45
isNoneMethod · 0.45
getMethod · 0.45
updateMethod · 0.45

Tested by 1

TEST_FFunction · 0.64