Apache Mesos
fetcher.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_APPC_FETCHER_HPP__
18 #define __PROVISIONER_APPC_FETCHER_HPP__
19 
20 #include <string>
21 
22 #include <process/process.hpp>
23 #include <process/shared.hpp>
24 
25 #include <stout/path.hpp>
26 
27 #include "slave/flags.hpp"
28 
29 #include "uri/fetcher.hpp"
30 
31 namespace mesos {
32 namespace internal {
33 namespace slave {
34 namespace appc {
35 
36 class Fetcher
37 {
38 public:
46  const Flags& flags,
47  const process::Shared<uri::Fetcher>& fetcher);
48 
49  /*
50  * Fetches Appc image to the given directory.
51  *
52  * Reference: https://github.com/appc/spec/blob/master/spec/discovery.md
53  *
54  * @param image Encapsulated information about the appc image.
55  * @param directory Path of directory where the image has to be saved.
56  * @returns Nothing on success.
57  * Failure in case of any error.
58  */
60  const Image::Appc& appc,
61  const Path& directory);
62 
63 private:
64  Fetcher(
65  const std::string& uriPrefix,
66  const process::Shared<uri::Fetcher>& fetcher);
67 
68  Fetcher(const Fetcher&) = delete;
69  Fetcher& operator=(const Fetcher&) = delete;
70 
71  const std::string uriPrefix;
73 };
74 
75 } // namespace appc {
76 } // namespace slave {
77 } // namespace internal {
78 } // namespace mesos {
79 
80 #endif // __PROVISIONER_APPC_FETCHER_HPP__
process::Future< Nothing > fetch(const Image::Appc &appc, const Path &directory)
Definition: check.hpp:33
Definition: fetcher.hpp:36
Definition: flags.hpp:39
static Try< process::Owned< Fetcher > > create(const Flags &flags, const process::Shared< uri::Fetcher > &fetcher)
Factory method for creating the fetcher component.
Definition: owned.hpp:26
Represents a POSIX or Windows file system path and offers common path manipulations.
Definition: path.hpp:212
Definition: agent.hpp:25
Definition: attributes.hpp:24
Definition: spec.hpp:28
Definition: parse.hpp:33