diff --git a/libnetwork/datastore/datastore.go b/libnetwork/datastore/datastore.go index 52f66fd735..e15dd64ead 100644 --- a/libnetwork/datastore/datastore.go +++ b/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() diff --git a/libnetwork/datastore/datastore_test.go b/libnetwork/datastore/datastore_test.go index b2d12b6bef..6e227696ed 100644 --- a/libnetwork/datastore/datastore_test.go +++ b/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) { diff --git a/libnetwork/sandbox_store.go b/libnetwork/sandbox_store.go index a37f5635df..db94a28681 100644 --- a/libnetwork/sandbox_store.go +++ b/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 { diff --git a/libnetwork/store.go b/libnetwork/store.go index 68285e560d..63910b137d 100644 --- a/libnetwork/store.go +++ b/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 }