Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-956

Add an "Sequence" abstraction to serialize callbacks.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.19.0
    • c++ api
    • None

    Description

      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));

      Attachments

        Issue Links

          Activity

            People

              jieyu Jie Yu
              jieyu Jie Yu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: