Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notifier ¶
type Notifier interface { // Notify sends an event to the channel. Notify(interface{}) bool }
type SubscribableChannel ¶
type SubscribableChannel struct {
// contains filtered or unexported fields
}
SubscribableChannel is different from the Go channel which dispatches every event to only single consumer regardless of the number of consumers. Instead, it dispatches every event to all consumers by calling the eventHandlers they have registered.
func NewSubscribableChannel ¶
func NewSubscribableChannel(name string, bufferSize int) *SubscribableChannel
func (*SubscribableChannel) Notify ¶
func (n *SubscribableChannel) Notify(e interface{}) bool
func (*SubscribableChannel) Run ¶
func (n *SubscribableChannel) Run(stopCh <-chan struct{})
func (*SubscribableChannel) Subscribe ¶
func (n *SubscribableChannel) Subscribe(h eventHandler)
type Subscriber ¶
type Subscriber interface { // Subscribe registers an eventHandler which will be called when an event is sent to the channel. // It's not thread-safe and it's supposed to be called serially before first event is published. // The eventHandler is supposed to execute quickly and not perform blocking operation. Blocking operation should be // deferred to a routine that is triggered by the eventHandler. Subscribe(h eventHandler) }
Click to show internal directories.
Click to hide internal directories.