Open heaths opened 2 months ago
I'm thinking this is just a custom implementation of a Future
where the poll
method will use Retry-After
or whatever - like we do in other languages - to set a timeout for the waker to poll again. To run the task we can use the task spawner @LarryOsterman wrote.
For reference, legacy
generates these each time: https://github.com/Azure/azure-sdk-for-rust/blob/dce289dc72dbe4efbf375f2c6efb6dd1c435e3f5/services/svc/keyvault/src/package_7_5/mod.rs#L1423
Need to prototype some options because I'm not sure if actually defining a Poller<T>
that implements Future<T>
or IntoFuture<T>
really adds anything apart from the ability to hand additional functions off it.
/cc @analogrelay in case she has any thoughts.
I do like the idea of being able to directly await a Poller
, as long we also properly support cancellation via Drop
. That would allow a poller to act like any other future and use all the existing timeout/cancellation patterns in rust.
Good thing to test, yeah (about Drop
). As I was thinking about this more this morning, I figured we'd probably construct one much like we do a Pageable<T>
, which also takes a couple of functions, and Poller<T>
would implement Future
or IntoFuture
itself.
We should probably implement Future
. According to the docs:
Implementing
Future
is a good choice in most cases. But implementingIntoFuture
is most useful when implementing “async builder” types, which allow their values to be modified multiple times before being.await
ed.
Talking with @JeffreyRichter about Go's Poller[T]
, a few things of note:
RetryOptions
, but something probably similar. We should use the retry-after
header if services send it. IIRC, there is 1 or 2 custom headers older services may send.
As part of the big refactoring for beta.2, I not only moved the LRO stuff but renamed it. Seems I forgot to move
Lro
to aPoller
object...or maybe we didn't even have that before and needed to implement that yet. All the support types and functions are there.