Apache Mesos
anonymous.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_MODULE_ANONYMOUS_HPP__
18 #define __MESOS_MODULE_ANONYMOUS_HPP__
19 
20 #include <mesos/mesos.hpp>
21 #include <mesos/module.hpp>
22 
23 namespace mesos {
24 namespace modules {
25 
26 // The 'Anonymous' kind of module does __not__ receive any callbacks
27 // but simply coexists with its parent (OS-)process.
28 //
29 // Unlike other named modules, an anonymous module does not directly
30 // replace or provide essential Mesos functionality (such as an
31 // Isolator module does). Unlike a decorator module it does not
32 // directly add or inject data into Mesos core either.
33 //
34 // Anonymous modules do not require any specific selectors (flags) as
35 // they are immediately instantiated when getting loaded via the
36 // '--modules' flag by the Mesos master or slave.
37 //
38 class Anonymous
39 {
40 public:
41  Anonymous() {}
42 
43  virtual ~Anonymous() {}
44 };
45 
46 
47 template <>
48 inline const char* kind<Anonymous>()
49 {
50  return "Anonymous";
51 }
52 
53 
54 template <>
56 {
57  Module(const char* _moduleApiVersion,
58  const char* _mesosVersion,
59  const char* _authorName,
60  const char* _authorEmail,
61  const char* _description,
62  bool (*_compatible)(),
63  Anonymous* (*_create)(const Parameters& parameters))
64  : ModuleBase(_moduleApiVersion,
65  _mesosVersion,
66  mesos::modules::kind<Anonymous>(),
67  _authorName,
68  _authorEmail,
69  _description,
70  _compatible),
71  create(_create) {}
72 
73  Anonymous* (*create)(const Parameters& parameters);
74 };
75 
76 } // namespace modules {
77 } // namespace mesos {
78 
79 #endif // __MESOS_MODULE_ANONYMOUS_HPP__
Anonymous()
Definition: anonymous.hpp:41
Definition: module.hpp:56
const char * kind()
Definition: anonymous.hpp:38
Definition: agent.hpp:25
Module(const char *_moduleApiVersion, const char *_mesosVersion, const char *_authorName, const char *_authorEmail, const char *_description, bool(*_compatible)(), Anonymous *(*_create)(const Parameters &parameters))
Definition: anonymous.hpp:57
const char * kind< Anonymous >()
Definition: anonymous.hpp:48
Try< Nothing > create(const std::string &hierarchy, const std::string &cgroup, bool recursive=false)
virtual ~Anonymous()
Definition: anonymous.hpp:43
Definition: module.hpp:97