Serialize streams of asynchronous operations.
Some asynchronous APIs produce streams of results, where (1) each of these results is obtained asynchronously, and (2) on a single stream, only one of these results can be requested at a time.
Where both conditions apply the APIs will consume an AsyncToken as a parameter, and return a future<std::pair<ResultT,StatusOr<AsyncToken>>. When this future is satisfied, and the StatusOr<> contains an value, the caller can invoke the API once again. Before the future is satisfied the application does not have (and cannot create) a valid AsyncToken to invoke the API again.
Constructors
AsyncToken()
Create an invalid async token.
AsyncToken(AsyncToken &&)
Move constructor. Invalidates rhs.
| Parameter | |
|---|---|
| Name | Description |
rhs |
AsyncToken &&
|
AsyncToken(AsyncToken const &)
Disable copying, this is a move-only class.
| Parameter | |
|---|---|
| Name | Description |
|
AsyncToken const &
|
Operators
operator=(AsyncToken &&)
Move assignment. Invalidates rhs.
| Parameter | |
|---|---|
| Name | Description |
rhs |
AsyncToken &&
|
| Returns | |
|---|---|
| Type | Description |
AsyncToken & |
|
operator=(AsyncToken const &)
Disable copying, this is a move-only class.
| Parameter | |
|---|---|
| Name | Description |
|
AsyncToken const &
|
| Returns | |
|---|---|
| Type | Description |
AsyncToken & |
|
Functions
valid() const
Returns false for invalidated instances.
| Returns | |
|---|---|
| Type | Description |
bool |
|