watch

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chan

type Chan chan string

Chan is used to inform the server of a change. Whenever a watched FQDN has a change in data, that FQDN should be sent down this channel.

type Manager

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

Manager contains all the data needed to manage watches

func NewWatcher

func NewWatcher(plugins []Watchable) *Manager

NewWatcher creates a Watcher, which is used to manage watched names.

func (*Manager) Stop

func (w *Manager) Stop()

Stop cancels open watches and stops the watch processing go routine.

func (*Manager) Watch

func (w *Manager) Watch(stream pb.DnsService_WatchServer) error

Watch monitors a client stream and creates and cancels watches.

type Watchable

type Watchable interface {
	// Name returns the plugin name.
	Name() string

	// SetWatchChan is called when the watch channel is created.
	SetWatchChan(Chan)

	// Watch is called whenever a watch is created for a FQDN. Plugins
	// should send the FQDN down the watch channel when its data may have
	// changed. This is an exact match only.
	Watch(qname string) error

	// StopWatching is called whenever all watches are canceled for a FQDN.
	StopWatching(qname string)
}

Watchable is the interface watchable plugins should implement

type Watcher

type Watcher interface {
	// Watch monitors a client stream and creates and cancels watches.
	Watch(pb.DnsService_WatchServer) error

	// Stop cancels open watches and stops the watch processing go routine.
	Stop()
}

Watcher handles watch creation, cancellation, and processing.

Jump to

Keyboard shortcuts

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