浏览代码

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 2 年之前
父节点
当前提交
267108e113
共有 2 个文件被更改,包括 4 次插入5 次删除
  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
 	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{
 	cfg := &Config{
 		DriverCfg: make(map[string]interface{}),
 		DriverCfg: make(map[string]interface{}),
 		Scopes:    make(map[string]*datastore.ScopeCfg),
 		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) {
 func New(cfgOptions ...config.Option) (NetworkController, error) {
 	c := &controller{
 	c := &controller{
 		id:               stringid.GenerateRandomID(),
 		id:               stringid.GenerateRandomID(),
-		cfg:              config.ParseConfigOptions(cfgOptions...),
+		cfg:              config.New(cfgOptions...),
 		sandboxes:        sandboxTable{},
 		sandboxes:        sandboxTable{},
 		svcRecords:       make(map[string]svcInfo),
 		svcRecords:       make(map[string]svcInfo),
 		serviceBindings:  make(map[serviceKey]*service),
 		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.
 	// 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.
 	// Refuse the configuration if it alters an existing datastore client configuration.
 	update := false
 	update := false
-	cfg := config.ParseConfigOptions(cfgOptions...)
+	cfg := config.New(cfgOptions...)
 
 
 	for s := range c.cfg.Scopes {
 	for s := range c.cfg.Scopes {
 		if _, ok := cfg.Scopes[s]; !ok {
 		if _, ok := cfg.Scopes[s]; !ok {