Apache Mesos
state.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 __VOLUME_CSI_ISOLATOR_STATE_HPP__
18 #define __VOLUME_CSI_ISOLATOR_STATE_HPP__
19 
20 #include <string>
21 
22 #include <boost/functional/hash.hpp>
23 
24 // ONLY USEFUL AFTER RUNNING PROTOC.
25 #include "slave/containerizer/mesos/isolators/volume/csi/state.pb.h"
26 
27 namespace mesos {
28 namespace internal {
29 namespace slave {
30 
31 inline bool operator==(const CSIVolume& left, const CSIVolume& right)
32 {
33  return (left.plugin_name() == right.plugin_name()) &&
34  (left.id() == right.id());
35 }
36 
37 } // namespace slave {
38 } // namespace internal {
39 } // namespace mesos {
40 
41 
42 namespace std {
43 
44 template <>
46 {
47  typedef size_t result_type;
48 
50 
51  result_type operator()(const argument_type& volume) const
52  {
53  size_t seed = 0;
54  boost::hash_combine(seed, std::hash<std::string>()(volume.plugin_name()));
55  boost::hash_combine(seed, std::hash<std::string>()(volume.id()));
56  return seed;
57  }
58 };
59 
60 } // namespace std {
61 
62 #endif // __VOLUME_CSI_ISOLATOR_STATE_HPP__
bool operator==(const DockerVolume &left, const DockerVolume &right)
Definition: state.hpp:29
result_type operator()(const argument_type &volume) const
Definition: state.hpp:51
Definition: type_utils.hpp:619
size_t result_type
Definition: state.hpp:47
Volume::Source::CSIVolume CSIVolume
Definition: v0_utils.hpp:33
Definition: agent.hpp:25
mesos::internal::slave::CSIVolume argument_type
Definition: state.hpp:49
Definition: attributes.hpp:24