aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg/watch/watch.go
blob: 7e77bb7b3b166aaeea3ccca4223b619dbde8f831 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package watch

// 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 Chan chan string

// Watchable is the interface watchable plugins should implement
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)
}