template<typename T, typename R, typename P = DefaultPipeline>
class wangle::BroadcastPool< T, R, P >
A pool of upstream broadcast pipelines. There is atmost one broadcast for any unique routing data. Creates and maintains upstream connections and broadcast pipeliens as necessary.
Meant to be used as a thread-local instance.
Definition at line 50 of file BroadcastPool.h.
template<typename T , typename R, typename P >
Gets the BroadcastHandler, or creates one if it doesn't exist already, for the given routingData.
If a broadcast is already available for the given routingData, returns the BroadcastHandler from the pipeline. If not, an upstream connection is created and stored along with a new broadcast pipeline for this routingData, and its BroadcastHandler is returned.
Caller should immediately subscribe to the returned BroadcastHandler to prevent it from being garbage collected. Note that to ensure that this works correctly, the returned future completes on an InlineExecutor such that .then will be called inline with satisfaction of the underlying promise.
Reimplemented in wangle::MockBroadcastPool.
Definition at line 95 of file BroadcastPool-inl.h.
References wangle::BroadcastPool< T, R, P >::BroadcastManager::BroadcastManager(), wangle::BroadcastPool< T, R, P >::broadcasts_, and folly::gen::move.
99 return iter->second->getHandler();
103 new BroadcastManager(
this, routingData));
105 auto broadcastPtr = broadcast.get();
111 return broadcastPtr->getHandler();
constexpr detail::Map< Move > move
std::map< R, typename BroadcastManager::UniquePtr > broadcasts_
std::unique_ptr< BroadcastManager, folly::DelayedDestruction::Destructor > UniquePtr