Apache Mesos
docker.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 __URI_FETCHERS_DOCKER_HPP__
18 #define __URI_FETCHERS_DOCKER_HPP__
19 
20 #include <process/owned.hpp>
21 
22 #include <stout/flags.hpp>
23 #include <stout/try.hpp>
24 
25 #include <mesos/uri/fetcher.hpp>
26 
27 namespace mesos {
28 namespace uri {
29 
30 // Forward declarations.
31 class DockerFetcherPluginProcess;
32 
33 
35 {
36 public:
37  class Flags : public virtual flags::FlagsBase
38  {
39  public:
40  Flags();
41 
44  };
45 
46  static const char NAME[];
47 
48  // `enableAuthServiceUriFallback` switches on the fallback auth service URI
49  // generation scheme for V2 registries that do not provide 'service'/'scope'
50  // parameters in the initial 'WWW-Authenticate' header.
51  //
52  // NOTE: switching the fallback off is required for testing purposes.
54  const Flags& flags,
55  bool enableAuthServiceUriFallback = true);
56 
57  static std::string getBlobPath(
58  const std::string& directory,
59  const std::string& blobSum);
60 
61  ~DockerFetcherPlugin() override;
62 
63  std::set<std::string> schemes() const override;
64 
65  std::string name() const override;
66 
68  const URI& uri,
69  const std::string& directory,
70  const Option<std::string>& data = None(),
71  const Option<std::string>& outputFileName = None()) const override;
72 
73 private:
74  explicit DockerFetcherPlugin(
76 
78 };
79 
80 } // namespace uri {
81 } // namespace mesos {
82 
83 #endif // __URI_FETCHERS_DOCKER_HPP__
std::string name() const override
Returns the name that this plugin registered with.
std::set< std::string > schemes() const override
Returns the URI schemes that this plugin handles.
Definition: check.hpp:33
Option< JSON::Object > docker_config
Definition: docker.hpp:42
Definition: docker.hpp:34
Option< Duration > docker_stall_timeout
Definition: docker.hpp:43
static const char NAME[]
Definition: docker.hpp:46
Definition: flags.hpp:44
Definition: agent.hpp:25
Definition: none.hpp:27
Definition: executor.hpp:48
process::Future< Nothing > fetch(const URI &uri, const std::string &directory, const Option< std::string > &data=None(), const Option< std::string > &outputFileName=None()) const override
Fetches a URI to the given directory.
Definition: uri.hpp:21
static Try< process::Owned< Fetcher::Plugin > > create(const Flags &flags, bool enableAuthServiceUriFallback=true)
Definition: parse.hpp:33
Represents a fetcher plugin that handles one or more URI schemes.
Definition: fetcher.hpp:52
static std::string getBlobPath(const std::string &directory, const std::string &blobSum)