Add SemiFuture class.
Summary:
Offer a clean separation between future as a vocabulary type for crossing
library interfaces, and future as a type to manage continuations.
The principle is that if we want an API with clean separation of execution it
should both return and receive SemiFutures. The returned SemiFuture would
only be awaitable, but not continuable. If the caller wants to enqueue a
continuation then it is efficiently convertable into a folly::Future by
calling .via.
This means that an API a) Does not have to take an executor to ensure it
returns a valid future. That can be deferred to the caller or the caller's
caller/target for true separation. b) The API can ensure that its own executor
is not exposed to the caller, while still having a clean API.
Obviously if some API wants to allow returning of a continuable future, then it
can also provide an executor-taking API.
Reviewed By: yfeldblum
Differential Revision:
D5769284
fbshipit-source-id:
46241d1274bf7b1698a7d28a47cff2a65a983740