MCPcopy Create free account
hub / github.com/apache/mesos / create

Function create

src/uri/fetcher.cpp:37–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35namespace fetcher {
36
37Try<Owned<Fetcher>> create(const Option<Flags>& _flags)
38{
39 // Use the default flags if not specified.
40 Flags flags;
41 if (_flags.isSome()) {
42 flags = _flags.get();
43 }
44
45 // Load built-in plugins.
46 typedef lambda::function<Try<Owned<Fetcher::Plugin>>()> Creator;
47
48 hashmap<string, Creator> creators = {
49 {CurlFetcherPlugin::NAME,
50 [flags]() { return CurlFetcherPlugin::create(flags); }},
51 {CopyFetcherPlugin::NAME,
52 [flags]() { return CopyFetcherPlugin::create(flags); }},
53 {HadoopFetcherPlugin::NAME,
54 [flags]() { return HadoopFetcherPlugin::create(flags); }},
55#ifndef __WINDOWS__
56 {DockerFetcherPlugin::NAME,
57 [flags]() { return DockerFetcherPlugin::create(flags); }},
58#endif // __WINDOWS__
59 };
60
61 vector<Owned<Fetcher::Plugin>> plugins;
62
63 foreachpair (const string& name, const Creator& creator, creators) {
64 Try<Owned<Fetcher::Plugin>> plugin = creator();
65 if (plugin.isError()) {
66 // NOTE: We skip the plugin if it cannot be created, instead of
67 // returning an Error so that we can still use other plugins.
68 LOG(INFO) << "Skipping URI fetcher plugin " << "'" << name << "' "
69 << "as it could not be created: " << plugin.error();
70 continue;
71 }
72
73 plugins.push_back(plugin.get());
74 }
75
76 return Owned<Fetcher>(new Fetcher(plugins));
77}
78
79} // namespace fetcher {
80

Callers 15

TESTFunction · 0.50
TESTFunction · 0.50
createMethod · 0.50
parseMethod · 0.50
foreachFunction · 0.50
getIPFunction · 0.50
processFunction · 0.50
fromLinkDeviceMethod · 0.50
getIPFunction · 0.50
downloadGraphProfileMethod · 0.50

Calls 2

isSomeMethod · 0.45
getMethod · 0.45

Tested by 15

TESTFunction · 0.40
TESTFunction · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40
TEST_PFunction · 0.40
TEST_PFunction · 0.40
TEST_FFunction · 0.40
TESTFunction · 0.40
mainFunction · 0.40
TESTFunction · 0.40