Apache Mesos
daemon.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 __RESOURCE_PROVIDER_DAEMON_HPP__
18 #define __RESOURCE_PROVIDER_DAEMON_HPP__
19 
20 #include <string>
21 
22 #include <mesos/mesos.hpp>
23 
25 
26 #include <process/http.hpp>
27 #include <process/owned.hpp>
28 
29 #include <stout/option.hpp>
30 #include <stout/try.hpp>
31 
32 #include "slave/flags.hpp"
33 
34 namespace mesos {
35 namespace internal {
36 
37 // Forward declarations.
38 class LocalResourceProviderDaemonProcess;
39 
40 
41 // A daemon in the agent monitoring in-process local resource providers.
42 // It monitors the config files in the config dir. Based on that, it
43 // starts or stops local resource providers.
45 {
46 public:
48  const process::http::URL& url,
49  const slave::Flags& flags,
50  SecretGenerator* secretGenerator);
51 
53 
55  const LocalResourceProviderDaemon& other) = delete;
56 
58  const LocalResourceProviderDaemon& other) = delete;
59 
60  void start(const SlaveID& slaveId);
61 
62  process::Future<bool> add(const ResourceProviderInfo& info);
63  process::Future<bool> update(const ResourceProviderInfo& info);
64  process::Future<bool> remove(
65  const std::string& type,
66  const std::string& name);
67 
68 private:
70  const process::http::URL& url,
71  const std::string& workDir,
72  const Option<std::string>& configDir,
73  SecretGenerator* secretGenerator,
74  bool strict);
75 
77 };
78 
79 } // namespace internal {
80 } // namespace mesos {
81 
82 #endif // __RESOURCE_PROVIDER_DAEMON_HPP__
void start(const SlaveID &slaveId)
Definition: try.hpp:34
process::Future< bool > add(const ResourceProviderInfo &info)
process::Future< bool > update(const ResourceProviderInfo &info)
Definition: flags.hpp:39
LocalResourceProviderDaemon & operator=(const LocalResourceProviderDaemon &other)=delete
Definition: http.hpp:129
LocalResourceProviderDaemon(const LocalResourceProviderDaemon &other)=delete
The SecretGenerator interface represents a mechanism to create a secret from a principal.
Definition: secret_generator.hpp:34
#define flags
Definition: decoder.hpp:18
static Try< process::Owned< LocalResourceProviderDaemon > > create(const process::http::URL &url, const slave::Flags &flags, SecretGenerator *secretGenerator)
Try< uint32_t > type(const std::string &path)
constexpr const char * name
Definition: shell.hpp:41