Documentation ¶
Overview ¶
Package dispatcher enables registering and unregistering of listeners for different Events.
The channel system here is a two tier affair that forwards changes from the core configuration store to NBI listeners and to any registered device listeners This is so that the Configuration system does not have to be aware of the presence or lack of NBI, Device synchronizers etc.
Index ¶
- type Dispatcher
- func (d *Dispatcher) GetListeners() []string
- func (d *Dispatcher) ListenOperationalState(operationalStateChannel <-chan events.OperationalStateEvent)
- func (d *Dispatcher) RegisterOpState(subscriber string) (chan events.OperationalStateEvent, error)
- func (d *Dispatcher) UnregisterOperationalState(subscriber string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher manages SB and NB configuration event listeners
func NewDispatcher ¶
func NewDispatcher() *Dispatcher
NewDispatcher creates and initializes a new event dispatcher
func (*Dispatcher) GetListeners ¶
func (d *Dispatcher) GetListeners() []string
GetListeners returns a list of registered listeners names
func (*Dispatcher) ListenOperationalState ¶
func (d *Dispatcher) ListenOperationalState(operationalStateChannel <-chan events.OperationalStateEvent)
ListenOperationalState is a go routine function that listens out for changes made in the configuration and distributes this to registered deviceListeners on the Southbound and registered nbiListeners on the northbound Southbound listeners are only sent the events that matter to them All events.Events are sent to northbound listeners
func (*Dispatcher) RegisterOpState ¶
func (d *Dispatcher) RegisterOpState(subscriber string) (chan events.OperationalStateEvent, error)
RegisterOpState is a way for nbi instances to register for channel of events
func (*Dispatcher) UnregisterOperationalState ¶
func (d *Dispatcher) UnregisterOperationalState(subscriber string)
UnregisterOperationalState closes the device channel and removes it from the deviceListeners