Apache Mesos
hadoop.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_HADOOP_HPP__
18 #define __URI_FETCHERS_HADOOP_HPP__
19 
20 #include <set>
21 #include <string>
22 
23 #include <process/owned.hpp>
24 
25 #include <stout/flags.hpp>
26 #include <stout/option.hpp>
27 #include <stout/try.hpp>
28 
29 #include <mesos/uri/fetcher.hpp>
30 
31 #include "hdfs/hdfs.hpp"
32 
33 namespace mesos {
34 namespace uri {
35 
37 {
38 public:
39  class Flags : public virtual flags::FlagsBase
40  {
41  public:
42  Flags();
43 
46  };
47 
48  static const char NAME[];
49 
51 
52  ~HadoopFetcherPlugin() override {}
53 
54  std::set<std::string> schemes() const override;
55 
56  std::string name() const override;
57 
59  const URI& uri,
60  const std::string& directory,
61  const Option<std::string>& data = None(),
62  const Option<std::string>& outputFileName = None()) const override;
63 
64 private:
67  const std::set<std::string>& _schemes)
68  : hdfs(_hdfs),
69  schemes_(_schemes) {}
70 
72  std::set<std::string> schemes_;
73 };
74 
75 } // namespace uri {
76 } // namespace mesos {
77 
78 #endif // __URI_FETCHERS_HADOOP_HPP__
static Try< process::Owned< Fetcher::Plugin > > create(const Flags &flags)
Definition: check.hpp:33
Definition: hadoop.hpp:36
static const char NAME[]
Definition: hadoop.hpp:48
URI hdfs(const std::string &path, const Option< std::string > &host=None(), const Option< int > &port=None())
Creates an hdfs URI with the given path.
Definition: hdfs.hpp:32
std::string name() const override
Returns the name that this plugin registered with.
Option< std::string > hadoop_client
Definition: hadoop.hpp:44
std::set< std::string > schemes() const override
Returns the URI schemes that this plugin handles.
std::string hadoop_client_supported_schemes
Definition: hadoop.hpp:45
Definition: flags.hpp:44
Definition: agent.hpp:25
~HadoopFetcherPlugin() override
Definition: hadoop.hpp:52
Definition: none.hpp:27
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
Definition: parse.hpp:33
Represents a fetcher plugin that handles one or more URI schemes.
Definition: fetcher.hpp:52