progress reports while waiting for a result

5 views
Skip to first unread message

Igor Bukanov

unread,
Jul 31, 2021, 2:13:58 PM7/31/21
to chromium-mojo
Hi,

Is there a common pattern to implement Mojo calls that also send back progress reports in addition to delivering the final result?

I initially considerer something like:

interface MyService {
  LenthyAction(pending_remote<ProgressReport> report) -> (SomeResult result);
};

interface ProgressReport {
  Progress(float percent);
};

But then it turned out especially with disconnect handling etc it was easier to implement an alternative like:

interface MyService {
  LenthyAction(pending_remote<ResultReporter> report);
};

interface  ResultReporter  {
  Progress(float percent);
  FinalResult(SomeResult result);
};

That is, make everything just asynchronous messages. 

Also, are such cases  good candidadtes to use associative remotes/receivers ? Or there would be no performance difference in practice?

Regards, Igor

Ken Rockot

unread,
Jul 31, 2021, 3:06:57 PM7/31/21
to Igor Bukanov, chromium-mojo
For (presumably low-frequency) long-running actions there's unlikely to be a meaningful performance difference between using an associated vs a non-associated progress interface, so this is mostly a matter of ergonomics and clarity.

You could associate ProgressReport to order Progress messages against the LengthyAction reply, but IMHO it would be simpler and clearer to go with your ResultReporter approach and no associated interfaces.


Regards, Igor

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-mojo/a5d7b368-5a41-45e6-afa2-13cc20b1d114n%40chromium.org.
Reply all
Reply to author
Forward
0 new messages