Apache Mesos
command_utils.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 __COMMON_COMMAND_UTILS_HPP__
18 #define __COMMON_COMMAND_UTILS_HPP__
19 
20 #include <process/process.hpp>
21 
22 #include <stout/option.hpp>
23 #include <stout/path.hpp>
24 
25 namespace mesos {
26 namespace internal {
27 namespace command {
28 
29 enum class Compression
30 {
31  GZIP,
32  BZIP2,
33  XZ
34 };
35 
36 
46  const Path& input,
47  const Path& output,
48  const Option<Path>& directory = None(),
49  const Option<Compression>& compression = None());
50 
51 
59  const Path& input,
60  const Option<Path>& directory = None());
61 
62 // TODO(Jojy): Add more overloads/options for untar (eg., keep existing files)
63 
64 
71 
72 
78 process::Future<Nothing> gzip(const Path& input);
79 
80 // TODO(jojy): Add support for other compression algorithms.
81 
89 
90 } // namespace command {
91 } // namespace internal {
92 } // namespace mesos {
93 
94 #endif // __COMMON_COMMAND_UTILS_HPP__
process::Future< Nothing > gzip(const Path &input)
Compresses the given input file in GZIP format.
process::Future< std::string > sha512(const Path &input)
Computes SHA 512 checksum of a file.
process::Future< Nothing > untar(const Path &input, const Option< Path > &directory=None())
Untar(unarchive) the given file.
process::Future< Nothing > tar(const Path &input, const Path &output, const Option< Path > &directory=None(), const Option< Compression > &compression=None())
Tar(archive) the file/directory to produce output file.
Represents a POSIX or Windows file system path and offers common path manipulations.
Definition: path.hpp:212
Compression
Definition: command_utils.hpp:29
Definition: agent.hpp:25
process::Future< Nothing > decompress(const Path &input)
Decompresses given input file based on its compression format.
Definition: none.hpp:27
Definition: attributes.hpp:24