A FanoutSender allows fanning out updates to multiple output receivers. Values can be written as with a normal Sender. When there is only one output receiver, the memory used by a FanoutSender (and the corresponding output receiver) is the same as the memory used by a normal channel.
Synopsis
Declared in <folly/channels/FanoutSender.h>
template<typename ValueType>
class FanoutSender;
Description
When a new output receiver is added, an optional vector of initial values can be provided. These initial values will only be sent to the new receiver.
Memory used by closed receivers is reclaimed lazily (when iterating over receivers).
Example:
FanoutSender<int> fanoutSender; auto receiver1 = fanoutSender.subscribe(); auto receiver2 = fanoutSender.subscribe(); auto receiver3 = fanoutSender.subscribe({1, 2, 3}); std::move(fanoutSender).close();
Member Functions
Name |
Description |
|
Constructors |
|
Destroys the fanout sender, closing it if still open. |
Move‐assigns a fanout sender, transferring ownership. |
|
Returns whether this fanout sender has any active output receivers. |
|
Closes the fanout sender. |
|
Returns the number of output receivers for this fanout sender. |
|
|
|
Sends the given value to all corresponding receivers. |
Created with MrDocs