class tensorstore.Promise

Handle for producing the result of an asynchronous operation.

A promise represents the producer interface corresponding to a Future, and may be used to signal the completion of an asynchronous operation.

>>> promise, future =
>>> future.done()
>>> promise.set_result(5)
>>> future.done()
>>> future.result()

See also

Public members

set_result(result: object) None

Marks the linked future as successfully completed with the specified result.

set_exception(exception: object) None

Marks the linked future as unsuccessfully completed with the specified error.


static new() Tuple[Promise, Future[Any]]

Creates a linked promise and future pair.