fdb v5.1.7-5 FDB.Future View Source

A FDB.Future.t/0 represents the result of an async operation.

Link to this section Summary

Functions

Waits for the async operation associated with the future to complete

Maps the future’s result

Checks whether the async operation is completed

Link to this section Types

Link to this type t() View Source
t() :: %FDB.Future{on_resolve: [(any() -> any())], resource: identifier()}

Link to this section Functions

Link to this function await(future, timeout \\ 5000) View Source
await(t(), timeout()) :: any()

Waits for the async operation associated with the future to complete.

The result of the operations is returned or FDB.Error is raised if the operation failed. In case of timeout FDB.TimeoutError is raised.

Link to this function map(future, callback) View Source
map(t(), (any() -> any())) :: t()

Maps the future’s result.

Returns a new future. The callback function will be applied on the result of the given future.

Link to this function ready?(future) View Source
ready?(t()) :: boolean()

Checks whether the async operation is completed.

If the returned value is true, any further calls to await/1 will return immediatly.