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

Method getExecutors

src/slave/http.cpp:1768–1842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1766
1767
1768Future<Response> Http::getExecutors(
1769 const mesos::agent::Call& call,
1770 ContentType contentType,
1771 const Option<Principal>& principal) const
1772{
1773 CHECK_EQ(mesos::agent::Call::GET_EXECUTORS, call.type());
1774
1775 LOG(INFO) << "Processing GET_EXECUTORS call";
1776
1777 return ObjectApprovers::create(
1778 slave->authorizer,
1779 principal,
1780 {VIEW_FRAMEWORK, VIEW_EXECUTOR})
1781 .then(defer(
1782 slave->self(),
1783 [this, contentType](
1784 const Owned<ObjectApprovers>& approvers) -> Response {
1785 // Serialize the following message:
1786 //
1787 // v1::agent::Response response;
1788 // response.set_type(mesos::agent::Response::GET_EXECUTORS);
1789 // *response.mutable_get_executors() = _...;
1790
1791 switch (contentType) {
1792 case ContentType::PROTOBUF: {
1793 string output;
1794 google::protobuf::io::StringOutputStream stream(&output);
1795 google::protobuf::io::CodedOutputStream writer(&stream);
1796
1797 WireFormatLite::WriteEnum(
1798 v1::agent::Response::kTypeFieldNumber,
1799 v1::agent::Response::GET_EXECUTORS,
1800 &writer);
1801
1802 WireFormatLite::WriteBytes(
1803 v1::agent::Response::kGetExecutorsFieldNumber,
1804 serializeGetExecutors(approvers),
1805 &writer);
1806
1807 // We must manually trim the unused buffer space since
1808 // we use the string before the coded output stream is
1809 // destructed.
1810 writer.Trim();
1811
1812 return OK(std::move(output), stringify(contentType));
1813 }
1814
1815 case ContentType::JSON: {
1816 string body = jsonify([&](JSON::ObjectWriter* writer) {
1817 const google::protobuf::Descriptor* descriptor =
1818 v1::agent::Response::descriptor();
1819
1820 int field;
1821
1822 field = v1::agent::Response::kTypeFieldNumber;
1823 writer->field(
1824 descriptor->FindFieldByNumber(field)->name(),
1825 v1::agent::Response::Type_Name(

Callers

nothing calls this directly

Calls 11

deferFunction · 0.85
OKClass · 0.85
jsonifyFunction · 0.85
NotAcceptableClass · 0.85
typeMethod · 0.80
fieldMethod · 0.80
createFunction · 0.50
stringifyFunction · 0.50
thenMethod · 0.45
selfMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected