mirror of https://github.com/k3s-io/k3s
storage interface: remove Backends()
parent
e19ea41a5e
commit
7f28eda9be
|
@ -243,11 +243,6 @@ func (c *Cacher) startCaching(stopChannel <-chan struct{}) {
|
|||
}
|
||||
}
|
||||
|
||||
// Implements storage.Interface.
|
||||
func (c *Cacher) Backends(ctx context.Context) []string {
|
||||
return c.storage.Backends(ctx)
|
||||
}
|
||||
|
||||
// Implements storage.Interface.
|
||||
func (c *Cacher) Versioner() Versioner {
|
||||
return c.storage.Versioner()
|
||||
|
|
|
@ -90,23 +90,6 @@ func (h *etcdHelper) Codec() runtime.Codec {
|
|||
return h.codec
|
||||
}
|
||||
|
||||
// Implements storage.Interface.
|
||||
func (h *etcdHelper) Backends(ctx context.Context) []string {
|
||||
if ctx == nil {
|
||||
glog.Errorf("Context is nil")
|
||||
}
|
||||
members, err := h.etcdMembersAPI.List(ctx)
|
||||
if err != nil {
|
||||
glog.Errorf("Error obtaining etcd members list: %q", err)
|
||||
return nil
|
||||
}
|
||||
mlist := []string{}
|
||||
for _, member := range members {
|
||||
mlist = append(mlist, member.ClientURLs...)
|
||||
}
|
||||
return mlist
|
||||
}
|
||||
|
||||
// Implements storage.Interface.
|
||||
func (h *etcdHelper) Versioner() storage.Versioner {
|
||||
return h.versioner
|
||||
|
|
|
@ -73,20 +73,6 @@ func newStore(c *clientv3.Client, codec runtime.Codec, prefix string) *store {
|
|||
}
|
||||
}
|
||||
|
||||
// Backends implements storage.Interface.Backends.
|
||||
func (s *store) Backends(ctx context.Context) []string {
|
||||
resp, err := s.client.MemberList(ctx)
|
||||
if err != nil {
|
||||
glog.Errorf("Error obtaining etcd members list: %q", err)
|
||||
return nil
|
||||
}
|
||||
var mlist []string
|
||||
for _, member := range resp.Members {
|
||||
mlist = append(mlist, member.ClientURLs...)
|
||||
}
|
||||
return mlist
|
||||
}
|
||||
|
||||
// Codec implements storage.Interface.Codec.
|
||||
func (s *store) Codec() runtime.Codec {
|
||||
return s.codec
|
||||
|
|
|
@ -112,11 +112,6 @@ func NewUIDPreconditions(uid string) *Preconditions {
|
|||
// Interface offers a common interface for object marshaling/unmarshaling operations and
|
||||
// hides all the storage-related operations behind it.
|
||||
type Interface interface {
|
||||
// Returns list of servers addresses of the underyling database.
|
||||
// TODO: This method is used only in a single place. Consider refactoring and getting rid
|
||||
// of this method from the interface.
|
||||
Backends(ctx context.Context) []string
|
||||
|
||||
// Returns Versioner associated with this interface.
|
||||
Versioner() Versioner
|
||||
|
||||
|
|
Loading…
Reference in New Issue