| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>Apache Mesos - Doxygen Style Guide</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <meta property="og:locale" content="en_US"/> |
| <meta property="og:type" content="website"/> |
| <meta property="og:title" content="Apache Mesos"/> |
| <meta property="og:site_name" content="Apache Mesos"/> |
| <meta property="og:url" content="http://mesos.apache.org/"/> |
| <meta property="og:image" content="http://mesos.apache.org/assets/img/mesos_logo_fb_preview.png"/> |
| <meta property="og:description" |
| content="Apache Mesos abstracts resources away from machines, |
| enabling fault-tolerant and elastic distributed systems |
| to easily be built and run effectively."/> |
| |
| <meta name="twitter:card" content="summary"/> |
| <meta name="twitter:site" content="@ApacheMesos"/> |
| <meta name="twitter:title" content="Apache Mesos"/> |
| <meta name="twitter:image" content="http://mesos.apache.org/assets/img/mesos_logo_fb_preview.png"/> |
| <meta name="twitter:description" |
| content="Apache Mesos abstracts resources away from machines, |
| enabling fault-tolerant and elastic distributed systems |
| to easily be built and run effectively."/> |
| |
| <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> |
| <link rel="alternate" type="application/atom+xml" title="Apache Mesos Blog" href="/blog/feed.xml"> |
| <link href="../../../assets/css/main.css" media="screen" rel="stylesheet" type="text/css" /> |
| |
| |
| |
| <!-- Google Analytics Magic --> |
| <script type="text/javascript"> |
| var _gaq = _gaq || []; |
| _gaq.push(['_setAccount', 'UA-20226872-1']); |
| _gaq.push(['_setDomainName', 'apache.org']); |
| _gaq.push(['_trackPageview']); |
| |
| (function() { |
| var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
| ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
| var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
| })(); |
| </script> |
| |
| </head> |
| <body> |
| <!-- magical breadcrumbs --> |
| <div class="topnav"> |
| <div class="container"> |
| <ul class="breadcrumb"> |
| <li> |
| <div class="dropdown"> |
| <a data-toggle="dropdown" href="#">Apache Software Foundation <span class="caret"></span></a> |
| <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> |
| <li><a href="http://www.apache.org">Apache Homepage</a></li> |
| <li><a href="http://www.apache.org/licenses/">License</a></li> |
| <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> |
| <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li> |
| <li><a href="http://www.apache.org/security/">Security</a></li> |
| </ul> |
| </div> |
| </li> |
| |
| <li><a href="http://mesos.apache.org">Apache Mesos</a></li> |
| |
| |
| <li><a href="/documentation |
| /">Documentation |
| </a></li> |
| |
| |
| </ul><!-- /.breadcrumb --> |
| </div><!-- /.container --> |
| </div><!-- /.topnav --> |
| |
| <!-- navbar excitement --> |
| <div class="navbar navbar-default navbar-static-top" role="navigation"> |
| <div class="container"> |
| <div class="navbar-header"> |
| <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#mesos-menu" aria-expanded="false"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <a class="navbar-brand" href="/"><img src="/assets/img/mesos_logo.png" alt="Apache Mesos logo"/></a> |
| </div><!-- /.navbar-header --> |
| |
| <div class="navbar-collapse collapse" id="mesos-menu"> |
| <ul class="nav navbar-nav navbar-right"> |
| <li><a href="/gettingstarted/">Getting Started</a></li> |
| <li><a href="/blog/">Blog</a></li> |
| <li><a href="/documentation/latest/">Documentation</a></li> |
| <li><a href="/downloads/">Downloads</a></li> |
| <li><a href="/community/">Community</a></li> |
| </ul> |
| </div><!-- /#mesos-menu --> |
| </div><!-- /.container --> |
| </div><!-- /.navbar --> |
| |
| <div class="content"> |
| <div class="container"> |
| <div class="row-fluid"> |
| <div class="col-md-4"> |
| <h4>If you're new to Mesos</h4> |
| <p>See the <a href="/gettingstarted/">getting started</a> page for more |
| information about downloading, building, and deploying Mesos.</p> |
| |
| <h4>If you'd like to get involved or you're looking for support</h4> |
| <p>See our <a href="/community/">community</a> page for more details.</p> |
| </div> |
| <div class="col-md-8"> |
| <h1>Apache Mesos Doxygen Style Guide</h1> |
| |
| <p>This guide introduces a consistent style |
| for <a href="http://mesos.apache.org/api/latest/c++">documenting Mesos source code</a> |
| using <a href="http://www.doxygen.org">Doxygen</a>. |
| There is an ongoing, incremental effort with the goal to document all public Mesos, libprocess, and stout APIs this way. |
| For now, existing code may not follow these guidelines, but new code should.</p> |
| |
| <h2>Source Code Documentation Syntax</h2> |
| |
| <p>Doxygen documentation needs only to be applied to source code parts that |
| constitute an interface for which we want to generate Mesos API documentation |
| files. Implementation code that does not participate in this should still be |
| enhanced by source code comments as appropriate, but these comments should not follow the doxygen style.</p> |
| |
| <p>We follow the <a href="http://en.wikipedia.org/wiki/Javadoc">Javadoc syntax</a> to mark comment blocks. |
| These have the general form:</p> |
| |
| <!-- NOTE: In order to show the comments as part of the code blocks in |
| this we must use indentation instead of fenced code blocks (i.e., |
| ~~~{.cpp}) because doxygen will remove all of the comments and just |
| render the code. --> |
| |
| |
| <pre><code>/** |
| * Brief summary. |
| * |
| * Detailed description. More detail. |
| * @see Some reference |
| * |
| * @param <name> Parameter description. |
| * @return Return value description. |
| */ |
| </code></pre> |
| |
| <p>Example:</p> |
| |
| <pre><code>/** |
| * Returns a compressed version of a string. |
| * |
| * Compresses an input string using the foobar algorithm. |
| * |
| * @param uncompressed The input string. |
| * @return A compressed version of the input string. |
| */ |
| std::string compress(const std::string& uncompressed); |
| </code></pre> |
| |
| <h3>Doxygen Tags</h3> |
| |
| <p>This is the allowed set of doxygen tags that can be used.</p> |
| |
| <ul> |
| <li><a href="http://doxygen.org/manual/commands.html#cmdparam">\@param</a> Describes function parameters.</li> |
| <li><a href="http://doxygen.org/manual/commands.html#cmdreturn">\@return</a> Describes return values.</li> |
| <li><a href="http://doxygen.org/manual/commands.html#cmdsa">\@see</a> Describes a cross-reference to classes, functions, methods, variables, files or URL.</li> |
| </ul> |
| |
| |
| <p>Example:</p> |
| |
| <pre><code>/** |
| * Available kinds of implementations. |
| * |
| * @see process::network::PollSocketImpl |
| */ |
| </code></pre> |
| |
| <ul> |
| <li><a href="http://doxygen.org/manual/commands.html#cmdfile">\@file</a> Describes a refence to a file. It is required when documenting global functions, variables, typedefs, or enums in separate files.</li> |
| <li><a href="http://doxygen.org/manual/commands.html#cmdlink">\@link</a> and <a href="http://doxygen.org/manual/commands.html#cmdendlink">\@endlink</a> Describes a link to a file, class, or member.</li> |
| <li><a href="http://doxygen.org/manual/commands.html#cmdexample">\@example</a> Describes source code examples.</li> |
| <li><p><a href="http://doxygen.org/manual/commands.html#cmdimage">\@image</a> Describes an image.</p></li> |
| <li><p>When following these links be aware that the doxygen documentation is using another syntax in that \@param is explained as \param.</p></li> |
| </ul> |
| |
| |
| <h3>Wrapping</h3> |
| |
| <p>We wrap long descriptions using four spaces on the next line.</p> |
| |
| <pre><code>@param uncompressed The input string that requires |
| a very long description and an even longer |
| description on this line as well. |
| </code></pre> |
| |
| <h3>Constants and Variables</h3> |
| |
| <p>Example:</p> |
| |
| <pre><code>/** |
| * Prefix used to name Docker containers in order to distinguish |
| * those created by Mesos from those created manually. |
| */ |
| extern const std::string DOCKER_NAME_PREFIX; |
| </code></pre> |
| |
| <h4>Fields</h4> |
| |
| <p>Example:</p> |
| |
| <pre><code>/** |
| * The parent side of the pipe for stdin. |
| * If the mode is not PIPE, None will be stored. |
| * **NOTE**: stdin is a macro on some systems, hence this name instead. |
| */ |
| Option<int> in; |
| </code></pre> |
| |
| <h3>Functions and Methods</h3> |
| |
| <p>Example:</p> |
| |
| <pre><code>/** |
| * Forks a subprocess and execs the specified 'path' with the |
| * specified 'argv', redirecting stdin, stdout, and stderr as |
| * specified by 'in', 'out', and 'err' respectively. |
| * |
| * If 'setup' is not None, runs the specified function after forking |
| * but before exec'ing. If the return value of 'setup' is non-zero |
| * then that gets returned in 'status()' and we will not exec. |
| * |
| * @param path Relative or absolute path in the filesytem to the |
| * executable. |
| * @param argv Argument vector to pass to exec. |
| * @param in Redirection specification for stdin. |
| * @param out Redirection specification for stdout. |
| * @param err Redirection specification for stderr. |
| * @param flags Flags to be stringified and appended to 'argv'. |
| * @param environment Environment variables to use for the new |
| * subprocess or if None (the default) then the new subprocess |
| * will inherit the environment of the current process. |
| * @param setup Function to be invoked after forking but before |
| * exec'ing. NOTE: Take extra care not to invoke any |
| * async unsafe code in the body of this function. |
| * @param clone Function to be invoked in order to fork/clone the |
| * subprocess. |
| * @return The subprocess or an error if one occurred. |
| */ |
| Try<Subprocess> subprocess( |
| const std::string& path, |
| std::vector<std::string> argv, |
| const Subprocess::IO& in = Subprocess::FD(STDIN_FILENO), |
| const Subprocess::IO& out = Subprocess::FD(STDOUT_FILENO), |
| const Subprocess::IO& err = Subprocess::FD(STDERR_FILENO), |
| const Option<flags::FlagsBase>& flags = None(), |
| const Option<std::map<std::string, std::string>>& environment = None(), |
| const Option<lambda::function<int()>>& setup = None(), |
| const Option<lambda::function< |
| pid_t(const lambda::function<int()>&)>>& clone = None()); |
| </code></pre> |
| |
| <h3>Classes and Structs</h3> |
| |
| <p>Example:</p> |
| |
| <pre><code>/** |
| * Represents a fork() exec()ed subprocess. Access is provided to the |
| * input / output of the process, as well as the exit status. The |
| * input / output file descriptors are only closed after: |
| * 1. The subprocess has terminated. |
| * 2. There are no longer any references to the associated |
| * Subprocess object. |
| */ |
| class Subprocess |
| { |
| public: |
| </code></pre> |
| |
| <h2>Library and Component Overview Pages and Developer Guides</h2> |
| |
| <p>Substantial libraries, components, and subcomponents of the Mesos system such as |
| stout, libprocess, master, agent, containerizer, allocator, and others |
| should have an overview page in markdown format that explains their |
| purpose, overall structure, and general use. This can even be a complete developer guide.</p> |
| |
| <p>This page must be located in the top directory of the library/component and named “README.md”.</p> |
| |
| <p>The first line in such a document must be a section heading bearing the title which will appear in the generated Doxygen index. |
| Example: “# Libprocess Developer Guide”</p> |
| |
| <h3>Example Code</h3> |
| |
| <p>C++ code examples should be enclosed by ‘~~~{.cpp}’.</p> |
| |
| <p>Example:</p> |
| |
| <pre><code class="{.cpp}">int main(int argc, char** argv) |
| { |
| ... |
| } |
| </code></pre> |
| |
| <p><strong>NOTE</strong>: Because of shortcomings of Doxygen’s markdown parser we currently use indentation for wrapping all non C++ code blocks.</p> |
| |
| <h2>Building Doxygen Documentation</h2> |
| |
| <p>As of right now, the Doxygen documentation should be built from the <em>build</em> subdirectory using <em>doxygen ../Doxyfile</em> . The documentation will then be generated into the <em>./doxygen</em> subdirectory.</p> |
| |
| </div> |
| </div> |
| |
| </div><!-- /.container --> |
| </div><!-- /.content --> |
| |
| <hr> |
| |
| |
| |
| <!-- footer --> |
| <div class="footer"> |
| <div class="container"> |
| <div class="col-md-4 social-blk"> |
| <span class="social"> |
| <a href="https://twitter.com/ApacheMesos" |
| class="twitter-follow-button" |
| data-show-count="false" data-size="large">Follow @ApacheMesos</a> |
| <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> |
| <a href="https://twitter.com/intent/tweet?button_hashtag=mesos" |
| class="twitter-hashtag-button" |
| data-size="large" |
| data-related="ApacheMesos">Tweet #mesos</a> |
| <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> |
| </span> |
| </div> |
| |
| <div class="col-md-8 trademark"> |
| <p>© 2012-2017 <a href="http://apache.org">The Apache Software Foundation</a>. |
| Apache Mesos, the Apache feather logo, and the Apache Mesos project logo are trademarks of The Apache Software Foundation. |
| <p> |
| </div> |
| </div><!-- /.container --> |
| </div><!-- /.footer --> |
| |
| <!-- JS --> |
| <script src="//code.jquery.com/jquery-1.11.0.min.js" type="text/javascript"></script> |
| <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js" type="text/javascript"></script> |
| </body> |
| </html> |