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

Function stripAllocationInfo

src/common/protobuf_utils.cpp:842–947  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840
841
842void stripAllocationInfo(Offer::Operation* operation)
843{
844 struct Stripper
845 {
846 void operator()(Resource& resource)
847 {
848 if (resource.has_allocation_info()) {
849 resource.clear_allocation_info();
850 }
851 }
852
853 void operator()(RepeatedPtrField<Resource>* resources)
854 {
855 foreach (Resource& resource, *resources) {
856 operator()(resource);
857 }
858 }
859 } strip;
860
861 switch (operation->type()) {
862 case Offer::Operation::LAUNCH: {
863 Offer::Operation::Launch* launch = operation->mutable_launch();
864
865 foreach (TaskInfo& task, *launch->mutable_task_infos()) {
866 strip(task.mutable_resources());
867
868 if (task.has_executor()) {
869 strip(task.mutable_executor()->mutable_resources());
870 }
871 }
872 break;
873 }
874
875 case Offer::Operation::LAUNCH_GROUP: {
876 Offer::Operation::LaunchGroup* launchGroup =
877 operation->mutable_launch_group();
878
879 if (launchGroup->has_executor()) {
880 strip(launchGroup->mutable_executor()->mutable_resources());
881 }
882
883 TaskGroupInfo* taskGroup = launchGroup->mutable_task_group();
884
885 foreach (TaskInfo& task, *taskGroup->mutable_tasks()) {
886 strip(task.mutable_resources());
887
888 if (task.has_executor()) {
889 strip(task.mutable_executor()->mutable_resources());
890 }
891 }
892 break;
893 }
894
895 case Offer::Operation::RESERVE: {
896 strip(operation->mutable_reserve()->mutable_resources());
897
898 break;
899 }

Callers 3

TESTFunction · 0.85
applyMethod · 0.85
_applyMethod · 0.85

Calls 2

typeMethod · 0.80
foreachFunction · 0.70

Tested by 1

TESTFunction · 0.68