diff --git a/libnetwork/datastore/datastore.go b/libnetwork/datastore/datastore.go index 52f66fd7357a2daf9a0dcfb56c4387b5fa1a2166..e15dd64ead2ec1a609a6030ce11f09967cdd5fb2 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 b2d12b6bef8ad60fa4f9cf2d12c004b5fe538101..6e227696edf860b4d3bab7a59afd837a29a63a59 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 a37f5635df904d33fe96a87e4834e8eb47c54bcd..db94a2868161d914c8ac37a7d37244dcc6fb58c1 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 68285e560da66faa0af187901a10a7acc620a476..63910b137d70cda28f9659bc11a997bc97797340 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 }