Documentation ¶
Overview ¶
Package futures is useful for broadcasting an identical message to a multitude of listeners as opposed to channels which will choose a listener at random if multiple listeners are listening to the same channel. The future will also cache the result so any future interest will be immediately returned to the consumer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Completer ¶
type Completer <-chan interface{}
Completer is a channel that the future expects to receive a result on. The future only receives on this channel.
type Future ¶
type Future struct {
// contains filtered or unexported fields
}
Future represents an object that can be used to perform asynchronous tasks. The constructor of the future will complete it, and listeners will block on getresult until a result is received. This is different from a channel in that the future is only completed once, and anyone listening on the future will get the result, regardless of the number of listeners.