Bläddra i källkod

libnetwork/datastore: drop (*Store).Scope() method

It unconditionally returned scope.Local.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Cory Snider 1 år sedan
förälder
incheckning
4f4a897dda

+ 1 - 8
libnetwork/datastore/datastore.go

@@ -9,7 +9,6 @@ import (
 	"github.com/docker/docker/libnetwork/discoverapi"
 	store "github.com/docker/docker/libnetwork/internal/kvstore"
 	"github.com/docker/docker/libnetwork/internal/kvstore/boltdb"
-	"github.com/docker/docker/libnetwork/scope"
 	"github.com/docker/docker/libnetwork/types"
 )
 
@@ -21,7 +20,6 @@ var (
 
 type Store struct {
 	mu    sync.Mutex
-	scope string
 	store store.Store
 	cache *cache
 }
@@ -139,7 +137,7 @@ func newClient(kv string, addr string, config *store.Config) (*Store, error) {
 		return nil, err
 	}
 
-	return &Store{scope: scope.Local, store: s, cache: newCache(s)}, nil
+	return &Store{store: s, cache: newCache(s)}, nil
 }
 
 // New creates a new Store instance.
@@ -182,11 +180,6 @@ func (ds *Store) Close() {
 	ds.store.Close()
 }
 
-// Scope returns the scope of the store.
-func (ds *Store) Scope() string {
-	return ds.scope
-}
-
 // PutObjectAtomic provides an atomic add and update operation for a Record.
 func (ds *Store) PutObjectAtomic(kvObject KVObject) error {
 	ds.mu.Lock()

+ 1 - 1
libnetwork/datastore/datastore_test.go

@@ -15,7 +15,7 @@ const dummyKey = "dummy"
 // NewTestDataStore can be used by other Tests in order to use custom datastore
 func NewTestDataStore() *Store {
 	s := NewMockStore()
-	return &Store{scope: scope.Local, store: s, cache: newCache(s)}
+	return &Store{store: s, cache: newCache(s)}
 }
 
 func TestKey(t *testing.T) {

+ 1 - 1
libnetwork/sandbox_store.go

@@ -184,7 +184,7 @@ func (c *Controller) sandboxCleanup(activeSandboxes map[string]interface{}) erro
 			// It's normal for no sandboxes to be found. Just bail out.
 			return nil
 		}
-		return fmt.Errorf("failed to get sandboxes for scope %s: %v", store.Scope(), err)
+		return fmt.Errorf("failed to get sandboxes: %v", err)
 	}
 
 	for _, s := range sandboxStates {

+ 4 - 4
libnetwork/store.go

@@ -70,7 +70,7 @@ func (c *Controller) getNetworks() ([]*Network, error) {
 
 		n.epCnt = ec
 		if n.scope == "" {
-			n.scope = store.Scope()
+			n.scope = scope.Local
 		}
 		nl = append(nl, n)
 	}
@@ -107,7 +107,7 @@ func (c *Controller) getNetworksFromStore() []*Network { // FIXME: unify with c.
 			n.epCnt = ec
 		}
 		if n.scope == "" {
-			n.scope = store.Scope()
+			n.scope = scope.Local
 		}
 		n.mu.Unlock()
 		nl = append(nl, n)
@@ -134,8 +134,8 @@ func (n *Network) getEndpointsFromStore() ([]*Endpoint, error) {
 	kvol, err := store.List(datastore.Key(tmp.KeyPrefix()...), &Endpoint{network: n})
 	if err != nil {
 		if err != datastore.ErrKeyNotFound {
-			return nil, fmt.Errorf("failed to get endpoints for network %s scope %s: %w",
-				n.Name(), store.Scope(), err)
+			return nil, fmt.Errorf("failed to get endpoints for network %s: %w",
+				n.Name(), err)
 		}
 		return nil, nil
 	}