Skip to content

Commit

Permalink
removed unnecessary type
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavyHorst committed Aug 27, 2017
1 parent a4ee14f commit 5f990e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmd/remco/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type BackendConfigs struct {
}

// GetBackends returns a slice with all BackendConfigs for easy iteration.
func (c *BackendConfigs) GetBackends() template.BackendConnectors {
return template.BackendConnectors{
func (c *BackendConfigs) GetBackends() []template.BackendConnector {
return []template.BackendConnector{
c.Etcd,
c.File,
c.Env,
Expand Down
8 changes: 2 additions & 6 deletions pkg/template/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ type BackendConnector interface {
Connect() (Backend, error)
}

// BackendConnectors is a list of BackendConnectors.
// This is just a helper Type to simplify operations on many BackendConnectors.
type BackendConnectors []BackendConnector

// Backend is the representation of a template backend like etcd or consul
type Backend struct {
easykv.ReadWatcher
Expand All @@ -59,9 +55,9 @@ type Backend struct {
store *memkv.Store
}

// ConnectAll connects to all configured backends.
// connectAllBackends connects to all configured backends.
// This method blocks until a connection to every backend has been established or the context is canceled.
func (bc BackendConnectors) ConnectAll(ctx context.Context) ([]Backend, error) {
func connectAllBackends(ctx context.Context, bc []BackendConnector) ([]Backend, error) {
var backendList []Backend
for _, config := range bc {
retryloop:
Expand Down
6 changes: 3 additions & 3 deletions pkg/template/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ type ResourceConfig struct {

// Connectors is a list of BackendConnectors.
// The Resource will establish a connection to all of these.
Connectors BackendConnectors
Connectors []BackendConnector
}

// ErrEmptySrc is returned if an emty src template is passed to NewResource
var ErrEmptySrc = fmt.Errorf("empty src template")

// NewResourceFromResourceConfig creates a new resource from the given ResourceConfig.
func NewResourceFromResourceConfig(ctx context.Context, reapLock *sync.RWMutex, r ResourceConfig) (*Resource, error) {
backendList, err := r.Connectors.ConnectAll(ctx)
backendList, err := connectAllBackends(ctx, r.Connectors)
if err != nil {
return nil, errors.Wrap(err, "connectAll failed")
return nil, errors.Wrap(err, "connectAllBackends failed")
}

for _, p := range r.Template {
Expand Down

0 comments on commit 5f990e8

Please sign in to comment.