You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by "Jie Yu (JIRA)" <ji...@apache.org> on 2014/01/30 19:00:19 UTC

[jira] [Commented] (MESOS-956) Add an "Sequence" abstraction to serialize callbacks.

    [ https://issues.apache.org/jira/browse/MESOS-956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13886829#comment-13886829 ] 

Jie Yu commented on MESOS-956:
------------------------------

https://reviews.apache.org/r/17476/

> Add an "Sequence" abstraction to serialize callbacks.
> -----------------------------------------------------
>
>                 Key: MESOS-956
>                 URL: https://issues.apache.org/jira/browse/MESOS-956
>             Project: Mesos
>          Issue Type: Improvement
>          Components: c++ api
>            Reporter: Jie Yu
>            Assignee: Jie Yu
>             Fix For: 0.18.0
>
>
> A sequence is used to serialize a set of callbacks such that a callback won't be invoked until all previous registered callbacks are done. For example, consider the following callbacks in a process:
> class TestProcess : public Process<TestProcess> {
> public:
>   Future<int> foo() { return dispatch(self(), &Self::_foo); }
>   Future<int> _foo() { return dispatch(self(), &Self::__foo); }
>   Future<int> __foo() { return fooValue; }
>   Future<int> bar() { return barValue; }
> }
> A user may want foo and its continuations (_foo and __foo) to be executed atomically without interleaved with other callbacks like bar. To achieve that, with the sequence abstraction, one can just do the following:
> Sequence sequence;
> sequence.add(defer(procese, &TestProcess::foo));
> sequence.add(defer(process, &TestProcess::bar));



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)