Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the closer package since it's trivial #70

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Changelog

* [CHANGE] Closer: remove the closer package since it's trivial to just copy/paste. #70
* [CHANGE] Memberlist: allow specifying address and port advertised to the memberlist cluster members by setting the following configuration: #37
* `-memberlist.advertise_addr`
* `-memberlist.advertise_port`
Expand Down
9 changes: 0 additions & 9 deletions closer/closer.go

This file was deleted.

2 changes: 1 addition & 1 deletion kv/consul/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type kv interface {
Put(p *consul.KVPair, q *consul.WriteOptions) (*consul.WriteMeta, error)
}

// Client is a KV.Client for Consul.
// Client is a kv.Client for Consul.
type Client struct {
kv
codec codec.Codec
Expand Down
9 changes: 7 additions & 2 deletions kv/consul/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
consul "github.com/hashicorp/consul/api"
"github.com/prometheus/client_golang/prometheus"

"github.com/grafana/dskit/closer"
"github.com/grafana/dskit/kv/codec"
)

Expand Down Expand Up @@ -48,7 +47,7 @@ func NewInMemoryClientWithConfig(codec codec.Codec, cfg Config, logger log.Logge
// Create a closer function used to close the main loop and wait until it's done.
// We need to wait until done, otherwise the goroutine leak finder used in tests
// may still report it as leaked.
closer := closer.Func(func() error {
closer := closerFunc(func() error {
close(m.close)
m.closeWG.Wait()
return nil
Expand All @@ -67,6 +66,12 @@ func NewInMemoryClientWithConfig(codec codec.Codec, cfg Config, logger log.Logge
}, closer
}

type closerFunc func() error

func (c closerFunc) Close() error {
return c()
}

func copyKVPair(in *consul.KVPair) *consul.KVPair {
out := *in
out.Value = make([]byte, len(in.Value))
Expand Down
2 changes: 1 addition & 1 deletion kv/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Clientv3Facade interface {
clientv3.Watcher
}

// Client implements ring.KVClient for etcd.
// Client implements kv.Client for etcd.
type Client struct {
cfg Config
codec codec.Codec
Expand Down