Apache Mesos
spec.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __PROVISIONER_APPC_SPEC_HPP__
18 #define __PROVISIONER_APPC_SPEC_HPP__
19 
20 #include <string>
21 
22 #include <stout/error.hpp>
23 #include <stout/option.hpp>
24 #include <stout/try.hpp>
25 
26 #include <mesos/appc/spec.pb.h>
27 
28 namespace appc {
29 namespace spec {
30 
31 // Parse the ImageManifest in the specified JSON string.
32 Try<ImageManifest> parse(const std::string& value);
33 
34 
35 // Returns the rootfs of an image, given its path as per the spec.
36 std::string getImageRootfsPath(const std::string& imagePath);
37 
38 
39 // Returns the path of an image's manifest, given its path as per the spec.
40 std::string getImageManifestPath(const std::string& imagePath);
41 
42 
43 // Returns ImageManifest object for an image at given path.
44 Try<ImageManifest> getManifest(const std::string& imagePath);
45 
46 
47 // Validate if the specified image manifest conforms to the Appc spec.
48 Option<Error> validateManifest(const ImageManifest& manifest);
49 
50 
51 // Validate if the specified image ID conforms to the Appc spec.
52 Option<Error> validateImageID(const std::string& imageId);
53 
54 
55 // Validate if the specified image has the disk layout that conforms
56 // to the Appc spec.
57 Option<Error> validateLayout(const std::string& imagePath);
58 
59 
60 // Validates the image path if it conforms to the Appc image spec.
61 Option<Error> validate(const std::string& imageDir);
62 
63 } // namespace spec {
64 } // namespace appc {
65 
66 #endif // __PROVISIONER_APPC_SPEC_HPP__
Option< Error > validateManifest(const ImageManifest &manifest)
std::string getImageManifestPath(const std::string &imagePath)
Option< Error > validate(const std::string &imageDir)
Definition: try.hpp:34
URI manifest(const std::string &repository, const std::string &reference, const std::string &registry, const Option< std::string > &scheme=None(), const Option< int > &port=None())
Definition: docker.hpp:47
Try< ImageManifest > parse(const std::string &value)
Definition: parse.hpp:36
Option< Error > validateLayout(const std::string &imagePath)
Option< Error > validateImageID(const std::string &imageId)
Try< ImageManifest > getManifest(const std::string &imagePath)
std::string getImageRootfsPath(const std::string &imagePath)