bridgemon

package
v5.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

bridgemon

Bridge Monitor provides a simple tool to monitor and cache a bridge's data for easy, efficient access by other routines. It is safe for multi-threaded use and can be closed manually or whenever the bridge is destroyed.

It is created by passing a bridge handle in. The bridge should already exist for this to be operational, and initial data is loaded when the monitor is created.

There are two method for consuming the data. Data() provides arbitrary access to the cached bridge data while Watch() provides a channel over which the bridge data will be sent whenever updates are made.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

Monitor is a bridge monitor, which maintains bridge data. It monitors an ARI bridge for events and keeps an internal cache of the bridge's data.

func New

func New(h *ari.BridgeHandle) *Monitor

New returns a new bridge monitor

func (*Monitor) Close

func (m *Monitor) Close()

Close shuts down a bridge monitor

func (*Monitor) Data

func (m *Monitor) Data() *ari.BridgeData

Data returns the current bridge data

func (*Monitor) Handle

func (m *Monitor) Handle() *ari.BridgeHandle

Handle returns the BridgeHandle which was used to create the bridge Monitor.

func (*Monitor) Key

func (m *Monitor) Key() *ari.Key

Key returns the key of the monitored bridge

func (*Monitor) Watch

func (m *Monitor) Watch() <-chan *ari.BridgeData

Watch returns a channel on which bridge data will be returned when events occur. This channel will be closed when the bridge or the monitor is destoyed.

NOTE: the user should NEVER close this channel directly.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL