pub trait OperatorBuilderExt<G: Scope> {
fn build_async<B, Fut>(self, scope: G, constructor: B)
where
B: FnOnce(Vec<Capability<G::Timestamp>>, Rc<RefCell<Vec<Antichain<G::Timestamp>>>>, Scheduler) -> Fut,
Fut: Future + 'static;
}
Expand description
Extension trait for OperatorBuilder
.
Required Methods
Creates an operator implementation from supplied async logic constructor.
The logic constructor is expected to return a future that will never return and that follows the following pattern:
ⓘ
op.build_async(scope, move |capabilities, frontier, scheduler| async move {
while scheduler.yield_now().await {
// async operator logic here
}
});
Since timely’s input handles and frontier notifications are not integrated with the async
ecosystem the only way to yield control back to timely is by awaiting on
scheduler.yield_now()
. The operator will ensure that this call resolves when there is
more work to do.