fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
(cherry picked from commit 4e959ef2f7
)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
5aef7cc12d
commit
4cd455a8d9
17 changed files with 18 additions and 18 deletions
|
@ -378,7 +378,7 @@ The rules:
|
||||||
5. Document _all_ declarations and methods, even private ones. Declare
|
5. Document _all_ declarations and methods, even private ones. Declare
|
||||||
expectations, caveats and anything else that may be important. If a type
|
expectations, caveats and anything else that may be important. If a type
|
||||||
gets exported, having the comments already there will ensure it's ready.
|
gets exported, having the comments already there will ensure it's ready.
|
||||||
6. Variable name length should be proportional to it's context and no longer.
|
6. Variable name length should be proportional to its context and no longer.
|
||||||
`noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`.
|
`noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`.
|
||||||
In practice, short methods will have short variable names and globals will
|
In practice, short methods will have short variable names and globals will
|
||||||
have longer names.
|
have longer names.
|
||||||
|
@ -386,7 +386,7 @@ The rules:
|
||||||
and re-examine why you need a compound name. If you still think you need a
|
and re-examine why you need a compound name. If you still think you need a
|
||||||
compound name, lose the underscore.
|
compound name, lose the underscore.
|
||||||
8. No utils or helpers packages. If a function is not general enough to
|
8. No utils or helpers packages. If a function is not general enough to
|
||||||
warrant it's own package, it has not been written generally enough to be a
|
warrant its own package, it has not been written generally enough to be a
|
||||||
part of a util package. Just leave it unexported and well-documented.
|
part of a util package. Just leave it unexported and well-documented.
|
||||||
9. All tests should run with `go test` and outside tooling should not be
|
9. All tests should run with `go test` and outside tooling should not be
|
||||||
required. No, we don't need another unit testing framework. Assertion
|
required. No, we don't need another unit testing framework. Assertion
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
clientapi "github.com/docker/engine-api/client"
|
clientapi "github.com/docker/engine-api/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// getExitCode perform an inspect on the container. It returns
|
// getExitCode performs an inspect on the container. It returns
|
||||||
// the running state and the exit code.
|
// the running state and the exit code.
|
||||||
func getExitCode(dockerCli *client.DockerCli, ctx context.Context, containerID string) (bool, int, error) {
|
func getExitCode(dockerCli *client.DockerCli, ctx context.Context, containerID string) (bool, int, error) {
|
||||||
c, err := dockerCli.Client().ContainerInspect(ctx, containerID)
|
c, err := dockerCli.Client().ContainerInspect(ctx, containerID)
|
||||||
|
|
|
@ -48,7 +48,7 @@ int main(int argc, char **argv)
|
||||||
child_stack = stack + STACK_SIZE; /* Assume stack grows downward */
|
child_stack = stack + STACK_SIZE; /* Assume stack grows downward */
|
||||||
|
|
||||||
// the result of this call is that our child_exec will be run in another
|
// the result of this call is that our child_exec will be run in another
|
||||||
// process returning it's pid
|
// process returning its pid
|
||||||
pid_t pid = clone(child_exec, child_stack, clone_flags, &args);
|
pid_t pid = clone(child_exec, child_stack, clone_flags, &args);
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
fprintf(stderr, "clone failed: %s\n", strerror(errno));
|
fprintf(stderr, "clone failed: %s\n", strerror(errno));
|
||||||
|
|
|
@ -48,7 +48,7 @@ int main(int argc, char **argv)
|
||||||
child_stack = stack + STACK_SIZE; /* Assume stack grows downward */
|
child_stack = stack + STACK_SIZE; /* Assume stack grows downward */
|
||||||
|
|
||||||
// the result of this call is that our child_exec will be run in another
|
// the result of this call is that our child_exec will be run in another
|
||||||
// process returning it's pid
|
// process returning its pid
|
||||||
pid_t pid = clone(child_exec, child_stack, clone_flags, &args);
|
pid_t pid = clone(child_exec, child_stack, clone_flags, &args);
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
fprintf(stderr, "clone failed: %s\n", strerror(errno));
|
fprintf(stderr, "clone failed: %s\n", strerror(errno));
|
||||||
|
|
|
@ -105,7 +105,7 @@ func TestGetContainer(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if container, _ := daemon.GetContainer("d22d69a2b896"); container != c5 {
|
if container, _ := daemon.GetContainer("d22d69a2b896"); container != c5 {
|
||||||
t.Fatal("Should match a container where the provided prefix is an exact match to the it's name, and is also a prefix for it's ID")
|
t.Fatal("Should match a container where the provided prefix is an exact match to the its name, and is also a prefix for its ID")
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := daemon.GetContainer("3cdbd1"); err == nil {
|
if _, err := daemon.GetContainer("3cdbd1"); err == nil {
|
||||||
|
|
|
@ -34,7 +34,7 @@ func TestContainerDoubleDelete(t *testing.T) {
|
||||||
// Mark the container as having a delete in progress
|
// Mark the container as having a delete in progress
|
||||||
container.SetRemovalInProgress()
|
container.SetRemovalInProgress()
|
||||||
|
|
||||||
// Try to remove the container when it's start is removalInProgress.
|
// Try to remove the container when its start is removalInProgress.
|
||||||
// It should ignore the container and not return an error.
|
// It should ignore the container and not return an error.
|
||||||
if err := daemon.ContainerRm(container.ID, &types.ContainerRmConfig{ForceRemove: true}); err != nil {
|
if err := daemon.ContainerRm(container.ID, &types.ContainerRmConfig{ForceRemove: true}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
@ -305,7 +305,7 @@ func (a *Driver) Remove(id string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the rootfs path for the id.
|
// Get returns the rootfs path for the id.
|
||||||
// This will mount the dir at it's given path
|
// This will mount the dir at its given path
|
||||||
func (a *Driver) Get(id, mountLabel string) (string, error) {
|
func (a *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
parents, err := a.getParentLayerPaths(id)
|
parents, err := a.getParentLayerPaths(id)
|
||||||
if err != nil && !os.IsNotExist(err) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
|
|
|
@ -218,7 +218,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
return hcsshim.DestroyLayer(d.info, rID)
|
return hcsshim.DestroyLayer(d.info, rID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the rootfs path for the id. This will mount the dir at it's given path.
|
// Get returns the rootfs path for the id. This will mount the dir at its given path.
|
||||||
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, mountLabel)
|
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, mountLabel)
|
||||||
var dir string
|
var dir string
|
||||||
|
|
|
@ -75,7 +75,7 @@ func (daemon *Daemon) killWithSignal(container *container.Container, sig int) er
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the container is currently restarting we do not need to send the signal
|
// if the container is currently restarting we do not need to send the signal
|
||||||
// to the process. Telling the monitor that it should exit on it's next event
|
// to the process. Telling the monitor that it should exit on its next event
|
||||||
// loop is enough
|
// loop is enough
|
||||||
if container.Restarting {
|
if container.Restarting {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -90,7 +90,7 @@ Docker image comprising five layers.
|
||||||
Digest: sha256:46fb5d001b88ad904c5c732b086b596b92cfb4a4840a3abd0e35dbb6870585e4
|
Digest: sha256:46fb5d001b88ad904c5c732b086b596b92cfb4a4840a3abd0e35dbb6870585e4
|
||||||
Status: Downloaded newer image for ubuntu:latest
|
Status: Downloaded newer image for ubuntu:latest
|
||||||
|
|
||||||
Each image layer has it's own directory under `/var/lib/docker/overlay/`. This
|
Each image layer has its own directory under `/var/lib/docker/overlay/`. This
|
||||||
is where the contents of each image layer are stored.
|
is where the contents of each image layer are stored.
|
||||||
|
|
||||||
The output of the command below shows the five directories that store the
|
The output of the command below shows the five directories that store the
|
||||||
|
|
|
@ -223,7 +223,7 @@ docker exec -it cid3 /bin/sh
|
||||||
|
|
||||||
VLANs (Virtual Local Area Networks) have long been a primary means of virtualizing data center networks and are still in virtually all existing networks today. VLANs work by tagging a Layer-2 isolation domain with a 12-bit identifier ranging from 1-4094 that is inserted into a packet header that enables a logical grouping of a single or multiple subnets of both IPv4 and IPv6. It is very common for network operators to separate traffic using VLANs based on a subnet(s) function or security profile such as `web`, `db` or any other isolation needs.
|
VLANs (Virtual Local Area Networks) have long been a primary means of virtualizing data center networks and are still in virtually all existing networks today. VLANs work by tagging a Layer-2 isolation domain with a 12-bit identifier ranging from 1-4094 that is inserted into a packet header that enables a logical grouping of a single or multiple subnets of both IPv4 and IPv6. It is very common for network operators to separate traffic using VLANs based on a subnet(s) function or security profile such as `web`, `db` or any other isolation needs.
|
||||||
|
|
||||||
It is very common to have a compute host requirement of running multiple virtual networks concurrently on a host. Linux networking has long supported VLAN tagging, also known by it's standard 802.1q, for maintaining datapath isolation between networks. The Ethernet link connected to a Docker host can be configured to support the 802.1q VLAN IDs, by creating Linux sub-interfaces, each one dedicated to a unique VLAN ID.
|
It is very common to have a compute host requirement of running multiple virtual networks concurrently on a host. Linux networking has long supported VLAN tagging, also known by its standard 802.1q, for maintaining datapath isolation between networks. The Ethernet link connected to a Docker host can be configured to support the 802.1q VLAN IDs, by creating Linux sub-interfaces, each one dedicated to a unique VLAN ID.
|
||||||
|
|
||||||
![Simple Ipvlan L2 Mode Example](images/multi_tenant_8021q_vlans.png)
|
![Simple Ipvlan L2 Mode Example](images/multi_tenant_8021q_vlans.png)
|
||||||
|
|
||||||
|
|
|
@ -4083,7 +4083,7 @@ func (s *DockerSuite) TestRunNonExistingCmd(c *check.C) {
|
||||||
|
|
||||||
// TestCmdCannotBeInvoked checks that 'docker run busybox /etc' exits with 126, or
|
// TestCmdCannotBeInvoked checks that 'docker run busybox /etc' exits with 126, or
|
||||||
// 127 on Windows. The difference is that in Windows, the container must be started
|
// 127 on Windows. The difference is that in Windows, the container must be started
|
||||||
// as that's when the check is made (and yes, by it's design...)
|
// as that's when the check is made (and yes, by its design...)
|
||||||
func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) {
|
func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) {
|
||||||
expected := 126
|
expected := 126
|
||||||
if daemonPlatform == "windows" {
|
if daemonPlatform == "windows" {
|
||||||
|
|
|
@ -128,7 +128,7 @@ func (t *testRegistryV2) Close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *testRegistryV2) getBlobFilename(blobDigest digest.Digest) string {
|
func (t *testRegistryV2) getBlobFilename(blobDigest digest.Digest) string {
|
||||||
// Split the digest into it's algorithm and hex components.
|
// Split the digest into its algorithm and hex components.
|
||||||
dgstAlg, dgstHex := blobDigest.Algorithm(), blobDigest.Hex()
|
dgstAlg, dgstHex := blobDigest.Algorithm(), blobDigest.Hex()
|
||||||
|
|
||||||
// The path to the target blob data looks something like:
|
// The path to the target blob data looks something like:
|
||||||
|
|
|
@ -103,7 +103,7 @@ func TarResourceRebase(sourcePath, rebaseName string) (content Archive, err erro
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Separate the source path between it's directory and
|
// Separate the source path between its directory and
|
||||||
// the entry in that directory which we are archiving.
|
// the entry in that directory which we are archiving.
|
||||||
sourceDir, sourceBase := SplitPathDirEntry(sourcePath)
|
sourceDir, sourceBase := SplitPathDirEntry(sourcePath)
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ func (ctx *Ctx) AuthZResponse(rm ResponseModifier, r *http.Request) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// drainBody dump the body (if it's length is less than 1MB) without modifying the request state
|
// drainBody dump the body (if its length is less than 1MB) without modifying the request state
|
||||||
func drainBody(body io.ReadCloser) ([]byte, io.ReadCloser, error) {
|
func drainBody(body io.ReadCloser) ([]byte, io.ReadCloser, error) {
|
||||||
bufReader := bufio.NewReaderSize(body, maxBodySize)
|
bufReader := bufio.NewReaderSize(body, maxBodySize)
|
||||||
newBody := ioutils.NewReadCloserWrapper(bufReader, func() error { return body.Close() })
|
newBody := ioutils.NewReadCloserWrapper(bufReader, func() error { return body.Close() })
|
||||||
|
|
|
@ -31,7 +31,7 @@ func CleanPatterns(patterns []string) ([]string, [][]string, bool, error) {
|
||||||
// Loop over exclusion patterns and:
|
// Loop over exclusion patterns and:
|
||||||
// 1. Clean them up.
|
// 1. Clean them up.
|
||||||
// 2. Indicate whether we are dealing with any exception rules.
|
// 2. Indicate whether we are dealing with any exception rules.
|
||||||
// 3. Error if we see a single exclusion marker on it's own (!).
|
// 3. Error if we see a single exclusion marker on its own (!).
|
||||||
cleanedPatterns := []string{}
|
cleanedPatterns := []string{}
|
||||||
patternDirs := [][]string{}
|
patternDirs := [][]string{}
|
||||||
exceptions := false
|
exceptions := false
|
||||||
|
|
|
@ -89,7 +89,7 @@ func (a *volumeDriverAdapter) getCapabilities() volume.Capability {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// `GetCapabilities` is a not a required endpoint.
|
// `GetCapabilities` is a not a required endpoint.
|
||||||
// On error assume it's a local-only driver
|
// On error assume it's a local-only driver
|
||||||
logrus.Warnf("Volume driver %s returned an error while trying to query it's capabilities, using default capabilties: %v", a.name, err)
|
logrus.Warnf("Volume driver %s returned an error while trying to query its capabilities, using default capabilties: %v", a.name, err)
|
||||||
return volume.Capability{Scope: volume.LocalScope}
|
return volume.Capability{Scope: volume.LocalScope}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue