pkg/storage: make Watch returns receive only channel (#1211)

So the caller can not write to the channel, and insist that the channel
is for notifying only.
This commit is contained in:
Cuong Manh Le 2020-08-05 23:49:28 +07:00 committed by GitHub
parent f4cb5ea6e9
commit ec52412d79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ type mockBackend struct {
list func(ctx context.Context, sinceVersion string) ([]*databroker.Record, error)
delete func(ctx context.Context, id string) error
clearDeleted func(ctx context.Context, cutoff time.Time)
watch func(ctx context.Context) chan struct{}
watch func(ctx context.Context) <-chan struct{}
}
func (m *mockBackend) Put(ctx context.Context, id string, data *anypb.Any) error {
@ -42,6 +42,6 @@ func (m *mockBackend) ClearDeleted(ctx context.Context, cutoff time.Time) {
m.clearDeleted(ctx, cutoff)
}
func (m *mockBackend) Watch(ctx context.Context) chan struct{} {
func (m *mockBackend) Watch(ctx context.Context) <-chan struct{} {
return m.watch(ctx)
}