Apache Mesos
Classes | Public Member Functions | List of all members
mesos::uri::Fetcher Class Reference

Provides an abstraction for fetching URIs. More...

#include <fetcher.hpp>

Classes

class  Plugin
 Represents a fetcher plugin that handles one or more URI schemes. More...
 

Public Member Functions

 Fetcher (const std::vector< process::Owned< Plugin >> &plugins)
 Create the Fetcher instance with the given plugins. More...
 
process::Future< Nothingfetch (const URI &uri, const std::string &directory, const Option< std::string > &data=None(), const Option< std::string > &outputFileName=None()) const
 Fetches a URI to the given directory. More...
 
process::Future< Nothingfetch (const URI &uri, const std::string &directory, const std::string &name, const Option< std::string > &data=None(), const Option< std::string > &outputFileName=None()) const
 Fetches a URI to the given directory. More...
 

Detailed Description

Provides an abstraction for fetching URIs.

It is pluggable through plugins. Each plugin is responsible for one or more URI schemes, but there should be only one plugin associated with each URI scheme. The fetching request will be dispatched to the relevant plugin based on the scheme in the URI.

Constructor & Destructor Documentation

mesos::uri::Fetcher::Fetcher ( const std::vector< process::Owned< Plugin >> &  plugins)

Create the Fetcher instance with the given plugins.

Parameters
pluginsa list of plugins to register.

Member Function Documentation

process::Future<Nothing> mesos::uri::Fetcher::fetch ( const URI &  uri,
const std::string &  directory,
const Option< std::string > &  data = None(),
const Option< std::string > &  outputFileName = None() 
) const

Fetches a URI to the given directory.

This method will dispatch the call to the corresponding plugin based on uri.scheme.

Parameters
urithe URI to fetch
directorythe directory the URI will be downloaded to
datathe optional user defined data
outputFileNamethe optional output file name
process::Future<Nothing> mesos::uri::Fetcher::fetch ( const URI &  uri,
const std::string &  directory,
const std::string &  name,
const Option< std::string > &  data = None(),
const Option< std::string > &  outputFileName = None() 
) const

Fetches a URI to the given directory.

This method will dispatch the call to the plugin chosen by using its name.

Parameters
urithe URI to fetch
directorythe directory the URI will be downloaded to
nameof the plugin that is used to download
datathe optional user defined data
outputFileNamethe optional output file name

The documentation for this class was generated from the following file: