Преглед изворни кода

Move names to a more appropriate package.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Daniel Nephin пре 8 година
родитељ
комит
22b246417f
4 измењених фајлова са 10 додато и 10 уклоњено
  1. 3 3
      daemon/checkpoint.go
  2. 3 3
      daemon/names.go
  3. 1 1
      daemon/names/names.go
  4. 3 3
      volume/local/local.go

+ 3 - 3
daemon/checkpoint.go

@@ -7,13 +7,13 @@ import (
 	"os"
 	"os"
 	"path/filepath"
 	"path/filepath"
 
 
-	"github.com/docker/docker/api"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/daemon/names"
 )
 )
 
 
 var (
 var (
-	validCheckpointNameChars   = api.RestrictedNameChars
-	validCheckpointNamePattern = api.RestrictedNamePattern
+	validCheckpointNameChars   = names.RestrictedNameChars
+	validCheckpointNamePattern = names.RestrictedNamePattern
 )
 )
 
 
 // getCheckpointDir verifies checkpoint directory for create,remove, list options and checks if checkpoint already exists
 // getCheckpointDir verifies checkpoint directory for create,remove, list options and checks if checkpoint already exists

+ 3 - 3
daemon/names.go

@@ -4,8 +4,8 @@ import (
 	"fmt"
 	"fmt"
 	"strings"
 	"strings"
 
 
-	"github.com/docker/docker/api"
 	"github.com/docker/docker/container"
 	"github.com/docker/docker/container"
+	"github.com/docker/docker/daemon/names"
 	"github.com/docker/docker/pkg/namesgenerator"
 	"github.com/docker/docker/pkg/namesgenerator"
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
@@ -13,8 +13,8 @@ import (
 )
 )
 
 
 var (
 var (
-	validContainerNameChars   = api.RestrictedNameChars
-	validContainerNamePattern = api.RestrictedNamePattern
+	validContainerNameChars   = names.RestrictedNameChars
+	validContainerNamePattern = names.RestrictedNamePattern
 )
 )
 
 
 func (daemon *Daemon) registerName(container *container.Container) error {
 func (daemon *Daemon) registerName(container *container.Container) error {

+ 1 - 1
api/names.go → daemon/names/names.go

@@ -1,4 +1,4 @@
-package api
+package names
 
 
 import "regexp"
 import "regexp"
 
 

+ 3 - 3
volume/local/local.go

@@ -13,7 +13,7 @@ import (
 	"strings"
 	"strings"
 	"sync"
 	"sync"
 
 
-	"github.com/docker/docker/api"
+	"github.com/docker/docker/daemon/names"
 	"github.com/docker/docker/pkg/idtools"
 	"github.com/docker/docker/pkg/idtools"
 	"github.com/docker/docker/pkg/mount"
 	"github.com/docker/docker/pkg/mount"
 	"github.com/docker/docker/volume"
 	"github.com/docker/docker/volume"
@@ -35,7 +35,7 @@ var (
 	// volumeNameRegex ensures the name assigned for the volume is valid.
 	// volumeNameRegex ensures the name assigned for the volume is valid.
 	// This name is used to create the bind directory, so we need to avoid characters that
 	// This name is used to create the bind directory, so we need to avoid characters that
 	// would make the path to escape the root directory.
 	// would make the path to escape the root directory.
-	volumeNameRegex = api.RestrictedNamePattern
+	volumeNameRegex = names.RestrictedNamePattern
 )
 )
 
 
 type activeMount struct {
 type activeMount struct {
@@ -298,7 +298,7 @@ func (r *Root) validateName(name string) error {
 		return validationError("volume name is too short, names should be at least two alphanumeric characters")
 		return validationError("volume name is too short, names should be at least two alphanumeric characters")
 	}
 	}
 	if !volumeNameRegex.MatchString(name) {
 	if !volumeNameRegex.MatchString(name) {
-		return validationError(fmt.Sprintf("%q includes invalid characters for a local volume name, only %q are allowed. If you intended to pass a host directory, use absolute path", name, api.RestrictedNameChars))
+		return validationError(fmt.Sprintf("%q includes invalid characters for a local volume name, only %q are allowed. If you intended to pass a host directory, use absolute path", name, names.RestrictedNameChars))
 	}
 	}
 	return nil
 	return nil
 }
 }