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/option.hpp>
28 #include <stout/path.hpp>
29 #include <stout/try.hpp>
30 
31 #include "slave/flags.hpp"
32 
33 namespace mesos {
34 namespace internal {
35 namespace slave {
36 
37 // Provision a root filesystem for a container.
38 class Backend
39 {
40 public:
41  virtual ~Backend() {}
42 
43  // Return a map of all supported backends keyed by their names. Note
44  // that Backends that failed to be created due to incorrect flags are
45  // simply not added to the result.
47  const Flags& flags);
48 
49  // Provision a root filesystem for a container into the specified 'rootfs'
50  // directory by applying the specified list of root filesystem layers in
51  // the list order, i.e., files in a layer can overwrite/shadow those from
52  // another layer earlier in the list.
53  //
54  // Optionally returns a set of paths whose contents should be included
55  // in the ephemeral sandbox disk quota.
57  const std::vector<std::string>& layers,
58  const std::string& rootfs,
59  const std::string& backendDir) = 0;
60 
61  // Destroy the root filesystem provisioned at the specified 'rootfs'
62  // directory. Return false if there is no provisioned root filesystem
63  // to destroy for the given directory.
65  const std::string& rootfs,
66  const std::string& backendDir) = 0;
67 };
68 
69 } // namespace slave {
70 } // namespace internal {
71 } // namespace mesos {
72 
73 #endif // __PROVISIONER_BACKEND_HPP__
virtual process::Future< bool > destroy(const std::string &rootfs, const std::string &backendDir)=0
Definition: flags.hpp:39
Definition: backend.hpp:38
Definition: hashmap.hpp:38
virtual process::Future< Option< std::vector< Path > > > provision(const std::vector< std::string > &layers, const std::string &rootfs, const std::string &backendDir)=0
Definition: agent.hpp:25
Definition: attributes.hpp:24
virtual ~Backend()
Definition: backend.hpp:41
static hashmap< std::string, process::Owned< Backend > > create(const Flags &flags)
Definition: parse.hpp:33
Definition: future.hpp:58