treewide: errors variables should be prefixed with Err
Change-Id: Ic277f98ebcd03356500ce7daba199738e701e81c
Reviewed-on: https://review.monogon.dev/c/monogon/+/3025
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Vouch-Run-CI: Tim Windelschmidt <tim@monogon.tech>
diff --git a/metropolis/pkg/event/etcd/etcd.go b/metropolis/pkg/event/etcd/etcd.go
index 14dfd99..71e8056 100644
--- a/metropolis/pkg/event/etcd/etcd.go
+++ b/metropolis/pkg/event/etcd/etcd.go
@@ -402,7 +402,7 @@
}
if backlogOnly && len(w.backlogged) == 0 {
- return empty, event.BacklogDone
+ return empty, event.ErrBacklogDone
}
// Update backlog from etcd if needed.
diff --git a/metropolis/pkg/event/etcd/etcd_test.go b/metropolis/pkg/event/etcd/etcd_test.go
index 45b5f98..f1eb5ed 100644
--- a/metropolis/pkg/event/etcd/etcd_test.go
+++ b/metropolis/pkg/event/etcd/etcd_test.go
@@ -776,15 +776,15 @@
// As expected, next call to Get with BacklogOnly fails - there truly is no new
// updates to emit.
_, err = watcher.Get(ctx, event.BacklogOnly[StringAt]())
- if want, got := event.BacklogDone, err; !errors.Is(got, want) {
+ if want, got := event.ErrBacklogDone, err; !errors.Is(got, want) {
t.Fatalf("Second Get: wanted %v, got %v", want, got)
}
// Implementation detail: even though there is a new value ('second'),
- // BacklogOnly will still return BacklogDone.
+ // BacklogOnly will still return ErrBacklogDone.
tc.put(t, k, "second")
_, err = watcher.Get(ctx, event.BacklogOnly[StringAt]())
- if want, got := event.BacklogDone, err; !errors.Is(got, want) {
+ if want, got := event.ErrBacklogDone, err; !errors.Is(got, want) {
t.Fatalf("Third Get: wanted %v, got %v", want, got)
}
@@ -836,11 +836,11 @@
tc.put(t, ks+"a", "val-100")
tc.put(t, ks+"b", "val-101")
- // Retrieve the rest of the backlog until BacklogDone is returned.
+ // Retrieve the rest of the backlog until ErrBacklogDone is returned.
nUpdates := 1
for {
g, err := w.Get(ctx, event.BacklogOnly[StringAt]())
- if errors.Is(err, event.BacklogDone) {
+ if errors.Is(err, event.ErrBacklogDone) {
break
}
if err != nil {
diff --git a/metropolis/pkg/event/event.go b/metropolis/pkg/event/event.go
index e38c427..a8b3526 100644
--- a/metropolis/pkg/event/event.go
+++ b/metropolis/pkg/event/event.go
@@ -179,7 +179,7 @@
}
// BacklogOnly will prevent Get from blocking on waiting for more updates from
-// etcd, by instead returning BacklogDone whenever no more data is currently
+// etcd, by instead returning ErrBacklogDone whenever no more data is currently
// locally available. This is different however, from establishing that there
// are no more pending updates from the etcd cluster - the only way to ensure
// the local client is up to date is by performing Get calls without this option
@@ -187,7 +187,7 @@
//
// This mode of retrieval should only be used for the retrieval of the existing
// data in the etcd cluster on the initial creation of the Watcher (by
-// repeatedly calling Get until BacklogDone is returned), and shouldn't be set
+// repeatedly calling Get until ErrBacklogDone is returned), and shouldn't be set
// for any subsequent call. Any use of this option after that initial fetch is
// undefined behaviour that exposes the internals of the Get implementation, and
// must not be relied on. However, in the future, this behaviour might be
@@ -203,10 +203,10 @@
}
var (
- // BacklogDone is returned by Get when BacklogOnly is set and there is no more
+ // ErrBacklogDone is returned by Get when BacklogOnly is set and there is no more
// event data stored in the Watcher client, ie. when the initial cluster state
// of the requested key has been retrieved.
- BacklogDone = errors.New("no more backlogged data")
+ ErrBacklogDone = errors.New("no more backlogged data")
)
// Pipe a Value's initial state and subsequent updates to an already existing