Apache Mesos
backend.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 __PROVISIONER_BACKEND_HPP__
18 #define __PROVISIONER_BACKEND_HPP__
19 
20 #include <string>
21 #include <vector>
22 
23 #include <process/future.hpp>
24 #include <process/owned.hpp>
25 
26 #include <stout/hashmap.hpp>
27 #include <stout/try.hpp>
28 
29 #include "slave/flags.hpp"
30 
31 namespace mesos {
32 namespace internal {
33 namespace slave {
34 
35 // Provision a root filesystem for a container.
36 class Backend
37 {
38 public:
39  virtual ~Backend() {}
40 
41  // Return a map of all supported backends keyed by their names. Note
42  // that Backends that failed to be created due to incorrect flags are
43  // simply not added to the result.
45  const Flags& flags);
46 
47  // Provision a root filesystem for a container into the specified 'rootfs'
48  // directory by applying the specified list of root filesystem layers in
49  // the list order, i.e., files in a layer can overwrite/shadow those from
50  // another layer earlier in the list.
52  const std::vector<std::string>& layers,
53  const std::string& rootfs,
54  const std::string& backendDir) = 0;
55 
56  // Destroy the root filesystem provisioned at the specified 'rootfs'
57  // directory. Return false if there is no provisioned root filesystem
58  // to destroy for the given directory.
60  const std::string& rootfs,
61  const std::string& backendDir) = 0;
62 };
63 
64 } // namespace slave {
65 } // namespace internal {
66 } // namespace mesos {
67 
68 #endif // __PROVISIONER_BACKEND_HPP__
virtual process::Future< bool > destroy(const std::string &rootfs, const std::string &backendDir)=0
Definition: flags.hpp:39
virtual process::Future< Nothing > provision(const std::vector< std::string > &layers, const std::string &rootfs, const std::string &backendDir)=0
Definition: backend.hpp:36
Definition: hashmap.hpp:38
#define flags
Definition: decoder.hpp:18
virtual ~Backend()
Definition: backend.hpp:39
static hashmap< std::string, process::Owned< Backend > > create(const Flags &flags)