proxygen
|
#include <BroadcastHandler.h>
Public Types | |
typedef HandlerAdapter< T, std::unique_ptr< folly::IOBuf > >::Context | Context |
Public Types inherited from wangle::HandlerAdapter< T, std::unique_ptr< folly::IOBuf > > | |
typedef Handler< T, T, std::unique_ptr< folly::IOBuf >, std::unique_ptr< folly::IOBuf > >::Context | Context |
Public Types inherited from wangle::Handler< T, T, std::unique_ptr< folly::IOBuf >, std::unique_ptr< folly::IOBuf > > | |
typedef T | rin |
typedef T | rout |
typedef std::unique_ptr< folly::IOBuf > | win |
typedef std::unique_ptr< folly::IOBuf > | wout |
typedef HandlerContext< T, std::unique_ptr< folly::IOBuf > > | Context |
Protected Member Functions | |
template<typename FUNC > | |
void | forEachSubscriber (FUNC f) |
Private Attributes | |
std::map< uint64_t, Subscriber< T, R > * > | subscribers_ |
uint64_t | nextSubscriptionId_ {0} |
uint64_t | identifier_ {0} |
Additional Inherited Members | |
Static Public Attributes inherited from wangle::Handler< T, T, std::unique_ptr< folly::IOBuf >, std::unique_ptr< folly::IOBuf > > | |
static const HandlerDir | dir |
An Observable type handler for broadcasting/streaming data to a list of subscribers.
Definition at line 30 of file BroadcastHandler.h.
typedef HandlerAdapter<T, std::unique_ptr<folly::IOBuf> >::Context wangle::BroadcastHandler< T, R >::Context |
Definition at line 32 of file BroadcastHandler.h.
|
inlineoverride |
Definition at line 34 of file BroadcastHandler.h.
|
virtual |
If there are no subscribers listening to the broadcast, close the pipeline. This will also delete the broadcast from the BroadcastPool.
Definition at line 71 of file BroadcastHandler-inl.h.
References folly::netops::close().
Referenced by wangle::BroadcastHandler< std::string, std::string >::~BroadcastHandler().
|
inlineprotected |
Definition at line 87 of file BroadcastHandler.h.
uint64_t wangle::BroadcastHandler< T, R >::getArbitraryIdentifier | ( | ) |
FOR TESTS ONLY! Return a unique identifier of this object.
Definition at line 80 of file BroadcastHandler-inl.h.
Referenced by wangle::BroadcastHandler< std::string, std::string >::onData(), and TEST_F().
|
inlinevirtual |
Invoked for each data that is about to be broadcasted to the subscribers. Subclasses can override to add custom behavior.
Definition at line 77 of file BroadcastHandler.h.
|
inlinevirtual |
Invoked when a new subscriber is added. Subclasses can override to add custom behavior.
Definition at line 65 of file BroadcastHandler.h.
|
inlinevirtual |
Invoked when a subscriber is removed. Subclasses can override to add custom behavior.
Definition at line 71 of file BroadcastHandler.h.
|
override |
Definition at line 21 of file BroadcastHandler-inl.h.
References wangle::Subscriber< T, R >::onNext(), and s.
Referenced by wangle::BroadcastHandler< std::string, std::string >::~BroadcastHandler().
|
override |
Definition at line 29 of file BroadcastHandler-inl.h.
References wangle::Subscriber< T, R >::onCompleted(), and s.
Referenced by TEST_F(), and wangle::BroadcastHandler< std::string, std::string >::~BroadcastHandler().
|
override |
Definition at line 38 of file BroadcastHandler-inl.h.
References folly::exceptionStr(), wangle::Subscriber< T, R >::onError(), and s.
Referenced by wangle::BroadcastHandler< std::string, std::string >::~BroadcastHandler().
|
virtual |
Subscribes to the broadcast. Returns a unique subscription ID for this subscriber.
Definition at line 51 of file BroadcastHandler-inl.h.
Referenced by TEST_F(), and wangle::BroadcastHandler< std::string, std::string >::~BroadcastHandler().
|
virtual |
Unsubscribe from the broadcast. Closes the pipeline if the number of subscribers reaches zero.
Definition at line 59 of file BroadcastHandler-inl.h.
Referenced by wangle::BroadcastHandler< std::string, std::string >::~BroadcastHandler().
|
private |
Definition at line 99 of file BroadcastHandler.h.
|
private |
Definition at line 96 of file BroadcastHandler.h.
|
private |
Definition at line 95 of file BroadcastHandler.h.
Referenced by wangle::BroadcastHandler< std::string, std::string >::forEachSubscriber(), and wangle::BroadcastHandler< std::string, std::string >::~BroadcastHandler().