Просмотр исходного кода

Backends: Remove Run() from interface as it's not used

Tom Denham 8 лет назад
Родитель
Сommit
e14feb7f8e

+ 0 - 4
backend/alivpc/alivpc.go

@@ -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 {

+ 0 - 4
backend/alloc/alloc.go

@@ -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),

+ 0 - 4
backend/awsvpc/awsvpc.go

@@ -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"`
 }

+ 0 - 9
backend/common.go

@@ -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)
 }

+ 0 - 4
backend/gce/gce.go

@@ -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),

+ 0 - 4
backend/hostgw/hostgw.go

@@ -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,

+ 1 - 1
backend/manager.go

@@ -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.

+ 0 - 4
backend/udp/udp.go

@@ -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()
-}

+ 0 - 4
backend/vxlan/vxlan.go

@@ -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 {