Explorar o código

libnetwork/config: rename ParseConfigOptions() to New()

This function effectively is a constructor, so rename it to better describe
it's functionality.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn %!s(int64=2) %!d(string=hai) anos
pai
achega
267108e113
Modificáronse 2 ficheiros con 4 adicións e 5 borrados
  1. 2 3
      libnetwork/config/config.go
  2. 2 2
      libnetwork/controller.go

+ 2 - 3
libnetwork/config/config.go

@@ -34,9 +34,8 @@ type Config struct {
 	PluginGetter           plugingetter.PluginGetter
 }
 
-// ParseConfigOptions parses the configuration options and returns
-// a reference to the corresponding Config structure
-func ParseConfigOptions(opts ...Option) *Config {
+// New creates a new Config and initializes it with the given Options.
+func New(opts ...Option) *Config {
 	cfg := &Config{
 		DriverCfg: make(map[string]interface{}),
 		Scopes:    make(map[string]*datastore.ScopeCfg),

+ 2 - 2
libnetwork/controller.go

@@ -186,7 +186,7 @@ type initializer struct {
 func New(cfgOptions ...config.Option) (NetworkController, error) {
 	c := &controller{
 		id:               stringid.GenerateRandomID(),
-		cfg:              config.ParseConfigOptions(cfgOptions...),
+		cfg:              config.New(cfgOptions...),
 		sandboxes:        sandboxTable{},
 		svcRecords:       make(map[string]svcInfo),
 		serviceBindings:  make(map[serviceKey]*service),
@@ -447,7 +447,7 @@ func (c *controller) ReloadConfiguration(cfgOptions ...config.Option) error {
 	// For now we accept the configuration reload only as a mean to provide a global store config after boot.
 	// Refuse the configuration if it alters an existing datastore client configuration.
 	update := false
-	cfg := config.ParseConfigOptions(cfgOptions...)
+	cfg := config.New(cfgOptions...)
 
 	for s := range c.cfg.Scopes {
 		if _, ok := cfg.Scopes[s]; !ok {