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 = ts.Promise.new()
>>> future.done()
False
>>> promise.set_result(5)
>>> future.done()
True
>>> future.result()
5

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.

Constructors

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

Creates a linked promise and future pair.