本文整理汇总了C++中Try::dependencies方法的典型用法代码示例。如果您正苦于以下问题:C++ Try::dependencies方法的具体用法?C++ Try::dependencies怎么用?C++ Try::dependencies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Try
的用法示例。
在下文中一共展示了Try::dependencies方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Failure
Future<vector<string>> StoreProcess::fetchDependencies(
const string& imageId,
bool cached)
{
const string imagePath = paths::getImagePath(rootDir, imageId);
Try<spec::ImageManifest> manifest = spec::getManifest(imagePath);
if (manifest.isError()) {
return Failure(
"Failed to get dependencies for image id '" + imageId +
"': " + manifest.error());
}
vector<Image::Appc> dependencies;
foreach (const spec::ImageManifest::Dependency& dependency,
manifest->dependencies()) {
Image::Appc appc;
appc.set_name(dependency.imagename());
if (dependency.has_imageid()) {
appc.set_id(dependency.imageid());
}
// TODO(jojy): Make Image::Appc use appc::spec::Label instead of
// mesos::Label so that we can avoid this loop here.
foreach (const spec::ImageManifest::Label& label, dependency.labels()) {
mesos::Label appcLabel;
appcLabel.set_key(label.name());
appcLabel.set_value(label.value());
appc.mutable_labels()->add_labels()->CopyFrom(appcLabel);
}
dependencies.emplace_back(appc);
}
if (dependencies.size() == 0) {
return vector<string>();
}
// Do a depth first search.
vector<Future<vector<string>>> futures;
futures.reserve(dependencies.size());
foreach (const Image::Appc& appc, dependencies) {
futures.emplace_back(fetchImage(appc, cached));
}