m/pkg/event: split out ValueWatch from Value
Summary:
This implements a small TODO, letting the etcd Value implementation only
implement the Watch part of the interface.
Test Plan: Refactor.
Change-Id: I9ccd73ce4d165182d9588387230e71bcb425ab94
Reviewed-on: https://review.monogon.dev/c/monogon/+/122
Reviewed-by: Lorenz Brun <lorenz@nexantic.com>
diff --git a/metropolis/pkg/event/etcd/etcd.go b/metropolis/pkg/event/etcd/etcd.go
index 041e600..ff40bcd 100644
--- a/metropolis/pkg/event/etcd/etcd.go
+++ b/metropolis/pkg/event/etcd/etcd.go
@@ -14,11 +14,11 @@
)
var (
- // Type assert that *Value implements event.Value. We do this artificially,
- // as there currently is no code path that needs this to be strictly true.
- // However, users of this library might want to rely on the Value type
- // instead of particular Value implementations.
- _ event.Value = &Value{}
+ // Type assert that *Value implements event.ValueWatcher. We do this
+ // artificially, as there currently is no code path that needs this to be
+ // strictly true. However, users of this library might want to rely on the
+ // Value type instead of particular Value implementations.
+ _ event.ValueWatch = &Value{}
)
// Value is an 'Event Value' backed in an etcd cluster, accessed over an
@@ -54,11 +54,6 @@
return data, nil
}
-func (e *Value) Set(val interface{}) {
- // TODO(q3k): split up the Value interface into ValueReader/ValueWriter
- panic("Set is unimplemented on etcd values")
-}
-
func (e *Value) Watch() event.Watcher {
ctx, ctxC := context.WithCancel(context.Background())
return &watcher{