aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg/watch/watch.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/pkg/watch/watch.go')
-rw-r--r--plugin/pkg/watch/watch.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugin/pkg/watch/watch.go b/plugin/pkg/watch/watch.go
new file mode 100644
index 000000000..7e77bb7b3
--- /dev/null
+++ b/plugin/pkg/watch/watch.go
@@ -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)
+}