Apache Mesos
type_utils.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __MESOS_TYPE_UTILS_H__
18 #define __MESOS_TYPE_UTILS_H__
19 
20 #include <iosfwd>
21 #include <string>
22 #include <vector>
23 
24 #include <boost/functional/hash.hpp>
25 
26 #include <google/protobuf/map.h>
27 #include <google/protobuf/repeated_field.h>
28 
29 #include <google/protobuf/util/message_differencer.h>
30 
31 #include <mesos/mesos.hpp>
32 
33 #include <stout/option.hpp>
34 #include <stout/stringify.hpp>
35 #include <stout/strings.hpp>
36 #include <stout/uuid.hpp>
37 
38 // This file includes definitions for operators on public protobuf
39 // classes (defined in mesos.proto, module.proto, etc.) that don't
40 // have these operators generated by the protobuf compiler. The
41 // corresponding definitions are in src/common/type_utils.cpp.
42 //
43 // Mesos modules need some of the protobuf classes defined in
44 // mesos.proto, module.proto, etc., and require some of these
45 // operators declared in type_utils.hpp. Exposing type_utils.hpp
46 // allows us to build modules without having a dependency on mesos
47 // source tree (src/*).
48 
49 namespace mesos {
50 
51 bool operator==(const CheckStatusInfo& left, const CheckStatusInfo& right);
52 bool operator==(const CommandInfo& left, const CommandInfo& right);
53 bool operator==(const CommandInfo::URI& left, const CommandInfo::URI& right);
54 bool operator==(const ContainerID& left, const ContainerID& right);
55 bool operator==(const ContainerInfo& left, const ContainerInfo& right);
56 bool operator==(const Credential& left, const Credential& right);
57 bool operator==(const CSIPluginInfo& left, const CSIPluginInfo& right);
58 
59 bool operator==(
60  const CSIPluginContainerInfo& left,
61  const CSIPluginContainerInfo& right);
62 
63 bool operator==(const DiscoveryInfo& left, const DiscoveryInfo& right);
64 bool operator==(const Environment& left, const Environment& right);
65 bool operator==(const ExecutorInfo& left, const ExecutorInfo& right);
66 bool operator==(const HealthCheck& left, const HealthCheck& right);
67 bool operator==(const KillPolicy& left, const KillPolicy& right);
68 bool operator==(const Label& left, const Label& right);
69 bool operator==(const Labels& left, const Labels& right);
70 bool operator==(const MasterInfo& left, const MasterInfo& right);
71 bool operator==(const Offer::Operation& left, const Offer::Operation& right);
72 bool operator==(const Operation& left, const Operation& right);
73 bool operator==(const OperationStatus& left, const OperationStatus& right);
74 
75 bool operator==(
76  const ResourceProviderInfo& left,
77  const ResourceProviderInfo& right);
78 
79 bool operator==(
80  const ResourceStatistics& left,
81  const ResourceStatistics& right);
82 
83 bool operator==(const SlaveInfo& left, const SlaveInfo& right);
84 bool operator==(const Task& left, const Task& right);
85 bool operator==(const TaskGroupInfo& left, const TaskGroupInfo& right);
86 bool operator==(const TaskInfo& left, const TaskInfo& right);
87 bool operator==(const TaskStatus& left, const TaskStatus& right);
88 bool operator==(const URL& left, const URL& right);
89 bool operator==(const UUID& left, const UUID& right);
90 bool operator==(const Volume& left, const Volume& right);
91 bool operator==(
92  const Volume::Source::CSIVolume::VolumeCapability& left,
93  const Volume::Source::CSIVolume::VolumeCapability& right);
94 
95 bool operator!=(const CheckStatusInfo& left, const CheckStatusInfo& right);
96 bool operator!=(const ExecutorInfo& left, const ExecutorInfo& right);
97 bool operator!=(const Labels& left, const Labels& right);
98 bool operator!=(const Offer::Operation& left, const Offer::Operation& right);
99 bool operator!=(const Operation& left, const Operation& right);
100 bool operator!=(const OperationStatus& left, const OperationStatus& right);
101 
102 bool operator!=(const TaskStatus& left, const TaskStatus& right);
103 bool operator!=(
104  const Volume::Source::CSIVolume::VolumeCapability& left,
105  const Volume::Source::CSIVolume::VolumeCapability& right);
106 
107 inline bool operator==(const ExecutorID& left, const ExecutorID& right)
108 {
109  return left.value() == right.value();
110 }
111 
112 
113 inline bool operator==(const FrameworkID& left, const FrameworkID& right)
114 {
115  return left.value() == right.value();
116 }
117 
118 
119 // This operator, which was comparing only `user` and `name` fields,
120 // has been deleted in favor of `typeutils::equivalent()` function (see below)
121 // with different semantics.
122 bool operator==(const FrameworkInfo& left, const FrameworkInfo& right) = delete;
123 
124 
125 namespace typeutils {
126 
127 // Returns whether two `FrameworkInfo`s are equivalent for framework
128 // subscription purposes or not (i.e. whether subscribing a framework with the
129 // `left` should have the same effects as with the `right`).
130 bool equivalent(const FrameworkInfo& left, const FrameworkInfo& right);
131 
132 // Performs the same comparison as `equivalent()` and returns a human-readable
133 // diff if the `FrameworkInfo`s are not equivalnt.
134 Option<std::string> diff(const FrameworkInfo& left, const FrameworkInfo& right);
135 
136 } // namespace typeutils {
137 
138 
139 inline bool operator==(const OfferID& left, const OfferID& right)
140 {
141  return left.value() == right.value();
142 }
143 
144 
145 inline bool operator==(const OperationID& left, const OperationID& right)
146 {
147  return left.value() == right.value();
148 }
149 
150 
151 inline bool operator==(
152  const ResourceProviderID& left,
153  const ResourceProviderID& right)
154 {
155  return left.value() == right.value();
156 }
157 
158 
159 inline bool operator==(const SlaveID& left, const SlaveID& right)
160 {
161  return left.value() == right.value();
162 }
163 
164 
165 inline bool operator==(const TaskID& left, const TaskID& right)
166 {
167  return left.value() == right.value();
168 }
169 
170 
171 inline bool operator==(const TimeInfo& left, const TimeInfo& right)
172 {
173  return left.nanoseconds() == right.nanoseconds();
174 }
175 
176 
177 inline bool operator==(const DurationInfo& left, const DurationInfo& right)
178 {
179  return left.nanoseconds() == right.nanoseconds();
180 }
181 
182 
183 inline bool operator==(const ContainerID& left, const std::string& right)
184 {
185  return left.value() == right;
186 }
187 
188 
189 inline bool operator==(const ExecutorID& left, const std::string& right)
190 {
191  return left.value() == right;
192 }
193 
194 
195 inline bool operator==(const FrameworkID& left, const std::string& right)
196 {
197  return left.value() == right;
198 }
199 
200 
201 inline bool operator==(const OfferID& left, const std::string& right)
202 {
203  return left.value() == right;
204 }
205 
206 
207 inline bool operator==(const SlaveID& left, const std::string& right)
208 {
209  return left.value() == right;
210 }
211 
212 
213 inline bool operator==(const TaskID& left, const std::string& right)
214 {
215  return left.value() == right;
216 }
217 
218 
219 inline bool operator==(
220  const DomainInfo::FaultDomain::RegionInfo& left,
221  const DomainInfo::FaultDomain::RegionInfo& right)
222 {
223  return left.name() == right.name();
224 }
225 
226 
227 inline bool operator==(
228  const DomainInfo::FaultDomain::ZoneInfo& left,
229  const DomainInfo::FaultDomain::ZoneInfo& right)
230 {
231  return left.name() == right.name();
232 }
233 
234 
235 inline bool operator==(
236  const DomainInfo::FaultDomain& left,
237  const DomainInfo::FaultDomain& right)
238 {
239  return left.region() == right.region() && left.zone() == right.zone();
240 }
241 
242 
243 inline bool operator==(const DomainInfo& left, const DomainInfo& right)
244 {
245  return left.fault_domain() == right.fault_domain();
246 }
247 
248 
249 inline bool operator==(const DrainInfo& left, const DrainInfo& right)
250 {
251  return google::protobuf::util::MessageDifferencer::Equals(left, right);
252 }
253 
254 
255 inline bool operator==(const DrainConfig& left, const DrainConfig& right)
256 {
257  return google::protobuf::util::MessageDifferencer::Equals(left, right);
258 }
259 
260 
265 inline bool operator==(const MachineID& left, const MachineID& right)
266 {
267  // NOTE: Both fields default to the empty string if they are not specified,
268  // so the string comparisons are safe.
269  return left.has_hostname() == right.has_hostname() &&
270  strings::lower(left.hostname()) == strings::lower(right.hostname()) &&
271  left.has_ip() == right.has_ip() &&
272  left.ip() == right.ip();
273 }
274 
275 
276 inline bool operator!=(const ContainerID& left, const ContainerID& right)
277 {
278  return !(left == right);
279 }
280 
281 
282 inline bool operator!=(
283  const CSIPluginContainerInfo& left,
284  const CSIPluginContainerInfo& right)
285 {
286  return !(left == right);
287 }
288 
289 
290 inline bool operator!=(const ExecutorID& left, const ExecutorID& right)
291 {
292  return left.value() != right.value();
293 }
294 
295 
296 inline bool operator!=(const FrameworkID& left, const FrameworkID& right)
297 {
298  return left.value() != right.value();
299 }
300 
301 
302 inline bool operator!=(const OperationID& left, const OperationID& right)
303 {
304  return left.value() != right.value();
305 }
306 
307 
308 inline bool operator!=(
309  const ResourceProviderID& left,
310  const ResourceProviderID& right)
311 {
312  return left.value() != right.value();
313 }
314 
315 
316 inline bool operator!=(const SlaveID& left, const SlaveID& right)
317 {
318  return left.value() != right.value();
319 }
320 
321 
322 inline bool operator!=(
323  const ResourceProviderInfo& left,
324  const ResourceProviderInfo& right)
325 {
326  return !(left == right);
327 }
328 
329 
330 inline bool operator!=(const TimeInfo& left, const TimeInfo& right)
331 {
332  return !(left == right);
333 }
334 
335 
336 inline bool operator!=(const UUID& left, const UUID& right)
337 {
338  return !(left == right);
339 }
340 
341 
342 inline bool operator!=(const DurationInfo& left, const DurationInfo& right)
343 {
344  return !(left == right);
345 }
346 
347 
348 inline bool operator!=(
349  const DomainInfo::FaultDomain::RegionInfo& left,
350  const DomainInfo::FaultDomain::RegionInfo& right)
351 {
352  return left.name() != right.name();
353 }
354 
355 
356 inline bool operator<(const ContainerID& left, const ContainerID& right)
357 {
358  return left.value() < right.value();
359 }
360 
361 
362 inline bool operator<(const DurationInfo& left, const DurationInfo& right)
363 {
364  return left.nanoseconds() < right.nanoseconds();
365 }
366 
367 
368 inline bool operator<(const ExecutorID& left, const ExecutorID& right)
369 {
370  return left.value() < right.value();
371 }
372 
373 
374 inline bool operator<(const FrameworkID& left, const FrameworkID& right)
375 {
376  return left.value() < right.value();
377 }
378 
379 
380 inline bool operator<(const OfferID& left, const OfferID& right)
381 {
382  return left.value() < right.value();
383 }
384 
385 
386 inline bool operator<(const SlaveID& left, const SlaveID& right)
387 {
388  return left.value() < right.value();
389 }
390 
391 
392 inline bool operator<(const TaskID& left, const TaskID& right)
393 {
394  return left.value() < right.value();
395 }
396 
397 
398 std::ostream& operator<<(
399  std::ostream& stream,
400  const CapabilityInfo& capabilityInfo);
401 
402 
403 std::ostream& operator<<(
404  std::ostream& stream,
405  const DeviceWhitelist& deviceWhitelist);
406 
407 
408 std::ostream& operator<<(
409  std::ostream& stream,
410  const CheckStatusInfo& checkStatusInfo);
411 
412 
413 std::ostream& operator<<(std::ostream& stream, const CommandInfo& commandInfo);
414 
415 
416 std::ostream& operator<<(std::ostream& stream, const ContainerID& containerId);
417 
418 
419 std::ostream& operator<<(
420  std::ostream& stream,
421  const ContainerInfo& containerInfo);
422 
423 
424 std::ostream& operator<<(std::ostream& stream, const DomainInfo& domainInfo);
425 
426 
427 std::ostream& operator<<(std::ostream& stream, const DrainConfig& drainConfig);
428 
429 
430 std::ostream& operator<<(std::ostream& stream, const DrainState& state);
431 
432 
433 std::ostream& operator<<(std::ostream& stream, const Environment& environment);
434 
435 
436 std::ostream& operator<<(std::ostream& stream, const ExecutorID& executorId);
437 
438 
439 std::ostream& operator<<(std::ostream& stream, const ExecutorInfo& executor);
440 
441 
442 std::ostream& operator<<(std::ostream& stream, const FrameworkID& frameworkId);
443 
444 
445 std::ostream& operator<<(std::ostream& stream, const MasterInfo& master);
446 
447 
448 std::ostream& operator<<(std::ostream& stream, const OfferID& offerId);
449 
450 
451 std::ostream& operator<<(std::ostream& stream, const OperationID& operationId);
452 
453 
454 std::ostream& operator<<(std::ostream& stream, const OperationState& state);
455 
456 
457 std::ostream& operator<<(std::ostream& stream, const Operation& operation);
458 
459 
460 std::ostream& operator<<(std::ostream& stream, const RateLimits& limits);
461 
462 
463 std::ostream& operator<<(
464  std::ostream& stream,
465  const ResourceProviderID& resourceProviderId);
466 
467 
468 std::ostream& operator<<(
469  std::ostream& stream,
470  const ResourceProviderInfo& resourceProviderInfo);
471 
472 
473 std::ostream& operator<<(std::ostream& stream, const RLimitInfo& rlimitInfo);
474 
475 
476 std::ostream& operator<<(std::ostream& stream, const SlaveID& slaveId);
477 
478 
479 std::ostream& operator<<(std::ostream& stream, const SlaveInfo& slave);
480 
481 
482 std::ostream& operator<<(std::ostream& stream, const TaskID& taskId);
483 
484 
485 std::ostream& operator<<(std::ostream& stream, const MachineID& machineId);
486 
487 
488 std::ostream& operator<<(std::ostream& stream, const TaskInfo& task);
489 
490 
491 std::ostream& operator<<(std::ostream& stream, const TaskState& state);
492 
493 
494 std::ostream& operator<<(
495  std::ostream& stream,
496  const UUID& uuid);
497 
498 
499 std::ostream& operator<<(std::ostream& stream, const CheckInfo::Type& type);
500 
501 
502 std::ostream& operator<<(
503  std::ostream& stream,
504  const CSIPluginContainerInfo::Service& service);
505 
506 
507 std::ostream& operator<<(
508  std::ostream& stream,
509  const FrameworkInfo::Capability& capability);
510 
511 
512 std::ostream& operator<<(std::ostream& stream, const Image::Type& imageType);
513 
514 
515 std::ostream& operator<<(std::ostream& stream, const Secret::Type& secretType);
516 
517 
518 std::ostream& operator<<(
519  std::ostream& stream,
520  const Offer::Operation::Type& operationType);
521 
522 
523 std::ostream& operator<<(
524  std::ostream& stream,
525  const Resource::DiskInfo::Source::Type& sourceType);
526 
527 
528 template <typename T>
529 inline std::ostream& operator<<(
530  std::ostream& stream,
531  const std::vector<T>& messages)
532 {
533  stream << "[ ";
534  for (auto it = messages.begin(); it != messages.end(); ++it) {
535  if (it != messages.begin()) {
536  stream << ", ";
537  }
538  stream << *it;
539  }
540  stream << " ]";
541  return stream;
542 }
543 
544 } // namespace mesos {
545 
546 
552 namespace google {
553 namespace protobuf {
554 
555 template <typename Key, typename Value>
556 inline bool operator==(
557  const Map<Key, Value>& left, const Map<Key, Value>& right)
558 {
559  if (left.size() != right.size()) {
560  return false;
561  }
562 
563  for (auto it = left.begin(); it != left.end(); ++it) {
564  auto found = right.find(it->first);
565  if (found == right.end() || found->second != it->second) {
566  return false;
567  }
568  }
569 
570  return true;
571 }
572 
573 
574 template <typename Key, typename Value>
575 inline bool operator!=(
576  const Map<Key, Value>& left, const Map<Key, Value>& right)
577 {
578  return !(left == right);
579 }
580 
581 
582 template <typename Key, typename Value>
583 inline std::ostream& operator<<(
584  std::ostream& stream, const Map<Key, Value>& map)
585 {
586  stream << "{ ";
587  for (auto it = map.cbegin(); it != map.end(); ++it) {
588  if (it != map.cbegin()) {
589  stream << ", ";
590  }
591  stream << it->first << ": " << it->second;
592  }
593  stream << " }";
594 
595  return stream;
596 }
597 
598 
599 template <typename T>
600 inline std::ostream& operator<<(
601  std::ostream& stream,
602  const RepeatedPtrField<T>& messages)
603 {
604  stream << "[ ";
605  for (auto it = messages.begin(); it != messages.end(); ++it) {
606  if (it != messages.begin()) {
607  stream << ", ";
608  }
609  stream << *it;
610  }
611  stream << " ]";
612  return stream;
613 }
614 
615 } // namespace protobuf {
616 } // namespace google {
617 
618 
619 namespace std {
620 
621 template <>
622 struct hash<mesos::CommandInfo::URI>
623 {
624  typedef size_t result_type;
625 
626  typedef mesos::CommandInfo::URI argument_type;
627 
628  result_type operator()(const argument_type& uri) const
629  {
630  size_t seed = 0;
631 
632  if (uri.extract()) {
633  seed += 11;
634  }
635 
636  if (uri.executable()) {
637  seed += 2003;
638  }
639 
640  boost::hash_combine(seed, uri.value());
641  boost::hash_combine(seed, uri.output_file());
642  return seed;
643  }
644 };
645 
646 
647 template <>
648 struct hash<mesos::ContainerID>
649 {
650  typedef size_t result_type;
651 
652  typedef mesos::ContainerID argument_type;
653 
654  result_type operator()(const argument_type& containerId) const
655  {
656  size_t seed = 0;
657  boost::hash_combine(seed, containerId.value());
658 
659  if (containerId.has_parent()) {
660  boost::hash_combine(
661  seed,
662  std::hash<mesos::ContainerID>()(containerId.parent()));
663  }
664 
665  return seed;
666  }
667 };
668 
669 
670 template <>
671 struct hash<mesos::ExecutorID>
672 {
673  typedef size_t result_type;
674 
675  typedef mesos::ExecutorID argument_type;
676 
677  result_type operator()(const argument_type& executorId) const
678  {
679  size_t seed = 0;
680  boost::hash_combine(seed, executorId.value());
681  return seed;
682  }
683 };
684 
685 
686 template <>
687 struct hash<mesos::FrameworkID>
688 {
689  typedef size_t result_type;
690 
691  typedef mesos::FrameworkID argument_type;
692 
693  result_type operator()(const argument_type& frameworkId) const
694  {
695  size_t seed = 0;
696  boost::hash_combine(seed, frameworkId.value());
697  return seed;
698  }
699 };
700 
701 
702 template <>
703 struct hash<mesos::Image::Type>
704 {
705  typedef size_t result_type;
706 
708 
709  result_type operator()(const argument_type& imageType) const
710  {
711  // Use the underlying type of the enum as hash value.
712  return static_cast<size_t>(imageType);
713  }
714 };
715 
716 
717 template <>
718 struct hash<mesos::MachineID>
719 {
720  typedef size_t result_type;
721 
722  typedef mesos::MachineID argument_type;
723 
724  result_type operator()(const argument_type& machineId) const
725  {
726  size_t seed = 0;
727  boost::hash_combine(seed, strings::lower(machineId.hostname()));
728  boost::hash_combine(seed, machineId.ip());
729  return seed;
730  }
731 };
732 
733 
734 template <>
735 struct hash<mesos::OfferID>
736 {
737  typedef size_t result_type;
738 
739  typedef mesos::OfferID argument_type;
740 
741  result_type operator()(const argument_type& offerId) const
742  {
743  size_t seed = 0;
744  boost::hash_combine(seed, offerId.value());
745  return seed;
746  }
747 };
748 
749 
750 template <>
751 struct hash<mesos::OperationID>
752 {
753  typedef size_t result_type;
754 
755  typedef mesos::OperationID argument_type;
756 
757  result_type operator()(const argument_type& operationId) const
758  {
759  size_t seed = 0;
760  boost::hash_combine(seed, operationId.value());
761  return seed;
762  }
763 };
764 
765 
766 template <>
767 struct hash<mesos::ResourceProviderID>
768 {
769  typedef size_t result_type;
770 
771  typedef mesos::ResourceProviderID argument_type;
772 
773  result_type operator()(const argument_type& resourceProviderId) const
774  {
775  size_t seed = 0;
776  boost::hash_combine(seed, resourceProviderId.value());
777  return seed;
778  }
779 };
780 
781 
782 template <>
783 struct hash<mesos::SlaveID>
784 {
785  typedef size_t result_type;
786 
787  typedef mesos::SlaveID argument_type;
788 
789  result_type operator()(const argument_type& slaveId) const
790  {
791  size_t seed = 0;
792  boost::hash_combine(seed, slaveId.value());
793  return seed;
794  }
795 };
796 
797 
798 template <>
799 struct hash<mesos::TaskID>
800 {
801  typedef size_t result_type;
802 
803  typedef mesos::TaskID argument_type;
804 
805  result_type operator()(const argument_type& taskId) const
806  {
807  size_t seed = 0;
808  boost::hash_combine(seed, taskId.value());
809  return seed;
810  }
811 };
812 
813 
814 template <>
815 struct hash<mesos::TaskState>
816 {
817  typedef size_t result_type;
818 
819  typedef mesos::TaskState argument_type;
820 
821  result_type operator()(const argument_type& taskState) const
822  {
823  // Use the underlying type of the enum as hash value.
824  return static_cast<size_t>(taskState);
825  }
826 };
827 
828 
829 template <>
830 struct hash<mesos::TaskStatus_Source>
831 {
832  typedef size_t result_type;
833 
834  typedef mesos::TaskStatus_Source argument_type;
835 
836  result_type operator()(const argument_type& source) const
837  {
838  // Use the underlying type of the enum as hash value.
839  return static_cast<size_t>(source);
840  }
841 };
842 
843 
844 template <>
845 struct hash<mesos::TaskStatus_Reason>
846 {
847  typedef size_t result_type;
848 
849  typedef mesos::TaskStatus_Reason argument_type;
850 
851  result_type operator()(const argument_type& reason) const
852  {
853  // Use the underlying type of the enum as hash value.
854  return static_cast<size_t>(reason);
855  }
856 };
857 
858 
859 template <>
860 struct hash<mesos::UUID>
861 {
862  typedef size_t result_type;
863 
864  typedef mesos::UUID argument_type;
865 
866  result_type operator()(const argument_type& uuid) const
867  {
868  size_t seed = 0;
869  boost::hash_combine(seed, uuid.value());
870  return seed;
871  }
872 };
873 
874 
875 template <>
876 struct hash<std::pair<mesos::FrameworkID, mesos::ExecutorID>>
877 {
878  typedef size_t result_type;
879 
880  typedef std::pair<
881  mesos::FrameworkID, mesos::ExecutorID> argument_type;
882 
883  result_type operator()(const argument_type& pair) const
884  {
885  size_t seed = 0;
886  boost::hash_combine(seed, std::hash<mesos::FrameworkID>()(pair.first));
887  boost::hash_combine(seed, std::hash<mesos::ExecutorID>()(pair.second));
888  return seed;
889  }
890 };
891 
892 
893 template <>
894 struct hash<std::pair<mesos::FrameworkID, mesos::OperationID>>
895 {
896  typedef size_t result_type;
897 
898  typedef std::pair<
899  mesos::FrameworkID, mesos::OperationID> argument_type;
900 
901  result_type operator()(const argument_type& pair) const
902  {
903  size_t seed = 0;
904  boost::hash_combine(seed, std::hash<mesos::FrameworkID>()(pair.first));
905  boost::hash_combine(seed, std::hash<mesos::OperationID>()(pair.second));
906  return seed;
907  }
908 };
909 
910 } // namespace std {
911 
912 #endif // __MESOS_TYPE_UTILS_H__
std::ostream & operator<<(std::ostream &stream, const Attribute &attribute)
size_t result_type
Definition: type_utils.hpp:862
Definition: type_utils.hpp:687
mesos::MachineID argument_type
Definition: type_utils.hpp:722
result_type operator()(const argument_type &executorId) const
Definition: type_utils.hpp:677
size_t result_type
Definition: type_utils.hpp:673
Definition: master.hpp:27
result_type operator()(const argument_type &containerId) const
Definition: type_utils.hpp:654
mesos::Image::Type argument_type
Definition: type_utils.hpp:707
result_type operator()(const argument_type &slaveId) const
Definition: type_utils.hpp:789
result_type operator()(const argument_type &uri) const
Definition: type_utils.hpp:628
size_t result_type
Definition: type_utils.hpp:801
result_type operator()(const argument_type &resourceProviderId) const
Definition: type_utils.hpp:773
result_type operator()(const argument_type &pair) const
Definition: type_utils.hpp:901
mesos::TaskStatus_Source argument_type
Definition: type_utils.hpp:834
bool operator==(const Resource::ReservationInfo &left, const Resource::ReservationInfo &right)
Definition: type_utils.hpp:619
result_type operator()(const argument_type &offerId) const
Definition: type_utils.hpp:741
mesos::TaskState argument_type
Definition: type_utils.hpp:819
mesos::ContainerID argument_type
Definition: type_utils.hpp:652
Capability
Definition: capabilities.hpp:35
result_type operator()(const argument_type &reason) const
Definition: type_utils.hpp:851
Operation
Definition: cgroups.hpp:444
result_type operator()(const argument_type &machineId) const
Definition: type_utils.hpp:724
size_t result_type
Definition: type_utils.hpp:720
bool operator<(const ContainerID &left, const ContainerID &right)
Definition: type_utils.hpp:356
mesos::TaskID argument_type
Definition: type_utils.hpp:803
size_t result_type
Definition: type_utils.hpp:847
size_t result_type
Definition: type_utils.hpp:832
mesos::ResourceProviderID argument_type
Definition: type_utils.hpp:771
mesos::FrameworkID argument_type
Definition: type_utils.hpp:691
size_t result_type
Definition: type_utils.hpp:705
result_type operator()(const argument_type &source) const
Definition: type_utils.hpp:836
bool operator!=(const Resource::ReservationInfo &left, const Resource::ReservationInfo &right)
Environment * environment
mesos::UUID argument_type
Definition: type_utils.hpp:864
Option< std::string > diff(const FrameworkInfo &left, const FrameworkInfo &right)
result_type operator()(const argument_type &uuid) const
Definition: type_utils.hpp:866
Definition: agent.hpp:25
size_t result_type
Definition: type_utils.hpp:737
size_t result_type
Definition: type_utils.hpp:817
size_t result_type
Definition: type_utils.hpp:624
Definition: protobuf.hpp:61
size_t result_type
Definition: type_utils.hpp:753
result_type operator()(const argument_type &taskId) const
Definition: type_utils.hpp:805
std::pair< mesos::FrameworkID, mesos::ExecutorID > argument_type
Definition: type_utils.hpp:881
result_type operator()(const argument_type &frameworkId) const
Definition: type_utils.hpp:693
Iterable< V > map(F &&f, const Iterable< U, Us... > &input)
Definition: lambda.hpp:46
bool equivalent(const FrameworkInfo &left, const FrameworkInfo &right)
result_type operator()(const argument_type &pair) const
Definition: type_utils.hpp:883
Type
Definition: capabilities.hpp:82
CSIPluginContainerInfo::Service Service
Definition: service_manager.hpp:38
std::pair< mesos::FrameworkID, mesos::OperationID > argument_type
Definition: type_utils.hpp:899
mesos::CommandInfo::URI argument_type
Definition: type_utils.hpp:626
Try< uint32_t > type(const std::string &path)
Definition: type_utils.hpp:648
size_t result_type
Definition: type_utils.hpp:650
Definition: uri.hpp:21
Type utilities for the protobuf library that are not specific to particular protobuf classes...
Definition: type_utils.hpp:552
mesos::ExecutorID argument_type
Definition: type_utils.hpp:675
result_type operator()(const argument_type &imageType) const
Definition: type_utils.hpp:709
size_t result_type
Definition: type_utils.hpp:785
mesos::SlaveID argument_type
Definition: type_utils.hpp:787
mesos::TaskStatus_Reason argument_type
Definition: type_utils.hpp:849
std::string lower(const std::string &s)
Definition: strings.hpp:429
Definition: type_utils.hpp:751
mesos::OperationID argument_type
Definition: type_utils.hpp:755
mesos::OfferID argument_type
Definition: type_utils.hpp:739
size_t result_type
Definition: type_utils.hpp:769
result_type operator()(const argument_type &operationId) const
Definition: type_utils.hpp:757
Definition: type_utils.hpp:671
size_t result_type
Definition: type_utils.hpp:689
result_type operator()(const argument_type &taskState) const
Definition: type_utils.hpp:821