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

Function getContainerId

src/csi/service_manager.cpp:104–124  ·  view source on GitHub ↗

Returns the container ID of the specified CSI plugin container. The container ID is of the following format: - -- where and are the type and name of the CSI plugin with dots replaced by dashes, and lists the CSI services provided by the component, concatenated with dashes.

Source from the content-addressed store, hash-verified

102// with dots replaced by dashes, and <list_of_services> lists the CSI services
103// provided by the component, concatenated with dashes.
104static ContainerID getContainerId(
105 const CSIPluginInfo& info,
106 const string& containerPrefix,
107 const CSIPluginContainerInfo& container)
108{
109 // NOTE: We cannot simply stringify `container.services()` since it returns
110 // `RepeatedField<int>`, so we reconstruct the list of services here.
111 vector<Service> services;
112 services.reserve(container.services_size());
113 for (int i = 0; i < container.services_size(); i++) {
114 services.push_back(container.services(i));
115 }
116
117 ContainerID containerId;
118 containerId.set_value(
119 containerPrefix +
120 strings::join("-", strings::replace(info.type(), ".", "-"), info.name()) +
121 "--" + strings::join("-", services));
122
123 return containerId;
124}
125
126
127class ServiceManagerProcess : public Process<ServiceManagerProcess>

Callers 1

foreachFunction · 0.85

Calls 5

replaceFunction · 0.85
typeMethod · 0.80
joinFunction · 0.50
reserveMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected