Skip to content

Commit

Permalink
Merge pull request kubernetes#629 from tomdee/remove-backend-run
Browse files Browse the repository at this point in the history
Backends: Remove Run() from interface as it's not used
  • Loading branch information
tomdee authored May 17, 2017
2 parents 008a583 + e14feb7 commit 4ee76f8
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 38 deletions.
4 changes: 0 additions & 4 deletions backend/alivpc/alivpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ func New(sm subnet.Manager, extIface *backend.ExternalInterface) (backend.Backen
return &be, nil
}

func (be *AliVpcBackend) Run(ctx context.Context) {
<-ctx.Done()
}

func (be *AliVpcBackend) RegisterNetwork(ctx context.Context, config *subnet.Config) (backend.Network, error) {
// 1. Parse our configuration
cfg := struct {
Expand Down
4 changes: 0 additions & 4 deletions backend/alloc/alloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ func New(sm subnet.Manager, extIface *backend.ExternalInterface) (backend.Backen
return &be, nil
}

func (_ *AllocBackend) Run(ctx context.Context) {
<-ctx.Done()
}

func (be *AllocBackend) RegisterNetwork(ctx context.Context, config *subnet.Config) (backend.Network, error) {
attrs := subnet.LeaseAttrs{
PublicIP: ip.FromIP(be.extIface.ExtAddr),
Expand Down
4 changes: 0 additions & 4 deletions backend/awsvpc/awsvpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ func New(sm subnet.Manager, extIface *backend.ExternalInterface) (backend.Backen
return &be, nil
}

func (be *AwsVpcBackend) Run(ctx context.Context) {
<-ctx.Done()
}

type backendConfig struct {
RouteTableID interface{} `json:"RouteTableID"`
}
Expand Down
9 changes: 0 additions & 9 deletions backend/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,7 @@ type ExternalInterface struct {
// function receives static network interface information (like internal and
// external IP addresses, MTU, etc) which it should cache for later use if
// needed.
//
// To implement a singleton backend which manages multiple networks, the
// New() function should create the singleton backend object once, and return
// that object on on further calls to New(). The backend is guaranteed that
// the arguments passed via New() will not change across invocations. Also,
// since multiple RegisterNetwork() and Run() calls may be in-flight at any
// given time for a singleton backend, it must protect these calls with a mutex.
type Backend interface {
// Called first to start the necessary event loops and such
Run(ctx context.Context)
// Called when the backend should create or begin managing a new network
RegisterNetwork(ctx context.Context, config *subnet.Config) (Network, error)
}
Expand Down
4 changes: 0 additions & 4 deletions backend/gce/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ func (g *GCEBackend) ensureAPI() error {
return err
}

func (g *GCEBackend) Run(ctx context.Context) {
<-ctx.Done()
}

func (g *GCEBackend) RegisterNetwork(ctx context.Context, config *subnet.Config) (backend.Network, error) {
attrs := subnet.LeaseAttrs{
PublicIP: ip.FromIP(g.extIface.ExtAddr),
Expand Down
4 changes: 0 additions & 4 deletions backend/hostgw/hostgw.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ func New(sm subnet.Manager, extIface *backend.ExternalInterface) (backend.Backen
return be, nil
}

func (_ *HostgwBackend) Run(ctx context.Context) {
<-ctx.Done()
}

func (be *HostgwBackend) RegisterNetwork(ctx context.Context, config *subnet.Config) (backend.Network, error) {
n := &network{
extIface: be.extIface,
Expand Down
2 changes: 1 addition & 1 deletion backend/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (bm *manager) GetBackend(backendType string) (Backend, error) {

bm.wg.Add(1)
go func() {
be.Run(bm.ctx)
<-bm.ctx.Done()

// TODO(eyakubovich): this obviosly introduces a race.
// GetBackend() could get called while we are here.
Expand Down
4 changes: 0 additions & 4 deletions backend/udp/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,3 @@ func (be *UdpBackend) RegisterNetwork(ctx context.Context, config *subnet.Config

return newNetwork(be.sm, be.extIface, cfg.Port, tunNet, l)
}

func (_ *UdpBackend) Run(ctx context.Context) {
<-ctx.Done()
}
4 changes: 0 additions & 4 deletions backend/vxlan/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ func newSubnetAttrs(publicIP net.IP, mac net.HardwareAddr) (*subnet.LeaseAttrs,
}, nil
}

func (be *VXLANBackend) Run(ctx context.Context) {
<-ctx.Done()
}

func (be *VXLANBackend) RegisterNetwork(ctx context.Context, config *subnet.Config) (backend.Network, error) {
// Parse our configuration
cfg := struct {
Expand Down

0 comments on commit 4ee76f8

Please sign in to comment.