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

Method initialize

src/examples/example_module_impl.cpp:34–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32{
33public:
34 Try<Nothing> initialize(const mesos::Parameters& parameters) override
35 {
36 foreach (const mesos::Parameter& parameter, parameters.parameter()) {
37 if (parameter.has_key() && parameter.has_value()) {
38 flags[parameter.key()] = parameter.value();
39 } else {
40 return Error("Invalid key-value parameters");
41 }
42 }
43
44 // We expect that when specifying the module, a module parameter
45 // was also specified, i.e.:
46 // "modules": [{"name": "org_apache_mesos_TestModule",
47 // "flags": [{"key": "operation", "value": "sum"}]}]
48 // The expected value for the key "operation" is "sum".
49 if (flags.contains("operation") && flags["operation"] != "sum") {
50 return Error("Invalid 'operation'");
51 }
52
53 return Nothing();
54 }
55
56 int foo(char a, long b) override
57 {

Callers 1

createFunction · 0.45

Calls 3

NothingClass · 0.85
ErrorFunction · 0.50
containsMethod · 0.45

Tested by

no test coverage detected