Skip to content

Commit

Permalink
Merge pull request #70 from grafana/kill-closer
Browse files Browse the repository at this point in the history
Remove the closer package since it's trivial
  • Loading branch information
56quarters authored Nov 3, 2021
2 parents 1b5b43d + b2814a7 commit 72fa100
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
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

0 comments on commit 72fa100

Please sign in to comment.