You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2015/06/03 11:33:42 UTC
[1/4] mesos git commit: Changed title inside Stout User Guide.
Repository: mesos
Updated Branches:
refs/heads/master efa8c91d7 -> 538dbf39e
Changed title inside Stout User Guide.
Review: https://reviews.apache.org/r/34935
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/aa642f75
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/aa642f75
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/aa642f75
Branch: refs/heads/master
Commit: aa642f7563722d2f3264693e9ebcbd43f85656e6
Parents: efa8c91
Author: Joerg Schad <jo...@mesosphere.io>
Authored: Wed Jun 3 02:22:12 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Wed Jun 3 02:22:12 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/aa642f75/3rdparty/libprocess/3rdparty/stout/README.md
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/README.md b/3rdparty/libprocess/3rdparty/stout/README.md
index 588f739..9134677 100644
--- a/3rdparty/libprocess/3rdparty/stout/README.md
+++ b/3rdparty/libprocess/3rdparty/stout/README.md
@@ -1,4 +1,4 @@
-## User Guide
+## Stout User Guide
Stout is a header-only C++ library. Simply add the `include` folder to your include path (i.e., `-I/path/to/stout/include`) during compilation (eventually we plan to support installation).
[3/4] mesos git commit: Started Doxygen documentation for libprocess
Clock and ID.
Posted by be...@apache.org.
Started Doxygen documentation for libprocess Clock and ID.
Review: https://reviews.apache.org/r/34937
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e262a42b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e262a42b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e262a42b
Branch: refs/heads/master
Commit: e262a42b810052001b36e41eb8a0eb70b147f3c0
Parents: 9af28e0
Author: Joerg Schad <jo...@mesosphere.io>
Authored: Wed Jun 3 02:26:13 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Wed Jun 3 02:26:14 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/include/process/clock.hpp | 34 +++++++++++++++++-----
3rdparty/libprocess/include/process/id.hpp | 12 ++++++--
2 files changed, 36 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e262a42b/3rdparty/libprocess/include/process/clock.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/clock.hpp b/3rdparty/libprocess/include/process/clock.hpp
index f97cde7..4034f05 100644
--- a/3rdparty/libprocess/include/process/clock.hpp
+++ b/3rdparty/libprocess/include/process/clock.hpp
@@ -19,19 +19,30 @@ class ProcessBase;
class Time;
class Timer;
+/**
+ * Provides timers.
+ */
class Clock
{
public:
- // Initialize the clock with the specified callback that will be
- // invoked whenever a batch of timers has expired.
- //
- // TODO(benh): Introduce a "channel" or listener pattern for getting
- // the expired Timers rather than passing in a callback. This might
- // mean we don't need 'initialize' or 'shutdown'.
+ /**
+ * Initialize the clock with the specified callback that will be
+ * invoked whenever a batch of timers has expired.
+ *
+ * TODO(benh): Introduce a "channel" or listener pattern for getting
+ * the expired Timers rather than passing in a callback. This might
+ * mean we don't need 'initialize' or 'shutdown'.
+ */
static void initialize(
lambda::function<void(const std::list<Timer>&)>&& callback);
+ /**
+ * The current clock time for the current process that makes this call.
+ *
+ * @return This process' current clock time.
+ */
static Time now();
+
static Time now(ProcessBase* process);
static Timer timer(
@@ -40,7 +51,14 @@ public:
static bool cancel(const Timer& timer);
+ /**
+ * Pauses the clock e.g. for testing purposes.
+ */
static void pause();
+
+ /**
+ * Check whether clock is currently running.
+ */
static bool paused();
static void resume();
@@ -56,8 +74,8 @@ public:
// previous Clock for a process if going backwards in time, where as
// FORCE forces this change.
enum Update {
- SAFE,
- FORCE,
+ SAFE, /*!< Don't update Clock for a process if going backwards in time. */
+ FORCE, /*!< Update Clock even if going backwards in time. */
};
static void update(
http://git-wip-us.apache.org/repos/asf/mesos/blob/e262a42b/3rdparty/libprocess/include/process/id.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/id.hpp b/3rdparty/libprocess/include/process/id.hpp
index 8c256b9..e586937 100644
--- a/3rdparty/libprocess/include/process/id.hpp
+++ b/3rdparty/libprocess/include/process/id.hpp
@@ -1,13 +1,21 @@
#ifndef __PROCESS_ID_HPP__
#define __PROCESS_ID_HPP__
+/** @file */
+
#include <string>
namespace process {
namespace ID {
-// Returns 'prefix(N)' where N represents the number of instances
-// where this prefix has been used to generate an ID.
+/**
+ * Returns 'prefix(N)' where N represents the number of instances
+ * where the same prefix (wrt. string value equality) has been used
+ * to generate an ID.
+ *
+ * @param prefix The prefix to base the result.
+ * @return An "ID" in the shape 'prefix(N)'.
+ */
std::string generate(const std::string& prefix = "");
} // namespace ID {
[2/4] mesos git commit: Updated Doxygen configuration.
Posted by be...@apache.org.
Updated Doxygen configuration.
Review: https://reviews.apache.org/r/34938
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9af28e07
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9af28e07
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9af28e07
Branch: refs/heads/master
Commit: 9af28e0798b3de6c262b2a8f1d0fc434655c8ee3
Parents: aa642f7
Author: Joerg Schad <jo...@mesosphere.io>
Authored: Wed Jun 3 02:25:32 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Wed Jun 3 02:25:32 2015 -0700
----------------------------------------------------------------------
Doxyfile | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/9af28e07/Doxyfile
----------------------------------------------------------------------
diff --git a/Doxyfile b/Doxyfile
index 249f9e0..cdc4c12 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NUMBER =
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
-OUTPUT_DIRECTORY = docs
+OUTPUT_DIRECTORY = ./doxygen
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@@ -297,7 +297,7 @@ SYMBOL_CACHE_SIZE = 0
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-EXTRACT_ALL = NO
+EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
@@ -568,10 +568,9 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = include/ src/ \
- 3rdparty/libprocess/src \
- 3rdparty/libprocess/include \
- 3rdparty/libprocess/3rdparty/stout
+INPUT = ../include/ ../src/ \
+ ../3rdparty \
+ ../docs
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -588,7 +587,7 @@ INPUT_ENCODING = UTF-8
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-FILE_PATTERNS =
+FILE_PATTERNS = *.h *.hpp *.md
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
[4/4] mesos git commit: Created intitial Libprocess Readme.md.
Posted by be...@apache.org.
Created intitial Libprocess Readme.md.
Review: https://reviews.apache.org/r/34936
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/538dbf39
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/538dbf39
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/538dbf39
Branch: refs/heads/master
Commit: 538dbf39e85dcf4b10871c84e00c385f2a8d79c2
Parents: e262a42
Author: Joerg Schad <jo...@mesosphere.io>
Authored: Wed Jun 3 02:27:46 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Wed Jun 3 02:27:46 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/README | 10 --
3rdparty/libprocess/README.md | 343 +++++++++++++++++++++++++++++++++++++
2 files changed, 343 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/538dbf39/3rdparty/libprocess/README
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/README b/3rdparty/libprocess/README
deleted file mode 100644
index 89b009f..0000000
--- a/3rdparty/libprocess/README
+++ /dev/null
@@ -1,10 +0,0 @@
-README for libprocess
-
-Most importantly, if you run into an issue, please send me an email:
-benh@berkeley.edu.
-
-$ ./bootstrap # Unless you already have a distribution.
-$ mkdir build && cd build # Optional.
-$ path/to/configure
-$ make
-$ make check
http://git-wip-us.apache.org/repos/asf/mesos/blob/538dbf39/3rdparty/libprocess/README.md
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/README.md b/3rdparty/libprocess/README.md
new file mode 100644
index 0000000..288f085
--- /dev/null
+++ b/3rdparty/libprocess/README.md
@@ -0,0 +1,343 @@
+# Libprocess User Guide
+
+*Note* This User Guide is Work in Progress.
+
+The library _libprocess_ provides high level elements for an actor programming
+style with asynchronous message-handling and a variety of related basic system
+primitives. It's API and implementation are written in C++.
+
+##Introduction
+The design of libprocess is inspired by [Erlang](http://erlang.org),
+a language that implements the
+[actor model](http://en.wikipedia.org/wiki/Actor_model).
+
+As the name already suggests, one of the libprocess core concepts is a
+[Process](#process). This is a single threaded, independent actor which can
+communicate with other processes by sending and receiving [messages](#message).
+These are serialized into [Protobuf messages](#protobuf) format and stored in
+the recipient process' message buffer, from where its thread can process them
+in a serial fashion.
+
+processes assume they have callers/clients and thus should avoid blocking at all costs
+
+A process can be identified symbolically by its [PID](#pid).
+
+Functional composition of different processes enabled by the concept of [Futures](#future) and [Promises](#promise)
+A future is a read-only placeholder for a result which might be computed asynchronously, while the [promise](#promise) on the other side is the writable placeholder to fullfill the corresponding future.
+Continutation allow chaining of futures.
+
+Local messaging between different processes is enabled via the following concepts: [delay](#delay), [defere](defere), [async](#async), [sequence](#sequence,), and [dispatch](#dispatch).
+Furthermore libprocess allows for remote messaging via [send](#send), [route](#route), and [install](#install).
+
+Usually the above mention concepts are applied in comination in certain pattern. See the [Table of Patterns](#table_pattern) for details.
+<!---
+#Subprocess
+
+Resource handling: #owned #shared
+
+Networking: #Network, HTTP, Socket, help
+
+testing: check gmock gtest
+
+Logging, Monitoring, Statistics: #Logging, #Profiler, #System, #Statistics, #Timeseries, #Metrics
+
+Time Concepts: #Clock, #Event, #Filter, #Time, #Timer, #Timeout, #RateLimiter
+
+Cleanup: #Garbarge Collection, #Reaper
+> Remove Run.hpp??
+--->
+
+##Overview
+###Table of Concepts
+
+* <a href="#async">Async</a>
+* <a href="#defer">Defer</a>
+* <a href="#delay">Delay</a>
+* <a href="#dispatch">Dispatch</a>
+* <a href="#future">Future</a>
+* <a href="#id">Id</a>
+* <a href="#pid">PID</a>
+* <a href="#process">Process</a>
+* <a href="#promise">Promise</a>
+* <a href="#protobuf">Protobuf</a>
+* <a href="#sequence">Sequence</a>
+
+<!---
+* <a href="#gc">Garbage Collection, Reaper</a>2
+* <a href="#dispatch">Dispatch</a>2
+* <a href="#event">Event</a>2
+* <a href="#help">Help</a>3
+* <a href="#http">Network, HTTP, Socket</a>3
+* <a href="#id">ID</a>?3
+* <a href="#io">IO</a>3
+* <a href="#latch">Latch, Mutex</a>3
+* <a href="#limiter">Limiter </a>3
+* <a href="#logging">Logging</a>2
+* <a href="#clock">Clock, Time, Timeout</a>2
+* <a href="#gc">Garbage Collection, Reaper</a>2
+* <a href="#process">Process, Executor, Once</a>2
+
+* <a href="#profiler">Profiler</a>3
+* <a href="#queue">Queue</a>3
+* <a href="#sequence">Sequence</a>3
+* <a href="#statistics">Statistics, Timeseries</a>3
+* * <a href="#adress">Adress</a>
+* <a href="#async">Async</a>
+--->
+<a name="table_pattern"/>
+
+###Table of Patterns
+* <a href="#clockPattern">Clock Pattern</a>
+* <a href="#clockPattern">Timer Pattern</a>
+* <a href="#clockPattern">Reaper Pattern</a>
+
+##Concepts
+
+<a name="async"/>
+## `Async`
+
+<a name="defer"/>
+## `Defer`
+defers a dispatch on some process (i.e., a deferred asynchronous function/method invocation)
+```
+class SomeProcess : public Process<SomeProcess> {
+public:
+ void merge() {
+ queue.get()
+ .then(defer(self(), [] (int i) {
+ …;
+ }));
+ }
+
+private:
+ Queue<int> queue;
+};
+```
+defer returns a new type (Deferred<Return(Args…)>) that acts like a standard function, and an API can force asynchronous callback semantics by requiring that typedefer returns a new type (Deferred<Return(Args…)>) that acts like a standard function, and an API can force asynchronous callback semantics by requiring that type
+
+
+<a name="delay"/>
+## `Delay`
+
+<a name="dispatch"/>
+dispatch ≈ message passing
+asynchronous function (method) invocation
+(think Erlang’s gen_server cast, but no call analogue … avoid blocking operations!)
+
+## `Dispatch`
+```
+class QueueProcess : public Process<QueueProcess> {
+public:
+ void enqueue(int i) { this->i = i; }
+ int dequeue() { return this->i; }
+
+private:
+ int i;
+};
+
+
+int main(int argc, char** argv) {
+ QueueProcess process;
+ spawn(process);
+
+ dispatch(process, &QueueProcess::enqueue, 42);
+ dispatch(process, &QueueProcess::enqueue, 43);
+
+ …;
+}
+```
+
+<a name="future"/>
+## `Future`
+A Future .... The counterpart on the producer side is a [Promise](#promise)
+
+<a name="id"/>
+## `ID`
+The [namespace ID](@ref process::ID) contains
+[a function](@ref process::ID::generate)
+that generates unique ID strings given a prefix. This is used in the following to provide PID names.
+
+<a name="pid"/>
+## `PID`
+A PID provides a level of indirection for naming a process without having an actual reference (pointer) to it (necessary for remote processes)
+```
+int main(int argc, char** argv) {
+ QueueProcess process;
+ spawn(process);
+
+ PID<QueueProcess> pid = process.self();
+
+ dispatch(pid, &QueueProcess:enqueue, 42);
+
+ terminate(pid);
+ wait(pid);
+
+ return 0;
+}
+```
+<a name="process"/>
+## `Process`
+process ≈ thread
+creating/spawning a process is very cheap (no actual thread gets created, and no thread stack gets allocated)
+process ≈ object
+process ≈ actor
+
+each process has a “queue†of incoming “messagesâ€
+processes provide execution contexts (only one thread executing within a process at a time so no need for per process synchronization)
+Lifecycle
+```
+using namespace process;
+
+class MyProcess : public Process<MyProcess> {};
+
+int main(int argc, char** argv) {
+ MyProcess process;
+ spawn(process);
+ terminate(process);
+ wait(process);
+ return 0;
+}
+```
+
+<a name="promise"/>
+
+## `Promise`
+```
+template <typename T>
+class QueueProcess : public Process<QueueProcess<T>> {
+public:
+ Future<T> dequeue() {
+ return promise.future();
+ }
+
+ void enqueue(T t) {
+ promise.set(t);
+ }
+
+private:
+ Promise<T> promise;
+};
+
+int main(int argc, char** argv) {
+ …;
+
+ Future<int> i = dispatch(process, &QueueProcess<int>::dequeue);
+
+ dispatch(process, &QueueProcess<int>::enqueue, 42);
+
+ i.await();
+
+ …;
+}
+```
+tells caller they might need to wait … but if nobody should block, how do you wait?
+Link to then
+
+
+<a name="protobuf"/>
+## `Protobuf`
+
+<a name="route"/>
+## `route`
+```
+using namespace process;
+using namespace process::http;
+
+
+class QueueProcess : public Process<QueueProcess> {
+public:
+ QueueProcess() : ProcessBase(“queueâ€) {}
+
+ virtual void initialize() {
+ route(“/enqueueâ€, [] (Request request) {
+ // Parse argument from ‘request.query’ or ‘request.body’.
+ enqueue(arg);
+ return OK();
+ });
+ }
+};
+```
+curl localhost:1234/queue/enqueue?value=42
+
+<a name="sequence"/>
+## `Sequence`
+
+<a name="then"/>
+## `Then`
+```
+int main(int argc, char** argv) {
+ …;
+
+ Future<int> i = dispatch(process, &QueueProcess<int>::dequeue);
+
+ dispatch(process, &QueueProcess<int>::enqueue, 42);
+
+ i.then([] (int i) {
+ // Use ‘i’.
+ });
+
+ …;
+}
+```
+when future is satisfied, callbacks should be invoked …
+(1) when should a callback get invoked?
+(2) using what execution context?
+synchronously: using the current thread, blocking whatever was currently executing
+asynchronously: using a different thread than the current thread (but what thread?)
+
+Link to defere <a href="#defer">Defer</a>
+
+<!---
+The `Option` type provides a safe alternative to using `NULL`. An `Option` can be constructed explicitely or implicitely:
+
+```
+ Option<bool> o(true);
+ Option<bool> o = true;
+```
+
+You can check if a value is present using `Option::isSome()` and `Option::isNone()` and retrieve the value using `Option::get()`:
+
+```
+ if (!o.isNone()) {
+ ... o.get() ...
+ }
+```
+
+Note that the current implementation *copies* the underlying values (see [Philosophy](#philosophy) for more discussion). Nothing prevents you from using pointers, however, *the pointer will not be deleted when the Option is destructed*:
+
+```
+ Option<std::string*> o = new std::string("hello world");
+```
+
+The `None` type acts as "syntactic sugar" to make using [Option](#option) less verbose. For example:
+
+```
+ Option<T> foo(const Option<T>& o) {
+ return None(); // Can use 'None' here.
+ }
+
+ ...
+
+ foo(None()); // Or here.
+
+ ...
+
+ Option<int> o = None(); // Or here.
+```
+
+Similar to `None`, the `Some` type can be used to construct an `Option` as well. In most circumstances `Some` is unnecessary due to the implicit `Option` constructor, however, it can still be useful to remove any ambiguities as well as when embedded within collections:
+
+```
+ Option<Option<std::string>> o = Some("42");
+
+ std::map<std::string, Option<std::string>> values;
+ values["value1"] = None();
+ values["value2"] = Some("42");
+```
+--->
+##Pattern/Examples
+
+##Building
+
+###Dependencies
+> NOTE: Libprocess requires the following third party libraries: