mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 02:03:13 -05:00
Watch feature (#1527)
* Add part 1 watch functionality. (squashed) * add funcs for service/endpoint fqdns * add endpoints watch * document exposed funcs * only send subset deltas * locking for watch map * tests and docs * add pod watch * remove debugs prints * feedback part 1 * add error reporting to proto * inform clients of server stop+errors * add grpc options param * use proper context * Review feedback: * Removed client (will move to another repo) * Use new log functions * Change watchChan to be for string not []string * Rework how k8s plugin stores watch tracking info to simplify * Normalize the qname on watch request * Add blank line back * Revert another spurious change * Fix tests * Add stop channel. Fix tests. Better docs for plugin interface. * fmt.Printf -> log.Warningf * Move from dnsserver to plugin/pkg/watch * gofmt * remove dead client watches * sate linter * linter omg
This commit is contained in:
23
plugin/pkg/watch/watch.go
Normal file
23
plugin/pkg/watch/watch.go
Normal file
@@ -0,0 +1,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)
|
||||
}
|
||||
Reference in New Issue
Block a user