View Source FDB.Future (fdb v6.3.23-0)

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

Specs

t() :: %FDB.Future{
  constant: boolean(),
  on_resolve: [(any() -> any())],
  resource: identifier() | nil,
  value: any(),
  waiting_for: [identifier()]
}

Link to this section Functions

Specs

all([t()]) :: t()
Link to this function

await(future, timeout \\ 5000)

View Source

Specs

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.

Specs

constant(any()) :: t()

Specs

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.

Specs

ready?(t()) :: boolean()

Checks whether the async operation is completed.

If the future is constructed via Future.then/3, then only the root future is checked for completion.

Specs

then(t(), (any() -> t())) :: t()