Vendor docker/distribution to 7dc8d4a26b689bd4892f2f2322dbce0b7119d686

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2015-07-30 21:14:39 -04:00
parent ffeec2bdd1
commit 0cce1fb37f
6 changed files with 18 additions and 14 deletions

View file

@ -36,7 +36,7 @@ clone git github.com/coreos/go-etcd v2.0.0
clone git github.com/hashicorp/consul v0.5.2
# get graph and distribution packages
clone git github.com/docker/distribution e83345626608aa943d5c8a027fddcf54814d9545
clone git github.com/docker/distribution 7dc8d4a26b689bd4892f2f2322dbce0b7119d686
clone git github.com/vbatts/tar-split v0.9.4
clone git github.com/docker/notary 77bced079e83d80f40c1f0a544b1a8a3b97fb052

View file

@ -10,6 +10,7 @@ ENV DOCKER_BUILDTAGS include_rados
WORKDIR $DISTRIBUTION_DIR
COPY . $DISTRIBUTION_DIR
COPY cmd/registry/config-dev.yml $DISTRIBUTION_DIR/cmd/registry/config.yml
RUN make PREFIX=/go clean binaries
VOLUME ["/var/lib/registry"]

View file

@ -1,6 +1,8 @@
package context
import (
"sync"
"github.com/docker/distribution/uuid"
"golang.org/x/net/context"
)
@ -14,11 +16,19 @@ type Context interface {
// provided as the main background context.
type instanceContext struct {
Context
id string // id of context, logged as "instance.id"
id string // id of context, logged as "instance.id"
once sync.Once // once protect generation of the id
}
func (ic *instanceContext) Value(key interface{}) interface{} {
if key == "instance.id" {
ic.once.Do(func() {
// We want to lazy initialize the UUID such that we don't
// call a random generator from the package initialization
// code. For various reasons random could not be available
// https://github.com/docker/distribution/issues/782
ic.id = uuid.Generate().String()
})
return ic.id
}
@ -27,7 +37,6 @@ func (ic *instanceContext) Value(key interface{}) interface{} {
var background = &instanceContext{
Context: context.Background(),
id: uuid.Generate().String(),
}
// Background returns a non-nil, empty Context. The background context

View file

@ -3,8 +3,6 @@ package context
import (
"fmt"
"github.com/docker/distribution/uuid"
"github.com/Sirupsen/logrus"
)
@ -101,8 +99,3 @@ func getLogrusLogger(ctx Context, keys ...interface{}) *logrus.Entry {
return logger.WithFields(fields)
}
func init() {
// inject a logger into the uuid library.
uuid.Loggerf = GetLogger(Background()).Warnf
}

View file

@ -607,7 +607,7 @@ var routeDescriptors = []RouteDescriptor{
Successes: []ResponseDescriptor{
{
Description: "The manifest has been accepted by the registry and is stored under the specified `name` and `tag`.",
StatusCode: http.StatusAccepted,
StatusCode: http.StatusCreated,
Headers: []ParameterDescriptor{
{
Name: "Location",

View file

@ -8,7 +8,6 @@ import (
"crypto/rand"
"fmt"
"io"
"log"
"os"
"syscall"
"time"
@ -30,7 +29,7 @@ var (
// Loggerf can be used to override the default logging destination. Such
// log messages in this library should be logged at warning or higher.
Loggerf = log.Printf
Loggerf = func(format string, args ...interface{}) {}
)
// UUID represents a UUID value. UUIDs can be compared and set to other values
@ -49,6 +48,7 @@ func Generate() (u UUID) {
var (
totalBackoff time.Duration
count int
retries int
)
@ -60,9 +60,10 @@ func Generate() (u UUID) {
time.Sleep(b)
totalBackoff += b
_, err := io.ReadFull(rand.Reader, u[:])
n, err := io.ReadFull(rand.Reader, u[count:])
if err != nil {
if retryOnError(err) && retries < maxretries {
count += n
retries++
Loggerf("error generating version 4 uuid, retrying: %v", err)
continue