summaryrefslogtreecommitdiff
path: root/vendor/github.com/docker
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-09-08 15:32:44 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-09-09 11:58:20 +0200
commiteb28a1c08469d56494006d0f2c64933ab7078d01 (patch)
treedbacf86cf194955f34f09ec56d2df284321e2ae7 /vendor/github.com/docker
parent7e2f002b0751c2c24e9c243495cbc313d0c3c103 (diff)
downloadpodman-eb28a1c08469d56494006d0f2c64933ab7078d01.tar.gz
podman-eb28a1c08469d56494006d0f2c64933ab7078d01.tar.bz2
podman-eb28a1c08469d56494006d0f2c64933ab7078d01.zip
update buildah and c/common to latest
also includes bumps for c/storage and c/image Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'vendor/github.com/docker')
-rw-r--r--vendor/github.com/docker/distribution/.gitignore38
-rw-r--r--vendor/github.com/docker/distribution/.golangci.yml20
-rw-r--r--vendor/github.com/docker/distribution/.mailmap49
-rw-r--r--vendor/github.com/docker/distribution/BUILDING.md117
-rw-r--r--vendor/github.com/docker/distribution/CONTRIBUTING.md148
-rw-r--r--vendor/github.com/docker/distribution/Dockerfile50
-rw-r--r--vendor/github.com/docker/distribution/MAINTAINERS243
-rw-r--r--vendor/github.com/docker/distribution/Makefile102
-rw-r--r--vendor/github.com/docker/distribution/README.md130
-rw-r--r--vendor/github.com/docker/distribution/ROADMAP.md267
-rw-r--r--vendor/github.com/docker/distribution/blobs.go265
-rw-r--r--vendor/github.com/docker/distribution/doc.go7
-rw-r--r--vendor/github.com/docker/distribution/docker-bake.hcl65
-rw-r--r--vendor/github.com/docker/distribution/errors.go119
-rw-r--r--vendor/github.com/docker/distribution/manifests.go125
-rw-r--r--vendor/github.com/docker/distribution/metrics/prometheus.go13
-rw-r--r--vendor/github.com/docker/distribution/registry.go118
-rw-r--r--vendor/github.com/docker/distribution/registry/client/blob_writer.go162
-rw-r--r--vendor/github.com/docker/distribution/registry/client/errors.go139
-rw-r--r--vendor/github.com/docker/distribution/registry/client/repository.go872
-rw-r--r--vendor/github.com/docker/distribution/registry/client/transport/http_reader.go250
-rw-r--r--vendor/github.com/docker/distribution/registry/client/transport/transport.go147
-rw-r--r--vendor/github.com/docker/distribution/registry/storage/cache/cache.go35
-rw-r--r--vendor/github.com/docker/distribution/registry/storage/cache/cachedblobdescriptorstore.go129
-rw-r--r--vendor/github.com/docker/distribution/registry/storage/cache/memory/memory.go179
-rw-r--r--vendor/github.com/docker/distribution/tags.go27
-rw-r--r--vendor/github.com/docker/distribution/vendor.conf51
-rw-r--r--vendor/github.com/docker/go-metrics/CONTRIBUTING.md55
-rw-r--r--vendor/github.com/docker/go-metrics/LICENSE191
-rw-r--r--vendor/github.com/docker/go-metrics/LICENSE.docs425
-rw-r--r--vendor/github.com/docker/go-metrics/NOTICE16
-rw-r--r--vendor/github.com/docker/go-metrics/README.md91
-rw-r--r--vendor/github.com/docker/go-metrics/counter.go52
-rw-r--r--vendor/github.com/docker/go-metrics/docs.go3
-rw-r--r--vendor/github.com/docker/go-metrics/gauge.go72
-rw-r--r--vendor/github.com/docker/go-metrics/go.mod5
-rw-r--r--vendor/github.com/docker/go-metrics/go.sum67
-rw-r--r--vendor/github.com/docker/go-metrics/handler.go74
-rw-r--r--vendor/github.com/docker/go-metrics/helpers.go10
-rw-r--r--vendor/github.com/docker/go-metrics/namespace.go315
-rw-r--r--vendor/github.com/docker/go-metrics/register.go15
-rw-r--r--vendor/github.com/docker/go-metrics/timer.go85
-rw-r--r--vendor/github.com/docker/go-metrics/unit.go12
43 files changed, 0 insertions, 5355 deletions
diff --git a/vendor/github.com/docker/distribution/.gitignore b/vendor/github.com/docker/distribution/.gitignore
deleted file mode 100644
index 4cf7888e9..000000000
--- a/vendor/github.com/docker/distribution/.gitignore
+++ /dev/null
@@ -1,38 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-
-# never checkin from the bin file (for now)
-bin/*
-
-# Test key files
-*.pem
-
-# Cover profiles
-*.out
-
-# Editor/IDE specific files.
-*.sublime-project
-*.sublime-workspace
-.idea/*
diff --git a/vendor/github.com/docker/distribution/.golangci.yml b/vendor/github.com/docker/distribution/.golangci.yml
deleted file mode 100644
index 1ba6cb916..000000000
--- a/vendor/github.com/docker/distribution/.golangci.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-linters:
- enable:
- - structcheck
- - varcheck
- - staticcheck
- - unconvert
- - gofmt
- - goimports
- - golint
- - ineffassign
- - vet
- - unused
- - misspell
- disable:
- - errcheck
-
-run:
- deadline: 2m
- skip-dirs:
- - vendor
diff --git a/vendor/github.com/docker/distribution/.mailmap b/vendor/github.com/docker/distribution/.mailmap
deleted file mode 100644
index 8f3738f3d..000000000
--- a/vendor/github.com/docker/distribution/.mailmap
+++ /dev/null
@@ -1,49 +0,0 @@
-Stephen J Day <stephen.day@docker.com> Stephen Day <stevvooe@users.noreply.github.com>
-Stephen J Day <stephen.day@docker.com> Stephen Day <stevvooe@gmail.com>
-Olivier Gambier <olivier@docker.com> Olivier Gambier <dmp42@users.noreply.github.com>
-Brian Bland <brian.bland@docker.com> Brian Bland <r4nd0m1n4t0r@gmail.com>
-Brian Bland <brian.bland@docker.com> Brian Bland <brian.t.bland@gmail.com>
-Josh Hawn <josh.hawn@docker.com> Josh Hawn <jlhawn@berkeley.edu>
-Richard Scothern <richard.scothern@docker.com> Richard <richard.scothern@gmail.com>
-Richard Scothern <richard.scothern@docker.com> Richard Scothern <richard.scothern@gmail.com>
-Andrew Meredith <andymeredith@gmail.com> Andrew Meredith <kendru@users.noreply.github.com>
-harche <p.harshal@gmail.com> harche <harche@users.noreply.github.com>
-Jessie Frazelle <jessie@docker.com> <jfrazelle@users.noreply.github.com>
-Sharif Nassar <sharif@mrwacky.com> Sharif Nassar <mrwacky42@users.noreply.github.com>
-Sven Dowideit <SvenDowideit@home.org.au> Sven Dowideit <SvenDowideit@users.noreply.github.com>
-Vincent Giersch <vincent.giersch@ovh.net> Vincent Giersch <vincent@giersch.fr>
-davidli <wenquan.li@hp.com> davidli <wenquan.li@hpe.com>
-Omer Cohen <git@omer.io> Omer Cohen <git@omerc.net>
-Eric Yang <windfarer@gmail.com> Eric Yang <Windfarer@users.noreply.github.com>
-Nikita Tarasov <nikita@mygento.ru> Nikita <luckyraul@users.noreply.github.com>
-Yu Wang <yuwa@microsoft.com> yuwaMSFT2 <yuwa@microsoft.com>
-Yu Wang <yuwa@microsoft.com> Yu Wang (UC) <yuwa@microsoft.com>
-Olivier Gambier <olivier@docker.com> dmp <dmp@loaner.local>
-Olivier Gambier <olivier@docker.com> Olivier <o+github@gambier.email>
-Olivier Gambier <olivier@docker.com> Olivier <dmp42@users.noreply.github.com>
-Elsan Li 李楠 <elsanli@tencent.com> elsanli(李楠) <elsanli@tencent.com>
-Rui Cao <ruicao@alauda.io> ruicao <ruicao@alauda.io>
-Gwendolynne Barr <gwendolynne.barr@docker.com> gbarr01 <gwendolynne.barr@docker.com>
-Haibing Zhou 周海兵 <zhouhaibing089@gmail.com> zhouhaibing089 <zhouhaibing089@gmail.com>
-Feng Honglin <tifayuki@gmail.com> tifayuki <tifayuki@gmail.com>
-Helen Xie <xieyulin821@harmonycloud.cn> Helen-xie <xieyulin821@harmonycloud.cn>
-Mike Brown <brownwm@us.ibm.com> Mike Brown <mikebrow@users.noreply.github.com>
-Manish Tomar <manish.tomar@docker.com> Manish Tomar <manishtomar@users.noreply.github.com>
-Sakeven Jiang <jc5930@sina.cn> sakeven <jc5930@sina.cn>
-Milos Gajdos <milosgajdos83@gmail.com> Milos Gajdos <milosgajdos@users.noreply.github.com>
-Derek McGowan <derek@mcgstyle.net> Derek McGowa <dmcgowan@users.noreply.github.com>
-Adrian Plata <adrian.plata@docker.com> Adrian Plata <@users.noreply.github.com>
-Sebastiaan van Stijn <github@gone.nl> Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
-Vishesh Jindal <vishesh92@gmail.com> Vishesh Jindal <vishesh92@users.noreply.github.com>
-Wang Yan <wangyan@vmware.com> Wang Yan <wy65701436@users.noreply.github.com>
-Chris Patterson <chrispat@github.com> Chris Patterson <chrispat@users.noreply.github.com>
-Eohyung Lee <liquidnuker@gmail.com> Eohyung Lee <leoh0@users.noreply.github.com>
-João Pereira <484633+joaodrp@users.noreply.github.com>
-Smasherr <soundcracker@gmail.com> Smasherr <Smasherr@users.noreply.github.com>
-Thomas Berger <loki@lokis-chaos.de> Thomas Berger <tbe@users.noreply.github.com>
-Samuel Karp <skarp@amazon.com> Samuel Karp <samuelkarp@users.noreply.github.com>
-Justin Cormack <justin.cormack@docker.com>
-sayboras <sayboras@yahoo.com>
-CrazyMax <github@crazymax.dev>
-CrazyMax <github@crazymax.dev> <1951866+crazy-max@users.noreply.github.com>
-CrazyMax <github@crazymax.dev> <crazy-max@users.noreply.github.com>
diff --git a/vendor/github.com/docker/distribution/BUILDING.md b/vendor/github.com/docker/distribution/BUILDING.md
deleted file mode 100644
index 2981d016b..000000000
--- a/vendor/github.com/docker/distribution/BUILDING.md
+++ /dev/null
@@ -1,117 +0,0 @@
-
-# Building the registry source
-
-## Use-case
-
-This is useful if you intend to actively work on the registry.
-
-### Alternatives
-
-Most people should use the [official Registry docker image](https://hub.docker.com/r/library/registry/).
-
-People looking for advanced operational use cases might consider rolling their own image with a custom Dockerfile inheriting `FROM registry:2`.
-
-OS X users who want to run natively can do so following [the instructions here](https://github.com/docker/docker.github.io/blob/master/registry/recipes/osx-setup-guide.md).
-
-### Gotchas
-
-You are expected to know your way around with go & git.
-
-If you are a casual user with no development experience, and no preliminary knowledge of go, building from source is probably not a good solution for you.
-
-## Build the development environment
-
-The first prerequisite of properly building distribution targets is to have a Go
-development environment setup. Please follow [How to Write Go Code](https://golang.org/doc/code.html)
-for proper setup. If done correctly, you should have a GOROOT and GOPATH set in the
-environment.
-
-If a Go development environment is setup, one can use `go get` to install the
-`registry` command from the current latest:
-
- go get github.com/docker/distribution/cmd/registry
-
-The above will install the source repository into the `GOPATH`.
-
-Now create the directory for the registry data (this might require you to set permissions properly)
-
- mkdir -p /var/lib/registry
-
-... or alternatively `export REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/somewhere` if you want to store data into another location.
-
-The `registry`
-binary can then be run with the following:
-
- $ $GOPATH/bin/registry --version
- $GOPATH/bin/registry github.com/docker/distribution v2.0.0-alpha.1+unknown
-
-> __NOTE:__ While you do not need to use `go get` to checkout the distribution
-> project, for these build instructions to work, the project must be checked
-> out in the correct location in the `GOPATH`. This should almost always be
-> `$GOPATH/src/github.com/docker/distribution`.
-
-The registry can be run with the default config using the following
-incantation:
-
- $ $GOPATH/bin/registry serve $GOPATH/src/github.com/docker/distribution/cmd/registry/config-example.yml
- INFO[0000] endpoint local-5003 disabled, skipping app.id=34bbec38-a91a-494a-9a3f-b72f9010081f version=v2.0.0-alpha.1+unknown
- INFO[0000] endpoint local-8083 disabled, skipping app.id=34bbec38-a91a-494a-9a3f-b72f9010081f version=v2.0.0-alpha.1+unknown
- INFO[0000] listening on :5000 app.id=34bbec38-a91a-494a-9a3f-b72f9010081f version=v2.0.0-alpha.1+unknown
- INFO[0000] debug server listening localhost:5001
-
-If it is working, one should see the above log messages.
-
-### Repeatable Builds
-
-For the full development experience, one should `cd` into
-`$GOPATH/src/github.com/docker/distribution`. From there, the regular `go`
-commands, such as `go test`, should work per package (please see
-[Developing](#developing) if they don't work).
-
-A `Makefile` has been provided as a convenience to support repeatable builds.
-Please install the following into `GOPATH` for it to work:
-
- go get github.com/golang/lint/golint
-
-Once these commands are available in the `GOPATH`, run `make` to get a full
-build:
-
- $ make
- + clean
- + fmt
- + vet
- + lint
- + build
- github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar
- github.com/sirupsen/logrus
- github.com/docker/libtrust
- ...
- github.com/yvasiyarov/gorelic
- github.com/docker/distribution/registry/handlers
- github.com/docker/distribution/cmd/registry
- + test
- ...
- ok github.com/docker/distribution/digest 7.875s
- ok github.com/docker/distribution/manifest 0.028s
- ok github.com/docker/distribution/notifications 17.322s
- ? github.com/docker/distribution/registry [no test files]
- ok github.com/docker/distribution/registry/api/v2 0.101s
- ? github.com/docker/distribution/registry/auth [no test files]
- ok github.com/docker/distribution/registry/auth/silly 0.011s
- ...
- + /Users/sday/go/src/github.com/docker/distribution/bin/registry
- + /Users/sday/go/src/github.com/docker/distribution/bin/registry-api-descriptor-template
- + binaries
-
-The above provides a repeatable build using the contents of the vendor
-directory. This includes formatting, vetting, linting, building,
-testing and generating tagged binaries. We can verify this worked by running
-the registry binary generated in the "./bin" directory:
-
- $ ./bin/registry --version
- ./bin/registry github.com/docker/distribution v2.0.0-alpha.2-80-g16d8b2c.m
-
-### Optional build tags
-
-Optional [build tags](http://golang.org/pkg/go/build/) can be provided using
-the environment variable `DOCKER_BUILDTAGS`.
diff --git a/vendor/github.com/docker/distribution/CONTRIBUTING.md b/vendor/github.com/docker/distribution/CONTRIBUTING.md
deleted file mode 100644
index 4c067d9e7..000000000
--- a/vendor/github.com/docker/distribution/CONTRIBUTING.md
+++ /dev/null
@@ -1,148 +0,0 @@
-# Contributing to the registry
-
-## Before reporting an issue...
-
-### If your problem is with...
-
- - automated builds
- - your account on the [Docker Hub](https://hub.docker.com/)
- - any other [Docker Hub](https://hub.docker.com/) issue
-
-Then please do not report your issue here - you should instead report it to [https://support.docker.com](https://support.docker.com)
-
-### If you...
-
- - need help setting up your registry
- - can't figure out something
- - are not sure what's going on or what your problem is
-
-Then please do not open an issue here yet - you should first try one of the following support forums:
-
- - irc: #docker-distribution on freenode
- - mailing-list: <distribution@dockerproject.org> or https://groups.google.com/a/dockerproject.org/forum/#!forum/distribution
-
-### Reporting security issues
-
-The Docker maintainers take security seriously. If you discover a security
-issue, please bring it to their attention right away!
-
-Please **DO NOT** file a public issue, instead send your report privately to
-[security@docker.com](mailto:security@docker.com).
-
-## Reporting an issue properly
-
-By following these simple rules you will get better and faster feedback on your issue.
-
- - search the bugtracker for an already reported issue
-
-### If you found an issue that describes your problem:
-
- - please read other user comments first, and confirm this is the same issue: a given error condition might be indicative of different problems - you may also find a workaround in the comments
- - please refrain from adding "same thing here" or "+1" comments
- - you don't need to comment on an issue to get notified of updates: just hit the "subscribe" button
- - comment if you have some new, technical and relevant information to add to the case
- - __DO NOT__ comment on closed issues or merged PRs. If you think you have a related problem, open up a new issue and reference the PR or issue.
-
-### If you have not found an existing issue that describes your problem:
-
- 1. create a new issue, with a succinct title that describes your issue:
- - bad title: "It doesn't work with my docker"
- - good title: "Private registry push fail: 400 error with E_INVALID_DIGEST"
- 2. copy the output of:
- - `docker version`
- - `docker info`
- - `docker exec <registry-container> registry --version`
- 3. copy the command line you used to launch your Registry
- 4. restart your docker daemon in debug mode (add `-D` to the daemon launch arguments)
- 5. reproduce your problem and get your docker daemon logs showing the error
- 6. if relevant, copy your registry logs that show the error
- 7. provide any relevant detail about your specific Registry configuration (e.g., storage backend used)
- 8. indicate if you are using an enterprise proxy, Nginx, or anything else between you and your Registry
-
-## Contributing a patch for a known bug, or a small correction
-
-You should follow the basic GitHub workflow:
-
- 1. fork
- 2. commit a change
- 3. make sure the tests pass
- 4. PR
-
-Additionally, you must [sign your commits](https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work). It's very simple:
-
- - configure your name with git: `git config user.name "Real Name" && git config user.email mail@example.com`
- - sign your commits using `-s`: `git commit -s -m "My commit"`
-
-Some simple rules to ensure quick merge:
-
- - clearly point to the issue(s) you want to fix in your PR comment (e.g., `closes #12345`)
- - prefer multiple (smaller) PRs addressing individual issues over a big one trying to address multiple issues at once
- - if you need to amend your PR following comments, please squash instead of adding more commits
-
-## Contributing new features
-
-You are heavily encouraged to first discuss what you want to do. You can do so on the irc channel, or by opening an issue that clearly describes the use case you want to fulfill, or the problem you are trying to solve.
-
-If this is a major new feature, you should then submit a proposal that describes your technical solution and reasoning.
-If you did discuss it first, this will likely be greenlighted very fast. It's advisable to address all feedback on this proposal before starting actual work.
-
-Then you should submit your implementation, clearly linking to the issue (and possible proposal).
-
-Your PR will be reviewed by the community, then ultimately by the project maintainers, before being merged.
-
-It's mandatory to:
-
- - interact respectfully with other community members and maintainers - more generally, you are expected to abide by the [Docker community rules](https://github.com/docker/docker/blob/master/CONTRIBUTING.md#docker-community-guidelines)
- - address maintainers' comments and modify your submission accordingly
- - write tests for any new code
-
-Complying to these simple rules will greatly accelerate the review process, and will ensure you have a pleasant experience in contributing code to the Registry.
-
-Have a look at a great, successful contribution: the [Swift driver PR](https://github.com/docker/distribution/pull/493)
-
-## Coding Style
-
-Unless explicitly stated, we follow all coding guidelines from the Go
-community. While some of these standards may seem arbitrary, they somehow seem
-to result in a solid, consistent codebase.
-
-It is possible that the code base does not currently comply with these
-guidelines. We are not looking for a massive PR that fixes this, since that
-goes against the spirit of the guidelines. All new contributions should make a
-best effort to clean up and make the code base better than they left it.
-Obviously, apply your best judgement. Remember, the goal here is to make the
-code base easier for humans to navigate and understand. Always keep that in
-mind when nudging others to comply.
-
-The rules:
-
-1. All code should be formatted with `gofmt -s`.
-2. All code should pass the default levels of
- [`golint`](https://github.com/golang/lint).
-3. All code should follow the guidelines covered in [Effective
- Go](http://golang.org/doc/effective_go.html) and [Go Code Review
- Comments](https://github.com/golang/go/wiki/CodeReviewComments).
-4. Comment the code. Tell us the why, the history and the context.
-5. Document _all_ declarations and methods, even private ones. Declare
- expectations, caveats and anything else that may be important. If a type
- gets exported, having the comments already there will ensure it's ready.
-6. Variable name length should be proportional to its context and no longer.
- `noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`.
- In practice, short methods will have short variable names and globals will
- have longer names.
-7. No underscores in package names. If you need a compound name, step back,
- and re-examine why you need a compound name. If you still think you need a
- compound name, lose the underscore.
-8. No utils or helpers packages. If a function is not general enough to
- 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.
-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
- packages are acceptable if they provide _real_ incremental value.
-10. Even though we call these "rules" above, they are actually just
- guidelines. Since you've read all the rules, you now know that.
-
-If you are having trouble getting into the mood of idiomatic Go, we recommend
-reading through [Effective Go](http://golang.org/doc/effective_go.html). The
-[Go Blog](http://blog.golang.org/) is also a great resource. Drinking the
-kool-aid is a lot easier than going thirsty.
diff --git a/vendor/github.com/docker/distribution/Dockerfile b/vendor/github.com/docker/distribution/Dockerfile
deleted file mode 100644
index ae8c040c7..000000000
--- a/vendor/github.com/docker/distribution/Dockerfile
+++ /dev/null
@@ -1,50 +0,0 @@
-# syntax=docker/dockerfile:1.3
-
-ARG GO_VERSION=1.16.15
-ARG GORELEASER_XX_VERSION=1.2.5
-
-FROM --platform=$BUILDPLATFORM crazymax/goreleaser-xx:${GORELEASER_XX_VERSION} AS goreleaser-xx
-FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
-COPY --from=goreleaser-xx / /
-RUN apk add --no-cache file git
-WORKDIR /go/src/github.com/docker/distribution
-
-FROM base AS build
-ENV GO111MODULE=auto
-ENV CGO_ENABLED=0
-# GIT_REF is used by goreleaser-xx to handle the proper git ref when available.
-# It will fallback to the working tree info if empty and use "git tag --points-at"
-# or "git describe" to define the version info.
-ARG GIT_REF
-ARG TARGETPLATFORM
-ARG PKG="github.com/distribution/distribution"
-ARG BUILDTAGS="include_oss include_gcs"
-RUN --mount=type=bind,rw \
- --mount=type=cache,target=/root/.cache/go-build \
- --mount=target=/go/pkg/mod,type=cache \
- goreleaser-xx --debug \
- --name="registry" \
- --dist="/out" \
- --main="./cmd/registry" \
- --flags="-v" \
- --ldflags="-s -w -X '$PKG/version.Version={{.Version}}' -X '$PKG/version.Revision={{.Commit}}' -X '$PKG/version.Package=$PKG'" \
- --tags="$BUILDTAGS" \
- --files="LICENSE" \
- --files="README.md"
-
-FROM scratch AS artifact
-COPY --from=build /out/*.tar.gz /
-COPY --from=build /out/*.zip /
-COPY --from=build /out/*.sha256 /
-
-FROM scratch AS binary
-COPY --from=build /usr/local/bin/registry* /
-
-FROM alpine:3.14
-RUN apk add --no-cache ca-certificates
-COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml
-COPY --from=build /usr/local/bin/registry /bin/registry
-VOLUME ["/var/lib/registry"]
-EXPOSE 5000
-ENTRYPOINT ["registry"]
-CMD ["serve", "/etc/docker/registry/config.yml"]
diff --git a/vendor/github.com/docker/distribution/MAINTAINERS b/vendor/github.com/docker/distribution/MAINTAINERS
deleted file mode 100644
index 3183620c5..000000000
--- a/vendor/github.com/docker/distribution/MAINTAINERS
+++ /dev/null
@@ -1,243 +0,0 @@
-# Distribution maintainers file
-#
-# This file describes who runs the docker/distribution project and how.
-# This is a living document - if you see something out of date or missing, speak up!
-#
-# It is structured to be consumable by both humans and programs.
-# To extract its contents programmatically, use any TOML-compliant parser.
-#
-
-[Rules]
-
- [Rules.maintainers]
-
- title = "What is a maintainer?"
-
- text = """
-There are different types of maintainers, with different responsibilities, but
-all maintainers have 3 things in common:
-
-1) They share responsibility in the project's success.
-2) They have made a long-term, recurring time investment to improve the project.
-3) They spend that time doing whatever needs to be done, not necessarily what
-is the most interesting or fun.
-
-Maintainers are often under-appreciated, because their work is harder to appreciate.
-It's easy to appreciate a really cool and technically advanced feature. It's harder
-to appreciate the absence of bugs, the slow but steady improvement in stability,
-or the reliability of a release process. But those things distinguish a good
-project from a great one.
-"""
-
- [Rules.reviewer]
-
- title = "What is a reviewer?"
-
- text = """
-A reviewer is a core role within the project.
-They share in reviewing issues and pull requests and their LGTM count towards the
-required LGTM count to merge a code change into the project.
-
-Reviewers are part of the organization but do not have write access.
-Becoming a reviewer is a core aspect in the journey to becoming a maintainer.
-"""
-
- [Rules.adding-maintainers]
-
- title = "How are maintainers added?"
-
- text = """
-Maintainers are first and foremost contributors that have shown they are
-committed to the long term success of a project. Contributors wanting to become
-maintainers are expected to be deeply involved in contributing code, pull
-request review, and triage of issues in the project for more than three months.
-
-Just contributing does not make you a maintainer, it is about building trust
-with the current maintainers of the project and being a person that they can
-depend on and trust to make decisions in the best interest of the project.
-
-Periodically, the existing maintainers curate a list of contributors that have
-shown regular activity on the project over the prior months. From this list,
-maintainer candidates are selected and proposed on the maintainers mailing list.
-
-After a candidate has been announced on the maintainers mailing list, the
-existing maintainers are given five business days to discuss the candidate,
-raise objections and cast their vote. Candidates must be approved by at least 66% of the current maintainers by adding their vote on the mailing
-list. Only maintainers of the repository that the candidate is proposed for are
-allowed to vote.
-
-If a candidate is approved, a maintainer will contact the candidate to invite
-the candidate to open a pull request that adds the contributor to the
-MAINTAINERS file. The candidate becomes a maintainer once the pull request is
-merged.
-"""
-
- [Rules.stepping-down-policy]
-
- title = "Stepping down policy"
-
- text = """
-Life priorities, interests, and passions can change. If you're a maintainer but
-feel you must remove yourself from the list, inform other maintainers that you
-intend to step down, and if possible, help find someone to pick up your work.
-At the very least, ensure your work can be continued where you left off.
-
-After you've informed other maintainers, create a pull request to remove
-yourself from the MAINTAINERS file.
-"""
-
- [Rules.inactive-maintainers]
-
- title = "Removal of inactive maintainers"
-
- text = """
-Similar to the procedure for adding new maintainers, existing maintainers can
-be removed from the list if they do not show significant activity on the
-project. Periodically, the maintainers review the list of maintainers and their
-activity over the last three months.
-
-If a maintainer has shown insufficient activity over this period, a neutral
-person will contact the maintainer to ask if they want to continue being
-a maintainer. If the maintainer decides to step down as a maintainer, they
-open a pull request to be removed from the MAINTAINERS file.
-
-If the maintainer wants to remain a maintainer, but is unable to perform the
-required duties they can be removed with a vote of at least 66% of
-the current maintainers. An e-mail is sent to the
-mailing list, inviting maintainers of the project to vote. The voting period is
-five business days. Issues related to a maintainer's performance should be
-discussed with them among the other maintainers so that they are not surprised
-by a pull request removing them.
-"""
-
- [Rules.decisions]
-
- title = "How are decisions made?"
-
- text = """
-Short answer: EVERYTHING IS A PULL REQUEST.
-
-distribution is an open-source project with an open design philosophy. This means
-that the repository is the source of truth for EVERY aspect of the project,
-including its philosophy, design, road map, and APIs. *If it's part of the
-project, it's in the repo. If it's in the repo, it's part of the project.*
-
-As a result, all decisions can be expressed as changes to the repository. An
-implementation change is a change to the source code. An API change is a change
-to the API specification. A philosophy change is a change to the philosophy
-manifesto, and so on.
-
-All decisions affecting distribution, big and small, follow the same 3 steps:
-
-* Step 1: Open a pull request. Anyone can do this.
-
-* Step 2: Discuss the pull request. Anyone can do this.
-
-* Step 3: Merge or refuse the pull request. Who does this depends on the nature
-of the pull request and which areas of the project it affects.
-"""
-
- [Rules.DCO]
-
- title = "Helping contributors with the DCO"
-
- text = """
-The [DCO or `Sign your work`](
-https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work)
-requirement is not intended as a roadblock or speed bump.
-
-Some distribution contributors are not as familiar with `git`, or have used a web
-based editor, and thus asking them to `git commit --amend -s` is not the best
-way forward.
-
-In this case, maintainers can update the commits based on clause (c) of the DCO.
-The most trivial way for a contributor to allow the maintainer to do this, is to
-add a DCO signature in a pull requests's comment, or a maintainer can simply
-note that the change is sufficiently trivial that it does not substantially
-change the existing contribution - i.e., a spelling change.
-
-When you add someone's DCO, please also add your own to keep a log.
-"""
-
- [Rules."no direct push"]
-
- title = "I'm a maintainer. Should I make pull requests too?"
-
- text = """
-Yes. Nobody should ever push to master directly. All changes should be
-made through a pull request.
-"""
-
- [Rules.tsc]
-
- title = "Conflict Resolution and technical disputes"
-
- text = """
-distribution defers to the [Technical Steering Committee](https://github.com/moby/tsc) for escalations and resolution on disputes for technical matters."
- """
-
- [Rules.meta]
-
- title = "How is this process changed?"
-
- text = "Just like everything else: by making a pull request :)"
-
-# Current project organization
-[Org]
-
- [Org.Maintainers]
- people = [
- "dmcgowan",
- "dmp42",
- "stevvooe",
- ]
- [Org.Reviewers]
- people = [
- "manishtomar",
- "caervs",
- "davidswu",
- "RobbKistler"
- ]
-
-[people]
-
-# A reference list of all people associated with the project.
-# All other sections should refer to people by their canonical key
-# in the people section.
-
- # ADD YOURSELF HERE IN ALPHABETICAL ORDER
-
- [people.caervs]
- Name = "Ryan Abrams"
- Email = "rdabrams@gmail.com"
- GitHub = "caervs"
-
- [people.davidswu]
- Name = "David Wu"
- Email = "dwu7401@gmail.com"
- GitHub = "davidswu"
-
- [people.dmcgowan]
- Name = "Derek McGowan"
- Email = "derek@mcgstyle.net"
- GitHub = "dmcgowan"
-
- [people.dmp42]
- Name = "Olivier Gambier"
- Email = "olivier@docker.com"
- GitHub = "dmp42"
-
- [people.manishtomar]
- Name = "Manish Tomar"
- Email = "manish.tomar@docker.com"
- GitHub = "manishtomar"
-
- [people.RobbKistler]
- Name = "Robb Kistler"
- Email = "robb.kistler@docker.com"
- GitHub = "RobbKistler"
-
- [people.stevvooe]
- Name = "Stephen Day"
- Email = "stephen.day@docker.com"
- GitHub = "stevvooe"
diff --git a/vendor/github.com/docker/distribution/Makefile b/vendor/github.com/docker/distribution/Makefile
deleted file mode 100644
index 331da2732..000000000
--- a/vendor/github.com/docker/distribution/Makefile
+++ /dev/null
@@ -1,102 +0,0 @@
-# Root directory of the project (absolute path).
-ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
-
-# Used to populate version variable in main package.
-VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always)
-REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
-
-
-PKG=github.com/docker/distribution
-
-# Project packages.
-PACKAGES=$(shell go list -tags "${BUILDTAGS}" ./... | grep -v /vendor/)
-INTEGRATION_PACKAGE=${PKG}
-COVERAGE_PACKAGES=$(filter-out ${PKG}/registry/storage/driver/%,${PACKAGES})
-
-
-# Project binaries.
-COMMANDS=registry digest registry-api-descriptor-template
-
-# Allow turning off function inlining and variable registerization
-ifeq (${DISABLE_OPTIMIZATION},true)
- GO_GCFLAGS=-gcflags "-N -l"
- VERSION:="$(VERSION)-noopt"
-endif
-
-WHALE = "+"
-
-# Go files
-#
-TESTFLAGS_RACE=
-GOFILES=$(shell find . -type f -name '*.go')
-GO_TAGS=$(if $(BUILDTAGS),-tags "$(BUILDTAGS)",)
-GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) $(EXTRA_LDFLAGS)'
-
-BINARIES=$(addprefix bin/,$(COMMANDS))
-
-# Flags passed to `go test`
-TESTFLAGS ?= -v $(TESTFLAGS_RACE)
-TESTFLAGS_PARALLEL ?= 8
-
-.PHONY: all build binaries check clean test test-race test-full integration coverage
-.DEFAULT: all
-
-all: binaries
-
-# This only needs to be generated by hand when cutting full releases.
-version/version.go:
- @echo "$(WHALE) $@"
- ./version/version.sh > $@
-
-check: ## run all linters (TODO: enable "unused", "varcheck", "ineffassign", "unconvert", "staticheck", "goimports", "structcheck")
- @echo "$(WHALE) $@"
- golangci-lint run
-
-test: ## run tests, except integration test with test.short
- @echo "$(WHALE) $@"
- @go test ${GO_TAGS} -test.short ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES})
-
-test-race: ## run tests, except integration test with test.short and race
- @echo "$(WHALE) $@"
- @go test ${GO_TAGS} -race -test.short ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES})
-
-test-full: ## run tests, except integration tests
- @echo "$(WHALE) $@"
- @go test ${GO_TAGS} ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES})
-
-integration: ## run integration tests
- @echo "$(WHALE) $@"
- @go test ${TESTFLAGS} -parallel ${TESTFLAGS_PARALLEL} ${INTEGRATION_PACKAGE}
-
-coverage: ## generate coverprofiles from the unit tests
- @echo "$(WHALE) $@"
- @rm -f coverage.txt
- @go test ${GO_TAGS} -i ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${COVERAGE_PACKAGES}) 2> /dev/null
- @( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${COVERAGE_PACKAGES}); do \
- go test ${GO_TAGS} ${TESTFLAGS} \
- -cover \
- -coverprofile=profile.out \
- -covermode=atomic $$pkg || exit; \
- if [ -f profile.out ]; then \
- cat profile.out >> coverage.txt; \
- rm profile.out; \
- fi; \
- done )
-
-FORCE:
-
-# Build a binary from a cmd.
-bin/%: cmd/% FORCE
- @echo "$(WHALE) $@${BINARY_SUFFIX}"
- @go build ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@${BINARY_SUFFIX} ${GO_LDFLAGS} ${GO_TAGS} ./$<
-
-binaries: $(BINARIES) ## build binaries
- @echo "$(WHALE) $@"
-
-build:
- @echo "$(WHALE) $@"
- @go build ${GO_GCFLAGS} ${GO_BUILD_FLAGS} ${GO_LDFLAGS} ${GO_TAGS} $(PACKAGES)
-
-clean: ## clean up binaries
- @echo "$(WHALE) $@"
- @rm -f $(BINARIES)
diff --git a/vendor/github.com/docker/distribution/README.md b/vendor/github.com/docker/distribution/README.md
deleted file mode 100644
index e513c18e9..000000000
--- a/vendor/github.com/docker/distribution/README.md
+++ /dev/null
@@ -1,130 +0,0 @@
-# Distribution
-
-The Docker toolset to pack, ship, store, and deliver content.
-
-This repository provides the Docker Registry 2.0 implementation
-for storing and distributing Docker images. It supersedes the
-[docker/docker-registry](https://github.com/docker/docker-registry)
-project with a new API design, focused around security and performance.
-
-<img src="https://www.docker.com/sites/default/files/oyster-registry-3.png" width=200px/>
-
-[![Circle CI](https://circleci.com/gh/docker/distribution/tree/master.svg?style=svg)](https://circleci.com/gh/docker/distribution/tree/master)
-[![GoDoc](https://godoc.org/github.com/docker/distribution?status.svg)](https://godoc.org/github.com/docker/distribution)
-
-This repository contains the following components:
-
-|**Component** |Description |
-|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| **registry** | An implementation of the [Docker Registry HTTP API V2](docs/spec/api.md) for use with docker 1.6+. |
-| **libraries** | A rich set of libraries for interacting with distribution components. Please see [godoc](https://godoc.org/github.com/docker/distribution) for details. **Note**: These libraries are **unstable**. |
-| **specifications** | _Distribution_ related specifications are available in [docs/spec](docs/spec) |
-| **documentation** | Docker's full documentation set is available at [docs.docker.com](https://docs.docker.com). This repository [contains the subset](docs/) related just to the registry. |
-
-### How does this integrate with Docker engine?
-
-This project should provide an implementation to a V2 API for use in the [Docker
-core project](https://github.com/docker/docker). The API should be embeddable
-and simplify the process of securely pulling and pushing content from `docker`
-daemons.
-
-### What are the long term goals of the Distribution project?
-
-The _Distribution_ project has the further long term goal of providing a
-secure tool chain for distributing content. The specifications, APIs and tools
-should be as useful with Docker as they are without.
-
-Our goal is to design a professional grade and extensible content distribution
-system that allow users to:
-
-* Enjoy an efficient, secured and reliable way to store, manage, package and
- exchange content
-* Hack/roll their own on top of healthy open-source components
-* Implement their own home made solution through good specs, and solid
- extensions mechanism.
-
-## More about Registry 2.0
-
-The new registry implementation provides the following benefits:
-
-- faster push and pull
-- new, more efficient implementation
-- simplified deployment
-- pluggable storage backend
-- webhook notifications
-
-For information on upcoming functionality, please see [ROADMAP.md](ROADMAP.md).
-
-### Who needs to deploy a registry?
-
-By default, Docker users pull images from Docker's public registry instance.
-[Installing Docker](https://docs.docker.com/engine/installation/) gives users this
-ability. Users can also push images to a repository on Docker's public registry,
-if they have a [Docker Hub](https://hub.docker.com/) account.
-
-For some users and even companies, this default behavior is sufficient. For
-others, it is not.
-
-For example, users with their own software products may want to maintain a
-registry for private, company images. Also, you may wish to deploy your own
-image repository for images used to test or in continuous integration. For these
-use cases and others, [deploying your own registry instance](https://github.com/docker/docker.github.io/blob/master/registry/deploying.md)
-may be the better choice.
-
-### Migration to Registry 2.0
-
-For those who have previously deployed their own registry based on the Registry
-1.0 implementation and wish to deploy a Registry 2.0 while retaining images,
-data migration is required. A tool to assist with migration efforts has been
-created. For more information see [docker/migrator](https://github.com/docker/migrator).
-
-## Contribute
-
-Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute
-issues, fixes, and patches to this project. If you are contributing code, see
-the instructions for [building a development environment](BUILDING.md).
-
-## Support
-
-If any issues are encountered while using the _Distribution_ project, several
-avenues are available for support:
-
-<table>
-<tr>
- <th align="left">
- IRC
- </th>
- <td>
- #docker-distribution on FreeNode
- </td>
-</tr>
-<tr>
- <th align="left">
- Issue Tracker
- </th>
- <td>
- github.com/docker/distribution/issues
- </td>
-</tr>
-<tr>
- <th align="left">
- Google Groups
- </th>
- <td>
- https://groups.google.com/a/dockerproject.org/forum/#!forum/distribution
- </td>
-</tr>
-<tr>
- <th align="left">
- Mailing List
- </th>
- <td>
- docker@dockerproject.org
- </td>
-</tr>
-</table>
-
-
-## License
-
-This project is distributed under [Apache License, Version 2.0](LICENSE).
diff --git a/vendor/github.com/docker/distribution/ROADMAP.md b/vendor/github.com/docker/distribution/ROADMAP.md
deleted file mode 100644
index 701127afe..000000000
--- a/vendor/github.com/docker/distribution/ROADMAP.md
+++ /dev/null
@@ -1,267 +0,0 @@
-# Roadmap
-
-The Distribution Project consists of several components, some of which are
-still being defined. This document defines the high-level goals of the
-project, identifies the current components, and defines the release-
-relationship to the Docker Platform.
-
-* [Distribution Goals](#distribution-goals)
-* [Distribution Components](#distribution-components)
-* [Project Planning](#project-planning): release-relationship to the Docker Platform.
-
-This road map is a living document, providing an overview of the goals and
-considerations made in respect of the future of the project.
-
-## Distribution Goals
-
-- Replace the existing [docker registry](github.com/docker/docker-registry)
- implementation as the primary implementation.
-- Replace the existing push and pull code in the docker engine with the
- distribution package.
-- Define a strong data model for distributing docker images
-- Provide a flexible distribution tool kit for use in the docker platform
-- Unlock new distribution models
-
-## Distribution Components
-
-Components of the Distribution Project are managed via github [milestones](https://github.com/docker/distribution/milestones). Upcoming
-features and bugfixes for a component will be added to the relevant milestone. If a feature or
-bugfix is not part of a milestone, it is currently unscheduled for
-implementation.
-
-* [Registry](#registry)
-* [Distribution Package](#distribution-package)
-
-***
-
-### Registry
-
-The new Docker registry is the main portion of the distribution repository.
-Registry 2.0 is the first release of the next-generation registry. This was
-primarily focused on implementing the [new registry
-API](https://github.com/docker/distribution/blob/master/docs/spec/api.md),
-with a focus on security and performance.
-
-Following from the Distribution project goals above, we have a set of goals
-for registry v2 that we would like to follow in the design. New features
-should be compared against these goals.
-
-#### Data Storage and Distribution First
-
-The registry's first goal is to provide a reliable, consistent storage
-location for Docker images. The registry should only provide the minimal
-amount of indexing required to fetch image data and no more.
-
-This means we should be selective in new features and API additions, including
-those that may require expensive, ever growing indexes. Requests should be
-servable in "constant time".
-
-#### Content Addressability
-
-All data objects used in the registry API should be content addressable.
-Content identifiers should be secure and verifiable. This provides a secure,
-reliable base from which to build more advanced content distribution systems.
-
-#### Content Agnostic
-
-In the past, changes to the image format would require large changes in Docker
-and the Registry. By decoupling the distribution and image format, we can
-allow the formats to progress without having to coordinate between the two.
-This means that we should be focused on decoupling Docker from the registry
-just as much as decoupling the registry from Docker. Such an approach will
-allow us to unlock new distribution models that haven't been possible before.
-
-We can take this further by saying that the new registry should be content
-agnostic. The registry provides a model of names, tags, manifests and content
-addresses and that model can be used to work with content.
-
-#### Simplicity
-
-The new registry should be closer to a microservice component than its
-predecessor. This means it should have a narrower API and a low number of
-service dependencies. It should be easy to deploy.
-
-This means that other solutions should be explored before changing the API or
-adding extra dependencies. If functionality is required, can it be added as an
-extension or companion service.
-
-#### Extensibility
-
-The registry should provide extension points to add functionality. By keeping
-the scope narrow, but providing the ability to add functionality.
-
-Features like search, indexing, synchronization and registry explorers fall
-into this category. No such feature should be added unless we've found it
-impossible to do through an extension.
-
-#### Active Feature Discussions
-
-The following are feature discussions that are currently active.
-
-If you don't see your favorite, unimplemented feature, feel free to contact us
-via IRC or the mailing list and we can talk about adding it. The goal here is
-to make sure that new features go through a rigid design process before
-landing in the registry.
-
-##### Proxying to other Registries
-
-A _pull-through caching_ mode exists for the registry, but is restricted from
-within the docker client to only mirror the official Docker Hub. This functionality
-can be expanded when image provenance has been specified and implemented in the
-distribution project.
-
-##### Metadata storage
-
-Metadata for the registry is currently stored with the manifest and layer data on
-the storage backend. While this is a big win for simplicity and reliably maintaining
-state, it comes with the cost of consistency and high latency. The mutable registry
-metadata operations should be abstracted behind an API which will allow ACID compliant
-storage systems to handle metadata.
-
-##### Peer to Peer transfer
-
-Discussion has started here: https://docs.google.com/document/d/1rYDpSpJiQWmCQy8Cuiaa3NH-Co33oK_SC9HeXYo87QA/edit
-
-##### Indexing, Search and Discovery
-
-The original registry provided some implementation of search for use with
-private registries. Support has been elided from V2 since we'd like to both
-decouple search functionality from the registry. The makes the registry
-simpler to deploy, especially in use cases where search is not needed, and
-let's us decouple the image format from the registry.
-
-There are explorations into using the catalog API and notification system to
-build external indexes. The current line of thought is that we will define a
-common search API to index and query docker images. Such a system could be run
-as a companion to a registry or set of registries to power discovery.
-
-The main issue with search and discovery is that there are so many ways to
-accomplish it. There are two aspects to this project. The first is deciding on
-how it will be done, including an API definition that can work with changing
-data formats. The second is the process of integrating with `docker search`.
-We expect that someone attempts to address the problem with the existing tools
-and propose it as a standard search API or uses it to inform a standardization
-process. Once this has been explored, we integrate with the docker client.
-
-Please see the following for more detail:
-
-- https://github.com/docker/distribution/issues/206
-
-##### Deletes
-
-> __NOTE:__ Deletes are a much asked for feature. Before requesting this
-feature or participating in discussion, we ask that you read this section in
-full and understand the problems behind deletes.
-
-While, at first glance, implementing deleting seems simple, there are a number
-mitigating factors that make many solutions not ideal or even pathological in
-the context of a registry. The following paragraph discuss the background and
-approaches that could be applied to arrive at a solution.
-
-The goal of deletes in any system is to remove unused or unneeded data. Only
-data requested for deletion should be removed and no other data. Removing
-unintended data is worse than _not_ removing data that was requested for
-removal but ideally, both are supported. Generally, according to this rule, we
-err on holding data longer than needed, ensuring that it is only removed when
-we can be certain that it can be removed. With the current behavior, we opt to
-hold onto the data forever, ensuring that data cannot be incorrectly removed.
-
-To understand the problems with implementing deletes, one must understand the
-data model. All registry data is stored in a filesystem layout, implemented on
-a "storage driver", effectively a _virtual file system_ (VFS). The storage
-system must assume that this VFS layer will be eventually consistent and has
-poor read- after-write consistency, since this is the lower common denominator
-among the storage drivers. This is mitigated by writing values in reverse-
-dependent order, but makes wider transactional operations unsafe.
-
-Layered on the VFS model is a content-addressable _directed, acyclic graph_
-(DAG) made up of blobs. Manifests reference layers. Tags reference manifests.
-Since the same data can be referenced by multiple manifests, we only store
-data once, even if it is in different repositories. Thus, we have a set of
-blobs, referenced by tags and manifests. If we want to delete a blob we need
-to be certain that it is no longer referenced by another manifest or tag. When
-we delete a manifest, we also can try to delete the referenced blobs. Deciding
-whether or not a blob has an active reference is the crux of the problem.
-
-Conceptually, deleting a manifest and its resources is quite simple. Just find
-all the manifests, enumerate the referenced blobs and delete the blobs not in
-that set. An astute observer will recognize this as a garbage collection
-problem. As with garbage collection in programming languages, this is very
-simple when one always has a consistent view. When one adds parallelism and an
-inconsistent view of data, it becomes very challenging.
-
-A simple example can demonstrate this. Let's say we are deleting a manifest
-_A_ in one process. We scan the manifest and decide that all the blobs are
-ready for deletion. Concurrently, we have another process accepting a new
-manifest _B_ referencing one or more blobs from the manifest _A_. Manifest _B_
-is accepted and all the blobs are considered present, so the operation
-proceeds. The original process then deletes the referenced blobs, assuming
-they were unreferenced. The manifest _B_, which we thought had all of its data
-present, can no longer be served by the registry, since the dependent data has
-been deleted.
-
-Deleting data from the registry safely requires some way to coordinate this
-operation. The following approaches are being considered:
-
-- _Reference Counting_ - Maintain a count of references to each blob. This is
- challenging for a number of reasons: 1. maintaining a consistent consensus
- of reference counts across a set of Registries and 2. Building the initial
- list of reference counts for an existing registry. These challenges can be
- met with a consensus protocol like Paxos or Raft in the first case and a
- necessary but simple scan in the second..
-- _Lock the World GC_ - Halt all writes to the data store. Walk the data store
- and find all blob references. Delete all unreferenced blobs. This approach
- is very simple but requires disabling writes for a period of time while the
- service reads all data. This is slow and expensive but very accurate and
- effective.
-- _Generational GC_ - Do something similar to above but instead of blocking
- writes, writes are sent to another storage backend while reads are broadcast
- to the new and old backends. GC is then performed on the read-only portion.
- Because writes land in the new backend, the data in the read-only section
- can be safely deleted. The main drawbacks of this approach are complexity
- and coordination.
-- _Centralized Oracle_ - Using a centralized, transactional database, we can
- know exactly which data is referenced at any given time. This avoids
- coordination problem by managing this data in a single location. We trade
- off metadata scalability for simplicity and performance. This is a very good
- option for most registry deployments. This would create a bottleneck for
- registry metadata. However, metadata is generally not the main bottleneck
- when serving images.
-
-Please let us know if other solutions exist that we have yet to enumerate.
-Note that for any approach, implementation is a massive consideration. For
-example, a mark-sweep based solution may seem simple but the amount of work in
-coordination offset the extra work it might take to build a _Centralized
-Oracle_. We'll accept proposals for any solution but please coordinate with us
-before dropping code.
-
-At this time, we have traded off simplicity and ease of deployment for disk
-space. Simplicity and ease of deployment tend to reduce developer involvement,
-which is currently the most expensive resource in software engineering. Taking
-on any solution for deletes will greatly effect these factors, trading off
-very cheap disk space for a complex deployment and operational story.
-
-Please see the following issues for more detail:
-
-- https://github.com/docker/distribution/issues/422
-- https://github.com/docker/distribution/issues/461
-- https://github.com/docker/distribution/issues/462
-
-### Distribution Package
-
-At its core, the Distribution Project is a set of Go packages that make up
-Distribution Components. At this time, most of these packages make up the
-Registry implementation.
-
-The package itself is considered unstable. If you're using it, please take care to vendor the dependent version.
-
-For feature additions, please see the Registry section. In the future, we may break out a
-separate Roadmap for distribution-specific features that apply to more than
-just the registry.
-
-***
-
-### Project Planning
-
-An [Open-Source Planning Process](https://github.com/docker/distribution/wiki/Open-Source-Planning-Process) is used to define the Roadmap. [Project Pages](https://github.com/docker/distribution/wiki) define the goals for each Milestone and identify current progress.
-
diff --git a/vendor/github.com/docker/distribution/blobs.go b/vendor/github.com/docker/distribution/blobs.go
deleted file mode 100644
index 2a659eaa3..000000000
--- a/vendor/github.com/docker/distribution/blobs.go
+++ /dev/null
@@ -1,265 +0,0 @@
-package distribution
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "net/http"
- "time"
-
- "github.com/docker/distribution/reference"
- "github.com/opencontainers/go-digest"
- v1 "github.com/opencontainers/image-spec/specs-go/v1"
-)
-
-var (
- // ErrBlobExists returned when blob already exists
- ErrBlobExists = errors.New("blob exists")
-
- // ErrBlobDigestUnsupported when blob digest is an unsupported version.
- ErrBlobDigestUnsupported = errors.New("unsupported blob digest")
-
- // ErrBlobUnknown when blob is not found.
- ErrBlobUnknown = errors.New("unknown blob")
-
- // ErrBlobUploadUnknown returned when upload is not found.
- ErrBlobUploadUnknown = errors.New("blob upload unknown")
-
- // ErrBlobInvalidLength returned when the blob has an expected length on
- // commit, meaning mismatched with the descriptor or an invalid value.
- ErrBlobInvalidLength = errors.New("blob invalid length")
-)
-
-// ErrBlobInvalidDigest returned when digest check fails.
-type ErrBlobInvalidDigest struct {
- Digest digest.Digest
- Reason error
-}
-
-func (err ErrBlobInvalidDigest) Error() string {
- return fmt.Sprintf("invalid digest for referenced layer: %v, %v",
- err.Digest, err.Reason)
-}
-
-// ErrBlobMounted returned when a blob is mounted from another repository
-// instead of initiating an upload session.
-type ErrBlobMounted struct {
- From reference.Canonical
- Descriptor Descriptor
-}
-
-func (err ErrBlobMounted) Error() string {
- return fmt.Sprintf("blob mounted from: %v to: %v",
- err.From, err.Descriptor)
-}
-
-// Descriptor describes targeted content. Used in conjunction with a blob
-// store, a descriptor can be used to fetch, store and target any kind of
-// blob. The struct also describes the wire protocol format. Fields should
-// only be added but never changed.
-type Descriptor struct {
- // MediaType describe the type of the content. All text based formats are
- // encoded as utf-8.
- MediaType string `json:"mediaType,omitempty"`
-
- // Size in bytes of content.
- Size int64 `json:"size,omitempty"`
-
- // Digest uniquely identifies the content. A byte stream can be verified
- // against this digest.
- Digest digest.Digest `json:"digest,omitempty"`
-
- // URLs contains the source URLs of this content.
- URLs []string `json:"urls,omitempty"`
-
- // Annotations contains arbitrary metadata relating to the targeted content.
- Annotations map[string]string `json:"annotations,omitempty"`
-
- // Platform describes the platform which the image in the manifest runs on.
- // This should only be used when referring to a manifest.
- Platform *v1.Platform `json:"platform,omitempty"`
-
- // NOTE: Before adding a field here, please ensure that all
- // other options have been exhausted. Much of the type relationships
- // depend on the simplicity of this type.
-}
-
-// Descriptor returns the descriptor, to make it satisfy the Describable
-// interface. Note that implementations of Describable are generally objects
-// which can be described, not simply descriptors; this exception is in place
-// to make it more convenient to pass actual descriptors to functions that
-// expect Describable objects.
-func (d Descriptor) Descriptor() Descriptor {
- return d
-}
-
-// BlobStatter makes blob descriptors available by digest. The service may
-// provide a descriptor of a different digest if the provided digest is not
-// canonical.
-type BlobStatter interface {
- // Stat provides metadata about a blob identified by the digest. If the
- // blob is unknown to the describer, ErrBlobUnknown will be returned.
- Stat(ctx context.Context, dgst digest.Digest) (Descriptor, error)
-}
-
-// BlobDeleter enables deleting blobs from storage.
-type BlobDeleter interface {
- Delete(ctx context.Context, dgst digest.Digest) error
-}
-
-// BlobEnumerator enables iterating over blobs from storage
-type BlobEnumerator interface {
- Enumerate(ctx context.Context, ingester func(dgst digest.Digest) error) error
-}
-
-// BlobDescriptorService manages metadata about a blob by digest. Most
-// implementations will not expose such an interface explicitly. Such mappings
-// should be maintained by interacting with the BlobIngester. Hence, this is
-// left off of BlobService and BlobStore.
-type BlobDescriptorService interface {
- BlobStatter
-
- // SetDescriptor assigns the descriptor to the digest. The provided digest and
- // the digest in the descriptor must map to identical content but they may
- // differ on their algorithm. The descriptor must have the canonical
- // digest of the content and the digest algorithm must match the
- // annotators canonical algorithm.
- //
- // Such a facility can be used to map blobs between digest domains, with
- // the restriction that the algorithm of the descriptor must match the
- // canonical algorithm (ie sha256) of the annotator.
- SetDescriptor(ctx context.Context, dgst digest.Digest, desc Descriptor) error
-
- // Clear enables descriptors to be unlinked
- Clear(ctx context.Context, dgst digest.Digest) error
-}
-
-// BlobDescriptorServiceFactory creates middleware for BlobDescriptorService.
-type BlobDescriptorServiceFactory interface {
- BlobAccessController(svc BlobDescriptorService) BlobDescriptorService
-}
-
-// ReadSeekCloser is the primary reader type for blob data, combining
-// io.ReadSeeker with io.Closer.
-type ReadSeekCloser interface {
- io.ReadSeeker
- io.Closer
-}
-
-// BlobProvider describes operations for getting blob data.
-type BlobProvider interface {
- // Get returns the entire blob identified by digest along with the descriptor.
- Get(ctx context.Context, dgst digest.Digest) ([]byte, error)
-
- // Open provides a ReadSeekCloser to the blob identified by the provided
- // descriptor. If the blob is not known to the service, an error will be
- // returned.
- Open(ctx context.Context, dgst digest.Digest) (ReadSeekCloser, error)
-}
-
-// BlobServer can serve blobs via http.
-type BlobServer interface {
- // ServeBlob attempts to serve the blob, identified by dgst, via http. The
- // service may decide to redirect the client elsewhere or serve the data
- // directly.
- //
- // This handler only issues successful responses, such as 2xx or 3xx,
- // meaning it serves data or issues a redirect. If the blob is not
- // available, an error will be returned and the caller may still issue a
- // response.
- //
- // The implementation may serve the same blob from a different digest
- // domain. The appropriate headers will be set for the blob, unless they
- // have already been set by the caller.
- ServeBlob(ctx context.Context, w http.ResponseWriter, r *http.Request, dgst digest.Digest) error
-}
-
-// BlobIngester ingests blob data.
-type BlobIngester interface {
- // Put inserts the content p into the blob service, returning a descriptor
- // or an error.
- Put(ctx context.Context, mediaType string, p []byte) (Descriptor, error)
-
- // Create allocates a new blob writer to add a blob to this service. The
- // returned handle can be written to and later resumed using an opaque
- // identifier. With this approach, one can Close and Resume a BlobWriter
- // multiple times until the BlobWriter is committed or cancelled.
- Create(ctx context.Context, options ...BlobCreateOption) (BlobWriter, error)
-
- // Resume attempts to resume a write to a blob, identified by an id.
- Resume(ctx context.Context, id string) (BlobWriter, error)
-}
-
-// BlobCreateOption is a general extensible function argument for blob creation
-// methods. A BlobIngester may choose to honor any or none of the given
-// BlobCreateOptions, which can be specific to the implementation of the
-// BlobIngester receiving them.
-// TODO (brianbland): unify this with ManifestServiceOption in the future
-type BlobCreateOption interface {
- Apply(interface{}) error
-}
-
-// CreateOptions is a collection of blob creation modifiers relevant to general
-// blob storage intended to be configured by the BlobCreateOption.Apply method.
-type CreateOptions struct {
- Mount struct {
- ShouldMount bool
- From reference.Canonical
- // Stat allows to pass precalculated descriptor to link and return.
- // Blob access check will be skipped if set.
- Stat *Descriptor
- }
-}
-
-// BlobWriter provides a handle for inserting data into a blob store.
-// Instances should be obtained from BlobWriteService.Writer and
-// BlobWriteService.Resume. If supported by the store, a writer can be
-// recovered with the id.
-type BlobWriter interface {
- io.WriteCloser
- io.ReaderFrom
-
- // Size returns the number of bytes written to this blob.
- Size() int64
-
- // ID returns the identifier for this writer. The ID can be used with the
- // Blob service to later resume the write.
- ID() string
-
- // StartedAt returns the time this blob write was started.
- StartedAt() time.Time
-
- // Commit completes the blob writer process. The content is verified
- // against the provided provisional descriptor, which may result in an
- // error. Depending on the implementation, written data may be validated
- // against the provisional descriptor fields. If MediaType is not present,
- // the implementation may reject the commit or assign "application/octet-
- // stream" to the blob. The returned descriptor may have a different
- // digest depending on the blob store, referred to as the canonical
- // descriptor.
- Commit(ctx context.Context, provisional Descriptor) (canonical Descriptor, err error)
-
- // Cancel ends the blob write without storing any data and frees any
- // associated resources. Any data written thus far will be lost. Cancel
- // implementations should allow multiple calls even after a commit that
- // result in a no-op. This allows use of Cancel in a defer statement,
- // increasing the assurance that it is correctly called.
- Cancel(ctx context.Context) error
-}
-
-// BlobService combines the operations to access, read and write blobs. This
-// can be used to describe remote blob services.
-type BlobService interface {
- BlobStatter
- BlobProvider
- BlobIngester
-}
-
-// BlobStore represent the entire suite of blob related operations. Such an
-// implementation can access, read, write, delete and serve blobs.
-type BlobStore interface {
- BlobService
- BlobServer
- BlobDeleter
-}
diff --git a/vendor/github.com/docker/distribution/doc.go b/vendor/github.com/docker/distribution/doc.go
deleted file mode 100644
index bdd8cb708..000000000
--- a/vendor/github.com/docker/distribution/doc.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// Package distribution will define the interfaces for the components of
-// docker distribution. The goal is to allow users to reliably package, ship
-// and store content related to docker images.
-//
-// This is currently a work in progress. More details are available in the
-// README.md.
-package distribution
diff --git a/vendor/github.com/docker/distribution/docker-bake.hcl b/vendor/github.com/docker/distribution/docker-bake.hcl
deleted file mode 100644
index 4dd5a100c..000000000
--- a/vendor/github.com/docker/distribution/docker-bake.hcl
+++ /dev/null
@@ -1,65 +0,0 @@
-// GITHUB_REF is the actual ref that triggers the workflow
-// https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
-variable "GITHUB_REF" {
- default = ""
-}
-
-target "_common" {
- args = {
- GIT_REF = GITHUB_REF
- }
-}
-
-group "default" {
- targets = ["image-local"]
-}
-
-// Special target: https://github.com/docker/metadata-action#bake-definition
-target "docker-metadata-action" {
- tags = ["registry:local"]
-}
-
-target "binary" {
- inherits = ["_common"]
- target = "binary"
- output = ["./bin"]
-}
-
-target "artifact" {
- inherits = ["_common"]
- target = "artifact"
- output = ["./bin"]
-}
-
-target "artifact-all" {
- inherits = ["artifact"]
- platforms = [
- "linux/amd64",
- "linux/arm/v6",
- "linux/arm/v7",
- "linux/arm64",
- "linux/ppc64le",
- "linux/s390x"
- ]
-}
-
-target "image" {
- inherits = ["_common", "docker-metadata-action"]
-}
-
-target "image-local" {
- inherits = ["image"]
- output = ["type=docker"]
-}
-
-target "image-all" {
- inherits = ["image"]
- platforms = [
- "linux/amd64",
- "linux/arm/v6",
- "linux/arm/v7",
- "linux/arm64",
- "linux/ppc64le",
- "linux/s390x"
- ]
-}
diff --git a/vendor/github.com/docker/distribution/errors.go b/vendor/github.com/docker/distribution/errors.go
deleted file mode 100644
index 8e0b788d6..000000000
--- a/vendor/github.com/docker/distribution/errors.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package distribution
-
-import (
- "errors"
- "fmt"
- "strings"
-
- "github.com/opencontainers/go-digest"
-)
-
-// ErrAccessDenied is returned when an access to a requested resource is
-// denied.
-var ErrAccessDenied = errors.New("access denied")
-
-// ErrManifestNotModified is returned when a conditional manifest GetByTag
-// returns nil due to the client indicating it has the latest version
-var ErrManifestNotModified = errors.New("manifest not modified")
-
-// ErrUnsupported is returned when an unimplemented or unsupported action is
-// performed
-var ErrUnsupported = errors.New("operation unsupported")
-
-// ErrSchemaV1Unsupported is returned when a client tries to upload a schema v1
-// manifest but the registry is configured to reject it
-var ErrSchemaV1Unsupported = errors.New("manifest schema v1 unsupported")
-
-// ErrTagUnknown is returned if the given tag is not known by the tag service
-type ErrTagUnknown struct {
- Tag string
-}
-
-func (err ErrTagUnknown) Error() string {
- return fmt.Sprintf("unknown tag=%s", err.Tag)
-}
-
-// ErrRepositoryUnknown is returned if the named repository is not known by
-// the registry.
-type ErrRepositoryUnknown struct {
- Name string
-}
-
-func (err ErrRepositoryUnknown) Error() string {
- return fmt.Sprintf("unknown repository name=%s", err.Name)
-}
-
-// ErrRepositoryNameInvalid should be used to denote an invalid repository
-// name. Reason may set, indicating the cause of invalidity.
-type ErrRepositoryNameInvalid struct {
- Name string
- Reason error
-}
-
-func (err ErrRepositoryNameInvalid) Error() string {
- return fmt.Sprintf("repository name %q invalid: %v", err.Name, err.Reason)
-}
-
-// ErrManifestUnknown is returned if the manifest is not known by the
-// registry.
-type ErrManifestUnknown struct {
- Name string
- Tag string
-}
-
-func (err ErrManifestUnknown) Error() string {
- return fmt.Sprintf("unknown manifest name=%s tag=%s", err.Name, err.Tag)
-}
-
-// ErrManifestUnknownRevision is returned when a manifest cannot be found by
-// revision within a repository.
-type ErrManifestUnknownRevision struct {
- Name string
- Revision digest.Digest
-}
-
-func (err ErrManifestUnknownRevision) Error() string {
- return fmt.Sprintf("unknown manifest name=%s revision=%s", err.Name, err.Revision)
-}
-
-// ErrManifestUnverified is returned when the registry is unable to verify
-// the manifest.
-type ErrManifestUnverified struct{}
-
-func (ErrManifestUnverified) Error() string {
- return "unverified manifest"
-}
-
-// ErrManifestVerification provides a type to collect errors encountered
-// during manifest verification. Currently, it accepts errors of all types,
-// but it may be narrowed to those involving manifest verification.
-type ErrManifestVerification []error
-
-func (errs ErrManifestVerification) Error() string {
- var parts []string
- for _, err := range errs {
- parts = append(parts, err.Error())
- }
-
- return fmt.Sprintf("errors verifying manifest: %v", strings.Join(parts, ","))
-}
-
-// ErrManifestBlobUnknown returned when a referenced blob cannot be found.
-type ErrManifestBlobUnknown struct {
- Digest digest.Digest
-}
-
-func (err ErrManifestBlobUnknown) Error() string {
- return fmt.Sprintf("unknown blob %v on manifest", err.Digest)
-}
-
-// ErrManifestNameInvalid should be used to denote an invalid manifest
-// name. Reason may set, indicating the cause of invalidity.
-type ErrManifestNameInvalid struct {
- Name string
- Reason error
-}
-
-func (err ErrManifestNameInvalid) Error() string {
- return fmt.Sprintf("manifest name %q invalid: %v", err.Name, err.Reason)
-}
diff --git a/vendor/github.com/docker/distribution/manifests.go b/vendor/github.com/docker/distribution/manifests.go
deleted file mode 100644
index 8f84a220a..000000000
--- a/vendor/github.com/docker/distribution/manifests.go
+++ /dev/null
@@ -1,125 +0,0 @@
-package distribution
-
-import (
- "context"
- "fmt"
- "mime"
-
- "github.com/opencontainers/go-digest"
-)
-
-// Manifest represents a registry object specifying a set of
-// references and an optional target
-type Manifest interface {
- // References returns a list of objects which make up this manifest.
- // A reference is anything which can be represented by a
- // distribution.Descriptor. These can consist of layers, resources or other
- // manifests.
- //
- // While no particular order is required, implementations should return
- // them from highest to lowest priority. For example, one might want to
- // return the base layer before the top layer.
- References() []Descriptor
-
- // Payload provides the serialized format of the manifest, in addition to
- // the media type.
- Payload() (mediaType string, payload []byte, err error)
-}
-
-// ManifestBuilder creates a manifest allowing one to include dependencies.
-// Instances can be obtained from a version-specific manifest package. Manifest
-// specific data is passed into the function which creates the builder.
-type ManifestBuilder interface {
- // Build creates the manifest from his builder.
- Build(ctx context.Context) (Manifest, error)
-
- // References returns a list of objects which have been added to this
- // builder. The dependencies are returned in the order they were added,
- // which should be from base to head.
- References() []Descriptor
-
- // AppendReference includes the given object in the manifest after any
- // existing dependencies. If the add fails, such as when adding an
- // unsupported dependency, an error may be returned.
- //
- // The destination of the reference is dependent on the manifest type and
- // the dependency type.
- AppendReference(dependency Describable) error
-}
-
-// ManifestService describes operations on image manifests.
-type ManifestService interface {
- // Exists returns true if the manifest exists.
- Exists(ctx context.Context, dgst digest.Digest) (bool, error)
-
- // Get retrieves the manifest specified by the given digest
- Get(ctx context.Context, dgst digest.Digest, options ...ManifestServiceOption) (Manifest, error)
-
- // Put creates or updates the given manifest returning the manifest digest
- Put(ctx context.Context, manifest Manifest, options ...ManifestServiceOption) (digest.Digest, error)
-
- // Delete removes the manifest specified by the given digest. Deleting
- // a manifest that doesn't exist will return ErrManifestNotFound
- Delete(ctx context.Context, dgst digest.Digest) error
-}
-
-// ManifestEnumerator enables iterating over manifests
-type ManifestEnumerator interface {
- // Enumerate calls ingester for each manifest.
- Enumerate(ctx context.Context, ingester func(digest.Digest) error) error
-}
-
-// Describable is an interface for descriptors
-type Describable interface {
- Descriptor() Descriptor
-}
-
-// ManifestMediaTypes returns the supported media types for manifests.
-func ManifestMediaTypes() (mediaTypes []string) {
- for t := range mappings {
- if t != "" {
- mediaTypes = append(mediaTypes, t)
- }
- }
- return
-}
-
-// UnmarshalFunc implements manifest unmarshalling a given MediaType
-type UnmarshalFunc func([]byte) (Manifest, Descriptor, error)
-
-var mappings = make(map[string]UnmarshalFunc)
-
-// UnmarshalManifest looks up manifest unmarshal functions based on
-// MediaType
-func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
- // Need to look up by the actual media type, not the raw contents of
- // the header. Strip semicolons and anything following them.
- var mediaType string
- if ctHeader != "" {
- var err error
- mediaType, _, err = mime.ParseMediaType(ctHeader)
- if err != nil {
- return nil, Descriptor{}, err
- }
- }
-
- unmarshalFunc, ok := mappings[mediaType]
- if !ok {
- unmarshalFunc, ok = mappings[""]
- if !ok {
- return nil, Descriptor{}, fmt.Errorf("unsupported manifest media type and no default available: %s", mediaType)
- }
- }
-
- return unmarshalFunc(p)
-}
-
-// RegisterManifestSchema registers an UnmarshalFunc for a given schema type. This
-// should be called from specific
-func RegisterManifestSchema(mediaType string, u UnmarshalFunc) error {
- if _, ok := mappings[mediaType]; ok {
- return fmt.Errorf("manifest media type registration would overwrite existing: %s", mediaType)
- }
- mappings[mediaType] = u
- return nil
-}
diff --git a/vendor/github.com/docker/distribution/metrics/prometheus.go b/vendor/github.com/docker/distribution/metrics/prometheus.go
deleted file mode 100644
index b5a532144..000000000
--- a/vendor/github.com/docker/distribution/metrics/prometheus.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package metrics
-
-import "github.com/docker/go-metrics"
-
-const (
- // NamespacePrefix is the namespace of prometheus metrics
- NamespacePrefix = "registry"
-)
-
-var (
- // StorageNamespace is the prometheus namespace of blob/cache related operations
- StorageNamespace = metrics.NewNamespace(NamespacePrefix, "storage", nil)
-)
diff --git a/vendor/github.com/docker/distribution/registry.go b/vendor/github.com/docker/distribution/registry.go
deleted file mode 100644
index 6c3210989..000000000
--- a/vendor/github.com/docker/distribution/registry.go
+++ /dev/null
@@ -1,118 +0,0 @@
-package distribution
-
-import (
- "context"
-
- "github.com/docker/distribution/reference"
-)
-
-// Scope defines the set of items that match a namespace.
-type Scope interface {
- // Contains returns true if the name belongs to the namespace.
- Contains(name string) bool
-}
-
-type fullScope struct{}
-
-func (f fullScope) Contains(string) bool {
- return true
-}
-
-// GlobalScope represents the full namespace scope which contains
-// all other scopes.
-var GlobalScope = Scope(fullScope{})
-
-// Namespace represents a collection of repositories, addressable by name.
-// Generally, a namespace is backed by a set of one or more services,
-// providing facilities such as registry access, trust, and indexing.
-type Namespace interface {
- // Scope describes the names that can be used with this Namespace. The
- // global namespace will have a scope that matches all names. The scope
- // effectively provides an identity for the namespace.
- Scope() Scope
-
- // Repository should return a reference to the named repository. The
- // registry may or may not have the repository but should always return a
- // reference.
- Repository(ctx context.Context, name reference.Named) (Repository, error)
-
- // Repositories fills 'repos' with a lexicographically sorted catalog of repositories
- // up to the size of 'repos' and returns the value 'n' for the number of entries
- // which were filled. 'last' contains an offset in the catalog, and 'err' will be
- // set to io.EOF if there are no more entries to obtain.
- Repositories(ctx context.Context, repos []string, last string) (n int, err error)
-
- // Blobs returns a blob enumerator to access all blobs
- Blobs() BlobEnumerator
-
- // BlobStatter returns a BlobStatter to control
- BlobStatter() BlobStatter
-}
-
-// RepositoryEnumerator describes an operation to enumerate repositories
-type RepositoryEnumerator interface {
- Enumerate(ctx context.Context, ingester func(string) error) error
-}
-
-// RepositoryRemover removes given repository
-type RepositoryRemover interface {
- Remove(ctx context.Context, name reference.Named) error
-}
-
-// ManifestServiceOption is a function argument for Manifest Service methods
-type ManifestServiceOption interface {
- Apply(ManifestService) error
-}
-
-// WithTag allows a tag to be passed into Put
-func WithTag(tag string) ManifestServiceOption {
- return WithTagOption{tag}
-}
-
-// WithTagOption holds a tag
-type WithTagOption struct{ Tag string }
-
-// Apply conforms to the ManifestServiceOption interface
-func (o WithTagOption) Apply(m ManifestService) error {
- // no implementation
- return nil
-}
-
-// WithManifestMediaTypes lists the media types the client wishes
-// the server to provide.
-func WithManifestMediaTypes(mediaTypes []string) ManifestServiceOption {
- return WithManifestMediaTypesOption{mediaTypes}
-}
-
-// WithManifestMediaTypesOption holds a list of accepted media types
-type WithManifestMediaTypesOption struct{ MediaTypes []string }
-
-// Apply conforms to the ManifestServiceOption interface
-func (o WithManifestMediaTypesOption) Apply(m ManifestService) error {
- // no implementation
- return nil
-}
-
-// Repository is a named collection of manifests and layers.
-type Repository interface {
- // Named returns the name of the repository.
- Named() reference.Named
-
- // Manifests returns a reference to this repository's manifest service.
- // with the supplied options applied.
- Manifests(ctx context.Context, options ...ManifestServiceOption) (ManifestService, error)
-
- // Blobs returns a reference to this repository's blob service.
- Blobs(ctx context.Context) BlobStore
-
- // TODO(stevvooe): The above BlobStore return can probably be relaxed to
- // be a BlobService for use with clients. This will allow such
- // implementations to avoid implementing ServeBlob.
-
- // Tags returns a reference to this repositories tag service
- Tags(ctx context.Context) TagService
-}
-
-// TODO(stevvooe): Must add close methods to all these. May want to change the
-// way instances are created to better reflect internal dependency
-// relationships.
diff --git a/vendor/github.com/docker/distribution/registry/client/blob_writer.go b/vendor/github.com/docker/distribution/registry/client/blob_writer.go
deleted file mode 100644
index 695bf852f..000000000
--- a/vendor/github.com/docker/distribution/registry/client/blob_writer.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package client
-
-import (
- "bytes"
- "context"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "time"
-
- "github.com/docker/distribution"
-)
-
-type httpBlobUpload struct {
- statter distribution.BlobStatter
- client *http.Client
-
- uuid string
- startedAt time.Time
-
- location string // always the last value of the location header.
- offset int64
- closed bool
-}
-
-func (hbu *httpBlobUpload) Reader() (io.ReadCloser, error) {
- panic("Not implemented")
-}
-
-func (hbu *httpBlobUpload) handleErrorResponse(resp *http.Response) error {
- if resp.StatusCode == http.StatusNotFound {
- return distribution.ErrBlobUploadUnknown
- }
- return HandleErrorResponse(resp)
-}
-
-func (hbu *httpBlobUpload) ReadFrom(r io.Reader) (n int64, err error) {
- req, err := http.NewRequest("PATCH", hbu.location, ioutil.NopCloser(r))
- if err != nil {
- return 0, err
- }
- defer req.Body.Close()
-
- resp, err := hbu.client.Do(req)
- if err != nil {
- return 0, err
- }
-
- if !SuccessStatus(resp.StatusCode) {
- return 0, hbu.handleErrorResponse(resp)
- }
-
- hbu.uuid = resp.Header.Get("Docker-Upload-UUID")
- hbu.location, err = sanitizeLocation(resp.Header.Get("Location"), hbu.location)
- if err != nil {
- return 0, err
- }
- rng := resp.Header.Get("Range")
- var start, end int64
- if n, err := fmt.Sscanf(rng, "%d-%d", &start, &end); err != nil {
- return 0, err
- } else if n != 2 || end < start {
- return 0, fmt.Errorf("bad range format: %s", rng)
- }
-
- return (end - start + 1), nil
-
-}
-
-func (hbu *httpBlobUpload) Write(p []byte) (n int, err error) {
- req, err := http.NewRequest("PATCH", hbu.location, bytes.NewReader(p))
- if err != nil {
- return 0, err
- }
- req.Header.Set("Content-Range", fmt.Sprintf("%d-%d", hbu.offset, hbu.offset+int64(len(p)-1)))
- req.Header.Set("Content-Length", fmt.Sprintf("%d", len(p)))
- req.Header.Set("Content-Type", "application/octet-stream")
-
- resp, err := hbu.client.Do(req)
- if err != nil {
- return 0, err
- }
-
- if !SuccessStatus(resp.StatusCode) {
- return 0, hbu.handleErrorResponse(resp)
- }
-
- hbu.uuid = resp.Header.Get("Docker-Upload-UUID")
- hbu.location, err = sanitizeLocation(resp.Header.Get("Location"), hbu.location)
- if err != nil {
- return 0, err
- }
- rng := resp.Header.Get("Range")
- var start, end int
- if n, err := fmt.Sscanf(rng, "%d-%d", &start, &end); err != nil {
- return 0, err
- } else if n != 2 || end < start {
- return 0, fmt.Errorf("bad range format: %s", rng)
- }
-
- return (end - start + 1), nil
-
-}
-
-func (hbu *httpBlobUpload) Size() int64 {
- return hbu.offset
-}
-
-func (hbu *httpBlobUpload) ID() string {
- return hbu.uuid
-}
-
-func (hbu *httpBlobUpload) StartedAt() time.Time {
- return hbu.startedAt
-}
-
-func (hbu *httpBlobUpload) Commit(ctx context.Context, desc distribution.Descriptor) (distribution.Descriptor, error) {
- // TODO(dmcgowan): Check if already finished, if so just fetch
- req, err := http.NewRequest("PUT", hbu.location, nil)
- if err != nil {
- return distribution.Descriptor{}, err
- }
-
- values := req.URL.Query()
- values.Set("digest", desc.Digest.String())
- req.URL.RawQuery = values.Encode()
-
- resp, err := hbu.client.Do(req)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- defer resp.Body.Close()
-
- if !SuccessStatus(resp.StatusCode) {
- return distribution.Descriptor{}, hbu.handleErrorResponse(resp)
- }
-
- return hbu.statter.Stat(ctx, desc.Digest)
-}
-
-func (hbu *httpBlobUpload) Cancel(ctx context.Context) error {
- req, err := http.NewRequest("DELETE", hbu.location, nil)
- if err != nil {
- return err
- }
- resp, err := hbu.client.Do(req)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
-
- if resp.StatusCode == http.StatusNotFound || SuccessStatus(resp.StatusCode) {
- return nil
- }
- return hbu.handleErrorResponse(resp)
-}
-
-func (hbu *httpBlobUpload) Close() error {
- hbu.closed = true
- return nil
-}
diff --git a/vendor/github.com/docker/distribution/registry/client/errors.go b/vendor/github.com/docker/distribution/registry/client/errors.go
deleted file mode 100644
index 52d49d5d2..000000000
--- a/vendor/github.com/docker/distribution/registry/client/errors.go
+++ /dev/null
@@ -1,139 +0,0 @@
-package client
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
-
- "github.com/docker/distribution/registry/api/errcode"
- "github.com/docker/distribution/registry/client/auth/challenge"
-)
-
-// ErrNoErrorsInBody is returned when an HTTP response body parses to an empty
-// errcode.Errors slice.
-var ErrNoErrorsInBody = errors.New("no error details found in HTTP response body")
-
-// UnexpectedHTTPStatusError is returned when an unexpected HTTP status is
-// returned when making a registry api call.
-type UnexpectedHTTPStatusError struct {
- Status string
-}
-
-func (e *UnexpectedHTTPStatusError) Error() string {
- return fmt.Sprintf("received unexpected HTTP status: %s", e.Status)
-}
-
-// UnexpectedHTTPResponseError is returned when an expected HTTP status code
-// is returned, but the content was unexpected and failed to be parsed.
-type UnexpectedHTTPResponseError struct {
- ParseErr error
- StatusCode int
- Response []byte
-}
-
-func (e *UnexpectedHTTPResponseError) Error() string {
- return fmt.Sprintf("error parsing HTTP %d response body: %s: %q", e.StatusCode, e.ParseErr.Error(), string(e.Response))
-}
-
-func parseHTTPErrorResponse(statusCode int, r io.Reader) error {
- var errors errcode.Errors
- body, err := ioutil.ReadAll(r)
- if err != nil {
- return err
- }
-
- // For backward compatibility, handle irregularly formatted
- // messages that contain a "details" field.
- var detailsErr struct {
- Details string `json:"details"`
- }
- err = json.Unmarshal(body, &detailsErr)
- if err == nil && detailsErr.Details != "" {
- switch statusCode {
- case http.StatusUnauthorized:
- return errcode.ErrorCodeUnauthorized.WithMessage(detailsErr.Details)
- case http.StatusTooManyRequests:
- return errcode.ErrorCodeTooManyRequests.WithMessage(detailsErr.Details)
- default:
- return errcode.ErrorCodeUnknown.WithMessage(detailsErr.Details)
- }
- }
-
- if err := json.Unmarshal(body, &errors); err != nil {
- return &UnexpectedHTTPResponseError{
- ParseErr: err,
- StatusCode: statusCode,
- Response: body,
- }
- }
-
- if len(errors) == 0 {
- // If there was no error specified in the body, return
- // UnexpectedHTTPResponseError.
- return &UnexpectedHTTPResponseError{
- ParseErr: ErrNoErrorsInBody,
- StatusCode: statusCode,
- Response: body,
- }
- }
-
- return errors
-}
-
-func makeErrorList(err error) []error {
- if errL, ok := err.(errcode.Errors); ok {
- return []error(errL)
- }
- return []error{err}
-}
-
-func mergeErrors(err1, err2 error) error {
- return errcode.Errors(append(makeErrorList(err1), makeErrorList(err2)...))
-}
-
-// HandleErrorResponse returns error parsed from HTTP response for an
-// unsuccessful HTTP response code (in the range 400 - 499 inclusive). An
-// UnexpectedHTTPStatusError returned for response code outside of expected
-// range.
-func HandleErrorResponse(resp *http.Response) error {
- if resp.StatusCode >= 400 && resp.StatusCode < 500 {
- // Check for OAuth errors within the `WWW-Authenticate` header first
- // See https://tools.ietf.org/html/rfc6750#section-3
- for _, c := range challenge.ResponseChallenges(resp) {
- if c.Scheme == "bearer" {
- var err errcode.Error
- // codes defined at https://tools.ietf.org/html/rfc6750#section-3.1
- switch c.Parameters["error"] {
- case "invalid_token":
- err.Code = errcode.ErrorCodeUnauthorized
- case "insufficient_scope":
- err.Code = errcode.ErrorCodeDenied
- default:
- continue
- }
- if description := c.Parameters["error_description"]; description != "" {
- err.Message = description
- } else {
- err.Message = err.Code.Message()
- }
-
- return mergeErrors(err, parseHTTPErrorResponse(resp.StatusCode, resp.Body))
- }
- }
- err := parseHTTPErrorResponse(resp.StatusCode, resp.Body)
- if uErr, ok := err.(*UnexpectedHTTPResponseError); ok && resp.StatusCode == 401 {
- return errcode.ErrorCodeUnauthorized.WithDetail(uErr.Response)
- }
- return err
- }
- return &UnexpectedHTTPStatusError{Status: resp.Status}
-}
-
-// SuccessStatus returns true if the argument is a successful HTTP response
-// code (in the range 200 - 399 inclusive).
-func SuccessStatus(status int) bool {
- return status >= 200 && status <= 399
-}
diff --git a/vendor/github.com/docker/distribution/registry/client/repository.go b/vendor/github.com/docker/distribution/registry/client/repository.go
deleted file mode 100644
index 3e2ae66d3..000000000
--- a/vendor/github.com/docker/distribution/registry/client/repository.go
+++ /dev/null
@@ -1,872 +0,0 @@
-package client
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/docker/distribution"
- "github.com/docker/distribution/reference"
- v2 "github.com/docker/distribution/registry/api/v2"
- "github.com/docker/distribution/registry/client/transport"
- "github.com/docker/distribution/registry/storage/cache"
- "github.com/docker/distribution/registry/storage/cache/memory"
- "github.com/opencontainers/go-digest"
-)
-
-// Registry provides an interface for calling Repositories, which returns a catalog of repositories.
-type Registry interface {
- Repositories(ctx context.Context, repos []string, last string) (n int, err error)
-}
-
-// checkHTTPRedirect is a callback that can manipulate redirected HTTP
-// requests. It is used to preserve Accept and Range headers.
-func checkHTTPRedirect(req *http.Request, via []*http.Request) error {
- if len(via) >= 10 {
- return errors.New("stopped after 10 redirects")
- }
-
- if len(via) > 0 {
- for headerName, headerVals := range via[0].Header {
- if headerName != "Accept" && headerName != "Range" {
- continue
- }
- for _, val := range headerVals {
- // Don't add to redirected request if redirected
- // request already has a header with the same
- // name and value.
- hasValue := false
- for _, existingVal := range req.Header[headerName] {
- if existingVal == val {
- hasValue = true
- break
- }
- }
- if !hasValue {
- req.Header.Add(headerName, val)
- }
- }
- }
- }
-
- return nil
-}
-
-// NewRegistry creates a registry namespace which can be used to get a listing of repositories
-func NewRegistry(baseURL string, transport http.RoundTripper) (Registry, error) {
- ub, err := v2.NewURLBuilderFromString(baseURL, false)
- if err != nil {
- return nil, err
- }
-
- client := &http.Client{
- Transport: transport,
- Timeout: 1 * time.Minute,
- CheckRedirect: checkHTTPRedirect,
- }
-
- return &registry{
- client: client,
- ub: ub,
- }, nil
-}
-
-type registry struct {
- client *http.Client
- ub *v2.URLBuilder
-}
-
-// Repositories returns a lexigraphically sorted catalog given a base URL. The 'entries' slice will be filled up to the size
-// of the slice, starting at the value provided in 'last'. The number of entries will be returned along with io.EOF if there
-// are no more entries
-func (r *registry) Repositories(ctx context.Context, entries []string, last string) (int, error) {
- var numFilled int
- var returnErr error
-
- values := buildCatalogValues(len(entries), last)
- u, err := r.ub.BuildCatalogURL(values)
- if err != nil {
- return 0, err
- }
-
- resp, err := r.client.Get(u)
- if err != nil {
- return 0, err
- }
- defer resp.Body.Close()
-
- if SuccessStatus(resp.StatusCode) {
- var ctlg struct {
- Repositories []string `json:"repositories"`
- }
- decoder := json.NewDecoder(resp.Body)
-
- if err := decoder.Decode(&ctlg); err != nil {
- return 0, err
- }
-
- for cnt := range ctlg.Repositories {
- entries[cnt] = ctlg.Repositories[cnt]
- }
- numFilled = len(ctlg.Repositories)
-
- link := resp.Header.Get("Link")
- if link == "" {
- returnErr = io.EOF
- }
- } else {
- return 0, HandleErrorResponse(resp)
- }
-
- return numFilled, returnErr
-}
-
-// NewRepository creates a new Repository for the given repository name and base URL.
-func NewRepository(name reference.Named, baseURL string, transport http.RoundTripper) (distribution.Repository, error) {
- ub, err := v2.NewURLBuilderFromString(baseURL, false)
- if err != nil {
- return nil, err
- }
-
- client := &http.Client{
- Transport: transport,
- CheckRedirect: checkHTTPRedirect,
- // TODO(dmcgowan): create cookie jar
- }
-
- return &repository{
- client: client,
- ub: ub,
- name: name,
- }, nil
-}
-
-type repository struct {
- client *http.Client
- ub *v2.URLBuilder
- name reference.Named
-}
-
-func (r *repository) Named() reference.Named {
- return r.name
-}
-
-func (r *repository) Blobs(ctx context.Context) distribution.BlobStore {
- statter := &blobStatter{
- name: r.name,
- ub: r.ub,
- client: r.client,
- }
- return &blobs{
- name: r.name,
- ub: r.ub,
- client: r.client,
- statter: cache.NewCachedBlobStatter(memory.NewInMemoryBlobDescriptorCacheProvider(), statter),
- }
-}
-
-func (r *repository) Manifests(ctx context.Context, options ...distribution.ManifestServiceOption) (distribution.ManifestService, error) {
- // todo(richardscothern): options should be sent over the wire
- return &manifests{
- name: r.name,
- ub: r.ub,
- client: r.client,
- etags: make(map[string]string),
- }, nil
-}
-
-func (r *repository) Tags(ctx context.Context) distribution.TagService {
- return &tags{
- client: r.client,
- ub: r.ub,
- name: r.Named(),
- }
-}
-
-// tags implements remote tagging operations.
-type tags struct {
- client *http.Client
- ub *v2.URLBuilder
- name reference.Named
-}
-
-// All returns all tags
-func (t *tags) All(ctx context.Context) ([]string, error) {
- var tags []string
-
- listURLStr, err := t.ub.BuildTagsURL(t.name)
- if err != nil {
- return tags, err
- }
-
- listURL, err := url.Parse(listURLStr)
- if err != nil {
- return tags, err
- }
-
- for {
- resp, err := t.client.Get(listURL.String())
- if err != nil {
- return tags, err
- }
- defer resp.Body.Close()
-
- if SuccessStatus(resp.StatusCode) {
- b, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return tags, err
- }
-
- tagsResponse := struct {
- Tags []string `json:"tags"`
- }{}
- if err := json.Unmarshal(b, &tagsResponse); err != nil {
- return tags, err
- }
- tags = append(tags, tagsResponse.Tags...)
- if link := resp.Header.Get("Link"); link != "" {
- linkURLStr := strings.Trim(strings.Split(link, ";")[0], "<>")
- linkURL, err := url.Parse(linkURLStr)
- if err != nil {
- return tags, err
- }
-
- listURL = listURL.ResolveReference(linkURL)
- } else {
- return tags, nil
- }
- } else {
- return tags, HandleErrorResponse(resp)
- }
- }
-}
-
-func descriptorFromResponse(response *http.Response) (distribution.Descriptor, error) {
- desc := distribution.Descriptor{}
- headers := response.Header
-
- ctHeader := headers.Get("Content-Type")
- if ctHeader == "" {
- return distribution.Descriptor{}, errors.New("missing or empty Content-Type header")
- }
- desc.MediaType = ctHeader
-
- digestHeader := headers.Get("Docker-Content-Digest")
- if digestHeader == "" {
- bytes, err := ioutil.ReadAll(response.Body)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- _, desc, err := distribution.UnmarshalManifest(ctHeader, bytes)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- return desc, nil
- }
-
- dgst, err := digest.Parse(digestHeader)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- desc.Digest = dgst
-
- lengthHeader := headers.Get("Content-Length")
- if lengthHeader == "" {
- return distribution.Descriptor{}, errors.New("missing or empty Content-Length header")
- }
- length, err := strconv.ParseInt(lengthHeader, 10, 64)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- desc.Size = length
-
- return desc, nil
-
-}
-
-// Get issues a HEAD request for a Manifest against its named endpoint in order
-// to construct a descriptor for the tag. If the registry doesn't support HEADing
-// a manifest, fallback to GET.
-func (t *tags) Get(ctx context.Context, tag string) (distribution.Descriptor, error) {
- ref, err := reference.WithTag(t.name, tag)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- u, err := t.ub.BuildManifestURL(ref)
- if err != nil {
- return distribution.Descriptor{}, err
- }
-
- newRequest := func(method string) (*http.Response, error) {
- req, err := http.NewRequest(method, u, nil)
- if err != nil {
- return nil, err
- }
-
- for _, t := range distribution.ManifestMediaTypes() {
- req.Header.Add("Accept", t)
- }
- resp, err := t.client.Do(req)
- return resp, err
- }
-
- resp, err := newRequest("HEAD")
- if err != nil {
- return distribution.Descriptor{}, err
- }
- defer resp.Body.Close()
-
- switch {
- case resp.StatusCode >= 200 && resp.StatusCode < 400 && len(resp.Header.Get("Docker-Content-Digest")) > 0:
- // if the response is a success AND a Docker-Content-Digest can be retrieved from the headers
- return descriptorFromResponse(resp)
- default:
- // if the response is an error - there will be no body to decode.
- // Issue a GET request:
- // - for data from a server that does not handle HEAD
- // - to get error details in case of a failure
- resp, err = newRequest("GET")
- if err != nil {
- return distribution.Descriptor{}, err
- }
- defer resp.Body.Close()
-
- if resp.StatusCode >= 200 && resp.StatusCode < 400 {
- return descriptorFromResponse(resp)
- }
- return distribution.Descriptor{}, HandleErrorResponse(resp)
- }
-}
-
-func (t *tags) Lookup(ctx context.Context, digest distribution.Descriptor) ([]string, error) {
- panic("not implemented")
-}
-
-func (t *tags) Tag(ctx context.Context, tag string, desc distribution.Descriptor) error {
- panic("not implemented")
-}
-
-func (t *tags) Untag(ctx context.Context, tag string) error {
- panic("not implemented")
-}
-
-type manifests struct {
- name reference.Named
- ub *v2.URLBuilder
- client *http.Client
- etags map[string]string
-}
-
-func (ms *manifests) Exists(ctx context.Context, dgst digest.Digest) (bool, error) {
- ref, err := reference.WithDigest(ms.name, dgst)
- if err != nil {
- return false, err
- }
- u, err := ms.ub.BuildManifestURL(ref)
- if err != nil {
- return false, err
- }
-
- resp, err := ms.client.Head(u)
- if err != nil {
- return false, err
- }
-
- if SuccessStatus(resp.StatusCode) {
- return true, nil
- } else if resp.StatusCode == http.StatusNotFound {
- return false, nil
- }
- return false, HandleErrorResponse(resp)
-}
-
-// AddEtagToTag allows a client to supply an eTag to Get which will be
-// used for a conditional HTTP request. If the eTag matches, a nil manifest
-// and ErrManifestNotModified error will be returned. etag is automatically
-// quoted when added to this map.
-func AddEtagToTag(tag, etag string) distribution.ManifestServiceOption {
- return etagOption{tag, etag}
-}
-
-type etagOption struct{ tag, etag string }
-
-func (o etagOption) Apply(ms distribution.ManifestService) error {
- if ms, ok := ms.(*manifests); ok {
- ms.etags[o.tag] = fmt.Sprintf(`"%s"`, o.etag)
- return nil
- }
- return fmt.Errorf("etag options is a client-only option")
-}
-
-// ReturnContentDigest allows a client to set a the content digest on
-// a successful request from the 'Docker-Content-Digest' header. This
-// returned digest is represents the digest which the registry uses
-// to refer to the content and can be used to delete the content.
-func ReturnContentDigest(dgst *digest.Digest) distribution.ManifestServiceOption {
- return contentDigestOption{dgst}
-}
-
-type contentDigestOption struct{ digest *digest.Digest }
-
-func (o contentDigestOption) Apply(ms distribution.ManifestService) error {
- return nil
-}
-
-func (ms *manifests) Get(ctx context.Context, dgst digest.Digest, options ...distribution.ManifestServiceOption) (distribution.Manifest, error) {
- var (
- digestOrTag string
- ref reference.Named
- err error
- contentDgst *digest.Digest
- mediaTypes []string
- )
-
- for _, option := range options {
- switch opt := option.(type) {
- case distribution.WithTagOption:
- digestOrTag = opt.Tag
- ref, err = reference.WithTag(ms.name, opt.Tag)
- if err != nil {
- return nil, err
- }
- case contentDigestOption:
- contentDgst = opt.digest
- case distribution.WithManifestMediaTypesOption:
- mediaTypes = opt.MediaTypes
- default:
- err := option.Apply(ms)
- if err != nil {
- return nil, err
- }
- }
- }
-
- if digestOrTag == "" {
- digestOrTag = dgst.String()
- ref, err = reference.WithDigest(ms.name, dgst)
- if err != nil {
- return nil, err
- }
- }
-
- if len(mediaTypes) == 0 {
- mediaTypes = distribution.ManifestMediaTypes()
- }
-
- u, err := ms.ub.BuildManifestURL(ref)
- if err != nil {
- return nil, err
- }
-
- req, err := http.NewRequest("GET", u, nil)
- if err != nil {
- return nil, err
- }
-
- for _, t := range mediaTypes {
- req.Header.Add("Accept", t)
- }
-
- if _, ok := ms.etags[digestOrTag]; ok {
- req.Header.Set("If-None-Match", ms.etags[digestOrTag])
- }
-
- resp, err := ms.client.Do(req)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
- if resp.StatusCode == http.StatusNotModified {
- return nil, distribution.ErrManifestNotModified
- } else if SuccessStatus(resp.StatusCode) {
- if contentDgst != nil {
- dgst, err := digest.Parse(resp.Header.Get("Docker-Content-Digest"))
- if err == nil {
- *contentDgst = dgst
- }
- }
- mt := resp.Header.Get("Content-Type")
- body, err := ioutil.ReadAll(resp.Body)
-
- if err != nil {
- return nil, err
- }
- m, _, err := distribution.UnmarshalManifest(mt, body)
- if err != nil {
- return nil, err
- }
- return m, nil
- }
- return nil, HandleErrorResponse(resp)
-}
-
-// Put puts a manifest. A tag can be specified using an options parameter which uses some shared state to hold the
-// tag name in order to build the correct upload URL.
-func (ms *manifests) Put(ctx context.Context, m distribution.Manifest, options ...distribution.ManifestServiceOption) (digest.Digest, error) {
- ref := ms.name
- var tagged bool
-
- for _, option := range options {
- if opt, ok := option.(distribution.WithTagOption); ok {
- var err error
- ref, err = reference.WithTag(ref, opt.Tag)
- if err != nil {
- return "", err
- }
- tagged = true
- } else {
- err := option.Apply(ms)
- if err != nil {
- return "", err
- }
- }
- }
- mediaType, p, err := m.Payload()
- if err != nil {
- return "", err
- }
-
- if !tagged {
- // generate a canonical digest and Put by digest
- _, d, err := distribution.UnmarshalManifest(mediaType, p)
- if err != nil {
- return "", err
- }
- ref, err = reference.WithDigest(ref, d.Digest)
- if err != nil {
- return "", err
- }
- }
-
- manifestURL, err := ms.ub.BuildManifestURL(ref)
- if err != nil {
- return "", err
- }
-
- putRequest, err := http.NewRequest("PUT", manifestURL, bytes.NewReader(p))
- if err != nil {
- return "", err
- }
-
- putRequest.Header.Set("Content-Type", mediaType)
-
- resp, err := ms.client.Do(putRequest)
- if err != nil {
- return "", err
- }
- defer resp.Body.Close()
-
- if SuccessStatus(resp.StatusCode) {
- dgstHeader := resp.Header.Get("Docker-Content-Digest")
- dgst, err := digest.Parse(dgstHeader)
- if err != nil {
- return "", err
- }
-
- return dgst, nil
- }
-
- return "", HandleErrorResponse(resp)
-}
-
-func (ms *manifests) Delete(ctx context.Context, dgst digest.Digest) error {
- ref, err := reference.WithDigest(ms.name, dgst)
- if err != nil {
- return err
- }
- u, err := ms.ub.BuildManifestURL(ref)
- if err != nil {
- return err
- }
- req, err := http.NewRequest("DELETE", u, nil)
- if err != nil {
- return err
- }
-
- resp, err := ms.client.Do(req)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
-
- if SuccessStatus(resp.StatusCode) {
- return nil
- }
- return HandleErrorResponse(resp)
-}
-
-// todo(richardscothern): Restore interface and implementation with merge of #1050
-/*func (ms *manifests) Enumerate(ctx context.Context, manifests []distribution.Manifest, last distribution.Manifest) (n int, err error) {
- panic("not supported")
-}*/
-
-type blobs struct {
- name reference.Named
- ub *v2.URLBuilder
- client *http.Client
-
- statter distribution.BlobDescriptorService
- distribution.BlobDeleter
-}
-
-func sanitizeLocation(location, base string) (string, error) {
- baseURL, err := url.Parse(base)
- if err != nil {
- return "", err
- }
-
- locationURL, err := url.Parse(location)
- if err != nil {
- return "", err
- }
-
- return baseURL.ResolveReference(locationURL).String(), nil
-}
-
-func (bs *blobs) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
- return bs.statter.Stat(ctx, dgst)
-
-}
-
-func (bs *blobs) Get(ctx context.Context, dgst digest.Digest) ([]byte, error) {
- reader, err := bs.Open(ctx, dgst)
- if err != nil {
- return nil, err
- }
- defer reader.Close()
-
- return ioutil.ReadAll(reader)
-}
-
-func (bs *blobs) Open(ctx context.Context, dgst digest.Digest) (distribution.ReadSeekCloser, error) {
- ref, err := reference.WithDigest(bs.name, dgst)
- if err != nil {
- return nil, err
- }
- blobURL, err := bs.ub.BuildBlobURL(ref)
- if err != nil {
- return nil, err
- }
-
- return transport.NewHTTPReadSeeker(bs.client, blobURL,
- func(resp *http.Response) error {
- if resp.StatusCode == http.StatusNotFound {
- return distribution.ErrBlobUnknown
- }
- return HandleErrorResponse(resp)
- }), nil
-}
-
-func (bs *blobs) ServeBlob(ctx context.Context, w http.ResponseWriter, r *http.Request, dgst digest.Digest) error {
- panic("not implemented")
-}
-
-func (bs *blobs) Put(ctx context.Context, mediaType string, p []byte) (distribution.Descriptor, error) {
- writer, err := bs.Create(ctx)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- dgstr := digest.Canonical.Digester()
- n, err := io.Copy(writer, io.TeeReader(bytes.NewReader(p), dgstr.Hash()))
- if err != nil {
- return distribution.Descriptor{}, err
- }
- if n < int64(len(p)) {
- return distribution.Descriptor{}, fmt.Errorf("short copy: wrote %d of %d", n, len(p))
- }
-
- desc := distribution.Descriptor{
- MediaType: mediaType,
- Size: int64(len(p)),
- Digest: dgstr.Digest(),
- }
-
- return writer.Commit(ctx, desc)
-}
-
-type optionFunc func(interface{}) error
-
-func (f optionFunc) Apply(v interface{}) error {
- return f(v)
-}
-
-// WithMountFrom returns a BlobCreateOption which designates that the blob should be
-// mounted from the given canonical reference.
-func WithMountFrom(ref reference.Canonical) distribution.BlobCreateOption {
- return optionFunc(func(v interface{}) error {
- opts, ok := v.(*distribution.CreateOptions)
- if !ok {
- return fmt.Errorf("unexpected options type: %T", v)
- }
-
- opts.Mount.ShouldMount = true
- opts.Mount.From = ref
-
- return nil
- })
-}
-
-func (bs *blobs) Create(ctx context.Context, options ...distribution.BlobCreateOption) (distribution.BlobWriter, error) {
- var opts distribution.CreateOptions
-
- for _, option := range options {
- err := option.Apply(&opts)
- if err != nil {
- return nil, err
- }
- }
-
- var values []url.Values
-
- if opts.Mount.ShouldMount {
- values = append(values, url.Values{"from": {opts.Mount.From.Name()}, "mount": {opts.Mount.From.Digest().String()}})
- }
-
- u, err := bs.ub.BuildBlobUploadURL(bs.name, values...)
- if err != nil {
- return nil, err
- }
-
- req, err := http.NewRequest("POST", u, nil)
- if err != nil {
- return nil, err
- }
-
- resp, err := bs.client.Do(req)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- switch resp.StatusCode {
- case http.StatusCreated:
- desc, err := bs.statter.Stat(ctx, opts.Mount.From.Digest())
- if err != nil {
- return nil, err
- }
- return nil, distribution.ErrBlobMounted{From: opts.Mount.From, Descriptor: desc}
- case http.StatusAccepted:
- // TODO(dmcgowan): Check for invalid UUID
- uuid := resp.Header.Get("Docker-Upload-UUID")
- location, err := sanitizeLocation(resp.Header.Get("Location"), u)
- if err != nil {
- return nil, err
- }
-
- return &httpBlobUpload{
- statter: bs.statter,
- client: bs.client,
- uuid: uuid,
- startedAt: time.Now(),
- location: location,
- }, nil
- default:
- return nil, HandleErrorResponse(resp)
- }
-}
-
-func (bs *blobs) Resume(ctx context.Context, id string) (distribution.BlobWriter, error) {
- panic("not implemented")
-}
-
-func (bs *blobs) Delete(ctx context.Context, dgst digest.Digest) error {
- return bs.statter.Clear(ctx, dgst)
-}
-
-type blobStatter struct {
- name reference.Named
- ub *v2.URLBuilder
- client *http.Client
-}
-
-func (bs *blobStatter) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
- ref, err := reference.WithDigest(bs.name, dgst)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- u, err := bs.ub.BuildBlobURL(ref)
- if err != nil {
- return distribution.Descriptor{}, err
- }
-
- resp, err := bs.client.Head(u)
- if err != nil {
- return distribution.Descriptor{}, err
- }
- defer resp.Body.Close()
-
- if SuccessStatus(resp.StatusCode) {
- lengthHeader := resp.Header.Get("Content-Length")
- if lengthHeader == "" {
- return distribution.Descriptor{}, fmt.Errorf("missing content-length header for request: %s", u)
- }
-
- length, err := strconv.ParseInt(lengthHeader, 10, 64)
- if err != nil {
- return distribution.Descriptor{}, fmt.Errorf("error parsing content-length: %v", err)
- }
-
- return distribution.Descriptor{
- MediaType: resp.Header.Get("Content-Type"),
- Size: length,
- Digest: dgst,
- }, nil
- } else if resp.StatusCode == http.StatusNotFound {
- return distribution.Descriptor{}, distribution.ErrBlobUnknown
- }
- return distribution.Descriptor{}, HandleErrorResponse(resp)
-}
-
-func buildCatalogValues(maxEntries int, last string) url.Values {
- values := url.Values{}
-
- if maxEntries > 0 {
- values.Add("n", strconv.Itoa(maxEntries))
- }
-
- if last != "" {
- values.Add("last", last)
- }
-
- return values
-}
-
-func (bs *blobStatter) Clear(ctx context.Context, dgst digest.Digest) error {
- ref, err := reference.WithDigest(bs.name, dgst)
- if err != nil {
- return err
- }
- blobURL, err := bs.ub.BuildBlobURL(ref)
- if err != nil {
- return err
- }
-
- req, err := http.NewRequest("DELETE", blobURL, nil)
- if err != nil {
- return err
- }
-
- resp, err := bs.client.Do(req)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
-
- if SuccessStatus(resp.StatusCode) {
- return nil
- }
- return HandleErrorResponse(resp)
-}
-
-func (bs *blobStatter) SetDescriptor(ctx context.Context, dgst digest.Digest, desc distribution.Descriptor) error {
- return nil
-}
diff --git a/vendor/github.com/docker/distribution/registry/client/transport/http_reader.go b/vendor/github.com/docker/distribution/registry/client/transport/http_reader.go
deleted file mode 100644
index 1d0b382fb..000000000
--- a/vendor/github.com/docker/distribution/registry/client/transport/http_reader.go
+++ /dev/null
@@ -1,250 +0,0 @@
-package transport
-
-import (
- "errors"
- "fmt"
- "io"
- "net/http"
- "regexp"
- "strconv"
-)
-
-var (
- contentRangeRegexp = regexp.MustCompile(`bytes ([0-9]+)-([0-9]+)/([0-9]+|\\*)`)
-
- // ErrWrongCodeForByteRange is returned if the client sends a request
- // with a Range header but the server returns a 2xx or 3xx code other
- // than 206 Partial Content.
- ErrWrongCodeForByteRange = errors.New("expected HTTP 206 from byte range request")
-)
-
-// ReadSeekCloser combines io.ReadSeeker with io.Closer.
-type ReadSeekCloser interface {
- io.ReadSeeker
- io.Closer
-}
-
-// NewHTTPReadSeeker handles reading from an HTTP endpoint using a GET
-// request. When seeking and starting a read from a non-zero offset
-// the a "Range" header will be added which sets the offset.
-// TODO(dmcgowan): Move this into a separate utility package
-func NewHTTPReadSeeker(client *http.Client, url string, errorHandler func(*http.Response) error) ReadSeekCloser {
- return &httpReadSeeker{
- client: client,
- url: url,
- errorHandler: errorHandler,
- }
-}
-
-type httpReadSeeker struct {
- client *http.Client
- url string
-
- // errorHandler creates an error from an unsuccessful HTTP response.
- // This allows the error to be created with the HTTP response body
- // without leaking the body through a returned error.
- errorHandler func(*http.Response) error
-
- size int64
-
- // rc is the remote read closer.
- rc io.ReadCloser
- // readerOffset tracks the offset as of the last read.
- readerOffset int64
- // seekOffset allows Seek to override the offset. Seek changes
- // seekOffset instead of changing readOffset directly so that
- // connection resets can be delayed and possibly avoided if the
- // seek is undone (i.e. seeking to the end and then back to the
- // beginning).
- seekOffset int64
- err error
-}
-
-func (hrs *httpReadSeeker) Read(p []byte) (n int, err error) {
- if hrs.err != nil {
- return 0, hrs.err
- }
-
- // If we sought to a different position, we need to reset the
- // connection. This logic is here instead of Seek so that if
- // a seek is undone before the next read, the connection doesn't
- // need to be closed and reopened. A common example of this is
- // seeking to the end to determine the length, and then seeking
- // back to the original position.
- if hrs.readerOffset != hrs.seekOffset {
- hrs.reset()
- }
-
- hrs.readerOffset = hrs.seekOffset
-
- rd, err := hrs.reader()
- if err != nil {
- return 0, err
- }
-
- n, err = rd.Read(p)
- hrs.seekOffset += int64(n)
- hrs.readerOffset += int64(n)
-
- return n, err
-}
-
-func (hrs *httpReadSeeker) Seek(offset int64, whence int) (int64, error) {
- if hrs.err != nil {
- return 0, hrs.err
- }
-
- lastReaderOffset := hrs.readerOffset
-
- if whence == io.SeekStart && hrs.rc == nil {
- // If no request has been made yet, and we are seeking to an
- // absolute position, set the read offset as well to avoid an
- // unnecessary request.
- hrs.readerOffset = offset
- }
-
- _, err := hrs.reader()
- if err != nil {
- hrs.readerOffset = lastReaderOffset
- return 0, err
- }
-
- newOffset := hrs.seekOffset
-
- switch whence {
- case io.SeekCurrent:
- newOffset += offset
- case io.SeekEnd:
- if hrs.size < 0 {
- return 0, errors.New("content length not known")
- }
- newOffset = hrs.size + offset
- case io.SeekStart:
- newOffset = offset
- }
-
- if newOffset < 0 {
- err = errors.New("cannot seek to negative position")
- } else {
- hrs.seekOffset = newOffset
- }
-
- return hrs.seekOffset, err
-}
-
-func (hrs *httpReadSeeker) Close() error {
- if hrs.err != nil {
- return hrs.err
- }
-
- // close and release reader chain
- if hrs.rc != nil {
- hrs.rc.Close()
- }
-
- hrs.rc = nil
-
- hrs.err = errors.New("httpLayer: closed")
-
- return nil
-}
-
-func (hrs *httpReadSeeker) reset() {
- if hrs.err != nil {
- return
- }
- if hrs.rc != nil {
- hrs.rc.Close()
- hrs.rc = nil
- }
-}
-
-func (hrs *httpReadSeeker) reader() (io.Reader, error) {
- if hrs.err != nil {
- return nil, hrs.err
- }
-
- if hrs.rc != nil {
- return hrs.rc, nil
- }
-
- req, err := http.NewRequest("GET", hrs.url, nil)
- if err != nil {
- return nil, err
- }
-
- if hrs.readerOffset > 0 {
- // If we are at different offset, issue a range request from there.
- req.Header.Add("Range", fmt.Sprintf("bytes=%d-", hrs.readerOffset))
- // TODO: get context in here
- // context.GetLogger(hrs.context).Infof("Range: %s", req.Header.Get("Range"))
- }
-
- req.Header.Add("Accept-Encoding", "identity")
- resp, err := hrs.client.Do(req)
- if err != nil {
- return nil, err
- }
-
- // Normally would use client.SuccessStatus, but that would be a cyclic
- // import
- if resp.StatusCode >= 200 && resp.StatusCode <= 399 {
- if hrs.readerOffset > 0 {
- if resp.StatusCode != http.StatusPartialContent {
- return nil, ErrWrongCodeForByteRange
- }
-
- contentRange := resp.Header.Get("Content-Range")
- if contentRange == "" {
- return nil, errors.New("no Content-Range header found in HTTP 206 response")
- }
-
- submatches := contentRangeRegexp.FindStringSubmatch(contentRange)
- if len(submatches) < 4 {
- return nil, fmt.Errorf("could not parse Content-Range header: %s", contentRange)
- }
-
- startByte, err := strconv.ParseUint(submatches[1], 10, 64)
- if err != nil {
- return nil, fmt.Errorf("could not parse start of range in Content-Range header: %s", contentRange)
- }
-
- if startByte != uint64(hrs.readerOffset) {
- return nil, fmt.Errorf("received Content-Range starting at offset %d instead of requested %d", startByte, hrs.readerOffset)
- }
-
- endByte, err := strconv.ParseUint(submatches[2], 10, 64)
- if err != nil {
- return nil, fmt.Errorf("could not parse end of range in Content-Range header: %s", contentRange)
- }
-
- if submatches[3] == "*" {
- hrs.size = -1
- } else {
- size, err := strconv.ParseUint(submatches[3], 10, 64)
- if err != nil {
- return nil, fmt.Errorf("could not parse total size in Content-Range header: %s", contentRange)
- }
-
- if endByte+1 != size {
- return nil, fmt.Errorf("range in Content-Range stops before the end of the content: %s", contentRange)
- }
-
- hrs.size = int64(size)
- }
- } else if resp.StatusCode == http.StatusOK {
- hrs.size = resp.ContentLength
- } else {
- hrs.size = -1
- }
- hrs.rc = resp.Body
- } else {
- defer resp.Body.Close()
- if hrs.errorHandler != nil {
- return nil, hrs.errorHandler(resp)
- }
- return nil, fmt.Errorf("unexpected status resolving reader: %v", resp.Status)
- }
-
- return hrs.rc, nil
-}
diff --git a/vendor/github.com/docker/distribution/registry/client/transport/transport.go b/vendor/github.com/docker/distribution/registry/client/transport/transport.go
deleted file mode 100644
index 30e45fab0..000000000
--- a/vendor/github.com/docker/distribution/registry/client/transport/transport.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package transport
-
-import (
- "io"
- "net/http"
- "sync"
-)
-
-// RequestModifier represents an object which will do an inplace
-// modification of an HTTP request.
-type RequestModifier interface {
- ModifyRequest(*http.Request) error
-}
-
-type headerModifier http.Header
-
-// NewHeaderRequestModifier returns a new RequestModifier which will
-// add the given headers to a request.
-func NewHeaderRequestModifier(header http.Header) RequestModifier {
- return headerModifier(header)
-}
-
-func (h headerModifier) ModifyRequest(req *http.Request) error {
- for k, s := range http.Header(h) {
- req.Header[k] = append(req.Header[k], s...)
- }
-
- return nil
-}
-
-// NewTransport creates a new transport which will apply modifiers to
-// the request on a RoundTrip call.
-func NewTransport(base http.RoundTripper, modifiers ...RequestModifier) http.RoundTripper {
- return &transport{
- Modifiers: modifiers,
- Base: base,
- }
-}
-
-// transport is an http.RoundTripper that makes HTTP requests after
-// copying and modifying the request
-type transport struct {
- Modifiers []RequestModifier
- Base http.RoundTripper
-
- mu sync.Mutex // guards modReq
- modReq map[*http.Request]*http.Request // original -> modified
-}
-
-// RoundTrip authorizes and authenticates the request with an
-// access token. If no token exists or token is expired,
-// tries to refresh/fetch a new token.
-func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
- req2 := cloneRequest(req)
- for _, modifier := range t.Modifiers {
- if err := modifier.ModifyRequest(req2); err != nil {
- return nil, err
- }
- }
-
- t.setModReq(req, req2)
- res, err := t.base().RoundTrip(req2)
- if err != nil {
- t.setModReq(req, nil)
- return nil, err
- }
- res.Body = &onEOFReader{
- rc: res.Body,
- fn: func() { t.setModReq(req, nil) },
- }
- return res, nil
-}
-
-// CancelRequest cancels an in-flight request by closing its connection.
-func (t *transport) CancelRequest(req *http.Request) {
- type canceler interface {
- CancelRequest(*http.Request)
- }
- if cr, ok := t.base().(canceler); ok {
- t.mu.Lock()
- modReq := t.modReq[req]
- delete(t.modReq, req)
- t.mu.Unlock()
- cr.CancelRequest(modReq)
- }
-}
-
-func (t *transport) base() http.RoundTripper {
- if t.Base != nil {
- return t.Base
- }
- return http.DefaultTransport
-}
-
-func (t *transport) setModReq(orig, mod *http.Request) {
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.modReq == nil {
- t.modReq = make(map[*http.Request]*http.Request)
- }
- if mod == nil {
- delete(t.modReq, orig)
- } else {
- t.modReq[orig] = mod
- }
-}
-
-// cloneRequest returns a clone of the provided *http.Request.
-// The clone is a shallow copy of the struct and its Header map.
-func cloneRequest(r *http.Request) *http.Request {
- // shallow copy of the struct
- r2 := new(http.Request)
- *r2 = *r
- // deep copy of the Header
- r2.Header = make(http.Header, len(r.Header))
- for k, s := range r.Header {
- r2.Header[k] = append([]string(nil), s...)
- }
-
- return r2
-}
-
-type onEOFReader struct {
- rc io.ReadCloser
- fn func()
-}
-
-func (r *onEOFReader) Read(p []byte) (n int, err error) {
- n, err = r.rc.Read(p)
- if err == io.EOF {
- r.runFunc()
- }
- return
-}
-
-func (r *onEOFReader) Close() error {
- err := r.rc.Close()
- r.runFunc()
- return err
-}
-
-func (r *onEOFReader) runFunc() {
- if fn := r.fn; fn != nil {
- fn()
- r.fn = nil
- }
-}
diff --git a/vendor/github.com/docker/distribution/registry/storage/cache/cache.go b/vendor/github.com/docker/distribution/registry/storage/cache/cache.go
deleted file mode 100644
index 10a390919..000000000
--- a/vendor/github.com/docker/distribution/registry/storage/cache/cache.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Package cache provides facilities to speed up access to the storage
-// backend.
-package cache
-
-import (
- "fmt"
-
- "github.com/docker/distribution"
-)
-
-// BlobDescriptorCacheProvider provides repository scoped
-// BlobDescriptorService cache instances and a global descriptor cache.
-type BlobDescriptorCacheProvider interface {
- distribution.BlobDescriptorService
-
- RepositoryScoped(repo string) (distribution.BlobDescriptorService, error)
-}
-
-// ValidateDescriptor provides a helper function to ensure that caches have
-// common criteria for admitting descriptors.
-func ValidateDescriptor(desc distribution.Descriptor) error {
- if err := desc.Digest.Validate(); err != nil {
- return err
- }
-
- if desc.Size < 0 {
- return fmt.Errorf("cache: invalid length in descriptor: %v < 0", desc.Size)
- }
-
- if desc.MediaType == "" {
- return fmt.Errorf("cache: empty mediatype on descriptor: %v", desc)
- }
-
- return nil
-}
diff --git a/vendor/github.com/docker/distribution/registry/storage/cache/cachedblobdescriptorstore.go b/vendor/github.com/docker/distribution/registry/storage/cache/cachedblobdescriptorstore.go
deleted file mode 100644
index ac4c45211..000000000
--- a/vendor/github.com/docker/distribution/registry/storage/cache/cachedblobdescriptorstore.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package cache
-
-import (
- "context"
-
- "github.com/docker/distribution"
- prometheus "github.com/docker/distribution/metrics"
- "github.com/opencontainers/go-digest"
-)
-
-// Metrics is used to hold metric counters
-// related to the number of times a cache was
-// hit or missed.
-type Metrics struct {
- Requests uint64
- Hits uint64
- Misses uint64
-}
-
-// Logger can be provided on the MetricsTracker to log errors.
-//
-// Usually, this is just a proxy to dcontext.GetLogger.
-type Logger interface {
- Errorf(format string, args ...interface{})
-}
-
-// MetricsTracker represents a metric tracker
-// which simply counts the number of hits and misses.
-type MetricsTracker interface {
- Hit()
- Miss()
- Metrics() Metrics
- Logger(context.Context) Logger
-}
-
-type cachedBlobStatter struct {
- cache distribution.BlobDescriptorService
- backend distribution.BlobDescriptorService
- tracker MetricsTracker
-}
-
-var (
- // cacheCount is the number of total cache request received/hits/misses
- cacheCount = prometheus.StorageNamespace.NewLabeledCounter("cache", "The number of cache request received", "type")
-)
-
-// NewCachedBlobStatter creates a new statter which prefers a cache and
-// falls back to a backend.
-func NewCachedBlobStatter(cache distribution.BlobDescriptorService, backend distribution.BlobDescriptorService) distribution.BlobDescriptorService {
- return &cachedBlobStatter{
- cache: cache,
- backend: backend,
- }
-}
-
-// NewCachedBlobStatterWithMetrics creates a new statter which prefers a cache and
-// falls back to a backend. Hits and misses will send to the tracker.
-func NewCachedBlobStatterWithMetrics(cache distribution.BlobDescriptorService, backend distribution.BlobDescriptorService, tracker MetricsTracker) distribution.BlobStatter {
- return &cachedBlobStatter{
- cache: cache,
- backend: backend,
- tracker: tracker,
- }
-}
-
-func (cbds *cachedBlobStatter) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
- cacheCount.WithValues("Request").Inc(1)
- desc, err := cbds.cache.Stat(ctx, dgst)
- if err != nil {
- if err != distribution.ErrBlobUnknown {
- logErrorf(ctx, cbds.tracker, "error retrieving descriptor from cache: %v", err)
- }
-
- goto fallback
- }
- cacheCount.WithValues("Hit").Inc(1)
- if cbds.tracker != nil {
- cbds.tracker.Hit()
- }
- return desc, nil
-fallback:
- cacheCount.WithValues("Miss").Inc(1)
- if cbds.tracker != nil {
- cbds.tracker.Miss()
- }
- desc, err = cbds.backend.Stat(ctx, dgst)
- if err != nil {
- return desc, err
- }
-
- if err := cbds.cache.SetDescriptor(ctx, dgst, desc); err != nil {
- logErrorf(ctx, cbds.tracker, "error adding descriptor %v to cache: %v", desc.Digest, err)
- }
-
- return desc, err
-
-}
-
-func (cbds *cachedBlobStatter) Clear(ctx context.Context, dgst digest.Digest) error {
- err := cbds.cache.Clear(ctx, dgst)
- if err != nil {
- return err
- }
-
- err = cbds.backend.Clear(ctx, dgst)
- if err != nil {
- return err
- }
- return nil
-}
-
-func (cbds *cachedBlobStatter) SetDescriptor(ctx context.Context, dgst digest.Digest, desc distribution.Descriptor) error {
- if err := cbds.cache.SetDescriptor(ctx, dgst, desc); err != nil {
- logErrorf(ctx, cbds.tracker, "error adding descriptor %v to cache: %v", desc.Digest, err)
- }
- return nil
-}
-
-func logErrorf(ctx context.Context, tracker MetricsTracker, format string, args ...interface{}) {
- if tracker == nil {
- return
- }
-
- logger := tracker.Logger(ctx)
- if logger == nil {
- return
- }
- logger.Errorf(format, args...)
-}
diff --git a/vendor/github.com/docker/distribution/registry/storage/cache/memory/memory.go b/vendor/github.com/docker/distribution/registry/storage/cache/memory/memory.go
deleted file mode 100644
index 42d94d9bd..000000000
--- a/vendor/github.com/docker/distribution/registry/storage/cache/memory/memory.go
+++ /dev/null
@@ -1,179 +0,0 @@
-package memory
-
-import (
- "context"
- "sync"
-
- "github.com/docker/distribution"
- "github.com/docker/distribution/reference"
- "github.com/docker/distribution/registry/storage/cache"
- "github.com/opencontainers/go-digest"
-)
-
-type inMemoryBlobDescriptorCacheProvider struct {
- global *mapBlobDescriptorCache
- repositories map[string]*mapBlobDescriptorCache
- mu sync.RWMutex
-}
-
-// NewInMemoryBlobDescriptorCacheProvider returns a new mapped-based cache for
-// storing blob descriptor data.
-func NewInMemoryBlobDescriptorCacheProvider() cache.BlobDescriptorCacheProvider {
- return &inMemoryBlobDescriptorCacheProvider{
- global: newMapBlobDescriptorCache(),
- repositories: make(map[string]*mapBlobDescriptorCache),
- }
-}
-
-func (imbdcp *inMemoryBlobDescriptorCacheProvider) RepositoryScoped(repo string) (distribution.BlobDescriptorService, error) {
- if _, err := reference.ParseNormalizedNamed(repo); err != nil {
- return nil, err
- }
-
- imbdcp.mu.RLock()
- defer imbdcp.mu.RUnlock()
-
- return &repositoryScopedInMemoryBlobDescriptorCache{
- repo: repo,
- parent: imbdcp,
- repository: imbdcp.repositories[repo],
- }, nil
-}
-
-func (imbdcp *inMemoryBlobDescriptorCacheProvider) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
- return imbdcp.global.Stat(ctx, dgst)
-}
-
-func (imbdcp *inMemoryBlobDescriptorCacheProvider) Clear(ctx context.Context, dgst digest.Digest) error {
- return imbdcp.global.Clear(ctx, dgst)
-}
-
-func (imbdcp *inMemoryBlobDescriptorCacheProvider) SetDescriptor(ctx context.Context, dgst digest.Digest, desc distribution.Descriptor) error {
- _, err := imbdcp.Stat(ctx, dgst)
- if err == distribution.ErrBlobUnknown {
-
- if dgst.Algorithm() != desc.Digest.Algorithm() && dgst != desc.Digest {
- // if the digests differ, set the other canonical mapping
- if err := imbdcp.global.SetDescriptor(ctx, desc.Digest, desc); err != nil {
- return err
- }
- }
-
- // unknown, just set it
- return imbdcp.global.SetDescriptor(ctx, dgst, desc)
- }
-
- // we already know it, do nothing
- return err
-}
-
-// repositoryScopedInMemoryBlobDescriptorCache provides the request scoped
-// repository cache. Instances are not thread-safe but the delegated
-// operations are.
-type repositoryScopedInMemoryBlobDescriptorCache struct {
- repo string
- parent *inMemoryBlobDescriptorCacheProvider // allows lazy allocation of repo's map
- repository *mapBlobDescriptorCache
-}
-
-func (rsimbdcp *repositoryScopedInMemoryBlobDescriptorCache) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
- rsimbdcp.parent.mu.Lock()
- repo := rsimbdcp.repository
- rsimbdcp.parent.mu.Unlock()
-
- if repo == nil {
- return distribution.Descriptor{}, distribution.ErrBlobUnknown
- }
-
- return repo.Stat(ctx, dgst)
-}
-
-func (rsimbdcp *repositoryScopedInMemoryBlobDescriptorCache) Clear(ctx context.Context, dgst digest.Digest) error {
- rsimbdcp.parent.mu.Lock()
- repo := rsimbdcp.repository
- rsimbdcp.parent.mu.Unlock()
-
- if repo == nil {
- return distribution.ErrBlobUnknown
- }
-
- return repo.Clear(ctx, dgst)
-}
-
-func (rsimbdcp *repositoryScopedInMemoryBlobDescriptorCache) SetDescriptor(ctx context.Context, dgst digest.Digest, desc distribution.Descriptor) error {
- rsimbdcp.parent.mu.Lock()
- repo := rsimbdcp.repository
- if repo == nil {
- // allocate map since we are setting it now.
- var ok bool
- // have to read back value since we may have allocated elsewhere.
- repo, ok = rsimbdcp.parent.repositories[rsimbdcp.repo]
- if !ok {
- repo = newMapBlobDescriptorCache()
- rsimbdcp.parent.repositories[rsimbdcp.repo] = repo
- }
- rsimbdcp.repository = repo
- }
- rsimbdcp.parent.mu.Unlock()
-
- if err := repo.SetDescriptor(ctx, dgst, desc); err != nil {
- return err
- }
-
- return rsimbdcp.parent.SetDescriptor(ctx, dgst, desc)
-}
-
-// mapBlobDescriptorCache provides a simple map-based implementation of the
-// descriptor cache.
-type mapBlobDescriptorCache struct {
- descriptors map[digest.Digest]distribution.Descriptor
- mu sync.RWMutex
-}
-
-var _ distribution.BlobDescriptorService = &mapBlobDescriptorCache{}
-
-func newMapBlobDescriptorCache() *mapBlobDescriptorCache {
- return &mapBlobDescriptorCache{
- descriptors: make(map[digest.Digest]distribution.Descriptor),
- }
-}
-
-func (mbdc *mapBlobDescriptorCache) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
- if err := dgst.Validate(); err != nil {
- return distribution.Descriptor{}, err
- }
-
- mbdc.mu.RLock()
- defer mbdc.mu.RUnlock()
-
- desc, ok := mbdc.descriptors[dgst]
- if !ok {
- return distribution.Descriptor{}, distribution.ErrBlobUnknown
- }
-
- return desc, nil
-}
-
-func (mbdc *mapBlobDescriptorCache) Clear(ctx context.Context, dgst digest.Digest) error {
- mbdc.mu.Lock()
- defer mbdc.mu.Unlock()
-
- delete(mbdc.descriptors, dgst)
- return nil
-}
-
-func (mbdc *mapBlobDescriptorCache) SetDescriptor(ctx context.Context, dgst digest.Digest, desc distribution.Descriptor) error {
- if err := dgst.Validate(); err != nil {
- return err
- }
-
- if err := cache.ValidateDescriptor(desc); err != nil {
- return err
- }
-
- mbdc.mu.Lock()
- defer mbdc.mu.Unlock()
-
- mbdc.descriptors[dgst] = desc
- return nil
-}
diff --git a/vendor/github.com/docker/distribution/tags.go b/vendor/github.com/docker/distribution/tags.go
deleted file mode 100644
index f22df2b85..000000000
--- a/vendor/github.com/docker/distribution/tags.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package distribution
-
-import (
- "context"
-)
-
-// TagService provides access to information about tagged objects.
-type TagService interface {
- // Get retrieves the descriptor identified by the tag. Some
- // implementations may differentiate between "trusted" tags and
- // "untrusted" tags. If a tag is "untrusted", the mapping will be returned
- // as an ErrTagUntrusted error, with the target descriptor.
- Get(ctx context.Context, tag string) (Descriptor, error)
-
- // Tag associates the tag with the provided descriptor, updating the
- // current association, if needed.
- Tag(ctx context.Context, tag string, desc Descriptor) error
-
- // Untag removes the given tag association
- Untag(ctx context.Context, tag string) error
-
- // All returns the set of tags managed by this tag service
- All(ctx context.Context) ([]string, error)
-
- // Lookup returns the set of tags referencing the given digest.
- Lookup(ctx context.Context, digest Descriptor) ([]string, error)
-}
diff --git a/vendor/github.com/docker/distribution/vendor.conf b/vendor/github.com/docker/distribution/vendor.conf
deleted file mode 100644
index bd1b4bff6..000000000
--- a/vendor/github.com/docker/distribution/vendor.conf
+++ /dev/null
@@ -1,51 +0,0 @@
-github.com/Azure/azure-sdk-for-go 4650843026a7fdec254a8d9cf893693a254edd0b
-github.com/Azure/go-autorest eaa7994b2278094c904d31993d26f56324db3052
-github.com/sirupsen/logrus 3d4380f53a34dcdc95f0c1db702615992b38d9a4
-github.com/aws/aws-sdk-go f831d5a0822a1ad72420ab18c6269bca1ddaf490
-github.com/bshuster-repo/logrus-logstash-hook d2c0ecc1836d91814e15e23bb5dc309c3ef51f4a
-github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
-github.com/bugsnag/bugsnag-go b1d153021fcd90ca3f080db36bec96dc690fb274
-github.com/bugsnag/osext 0dd3f918b21bec95ace9dc86c7e70266cfc5c702
-github.com/bugsnag/panicwrap e2c28503fcd0675329da73bf48b33404db873782
-github.com/denverdino/aliyungo afedced274aa9a7fcdd47ac97018f0f8db4e5de2
-github.com/dgrijalva/jwt-go 4bbdd8ac624fc7a9ef7aec841c43d99b5fe65a29 https://github.com/golang-jwt/jwt.git # v3.2.2
-github.com/docker/go-metrics 399ea8c73916000c64c2c76e8da00ca82f8387ab
-github.com/docker/libtrust fa567046d9b14f6aa788882a950d69651d230b21
-github.com/garyburd/redigo 535138d7bcd717d6531c701ef5933d98b1866257
-github.com/go-ini/ini 2ba15ac2dc9cdf88c110ec2dc0ced7fa45f5678c
-github.com/golang/protobuf 8d92cf5fc15a4382f8964b08e1f42a75c0591aa3
-github.com/gorilla/handlers 60c7bfde3e33c201519a200a4507a158cc03a17b
-github.com/gorilla/mux 599cba5e7b6137d46ddf58fb1765f5d928e69604
-github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
-github.com/jmespath/go-jmespath bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d
-github.com/marstr/guid 8bd9a64bf37eb297b492a4101fb28e80ac0b290f
-github.com/satori/go.uuid f58768cc1a7a7e77a3bd49e98cdd21419399b6a3
-github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c
-github.com/miekg/dns 271c58e0c14f552178ea321a545ff9af38930f39
-github.com/mitchellh/mapstructure 482a9fd5fa83e8c4e7817413b80f3eb8feec03ef
-github.com/ncw/swift a0320860b16212c2b59b4912bb6508cda1d7cee6
-github.com/prometheus/client_golang c332b6f63c0658a65eca15c0e5247ded801cf564
-github.com/prometheus/client_model 99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c
-github.com/prometheus/common 89604d197083d4781071d3c65855d24ecfb0a563
-github.com/prometheus/procfs cb4147076ac75738c9a7d279075a253c0cc5acbd
-github.com/Shopify/logrus-bugsnag 577dee27f20dd8f1a529f82210094af593be12bd
-github.com/spf13/cobra 312092086bed4968099259622145a0c9ae280064
-github.com/spf13/pflag 5644820622454e71517561946e3d94b9f9db6842
-github.com/xenolf/lego a9d8cec0e6563575e5868a005359ac97911b5985
-github.com/yvasiyarov/go-metrics 57bccd1ccd43f94bb17fdd8bf3007059b802f85e
-github.com/yvasiyarov/gorelic a9bba5b9ab508a086f9a12b8c51fab68478e2128
-github.com/yvasiyarov/newrelic_platform_go b21fdbd4370f3717f3bbd2bf41c223bc273068e6
-golang.org/x/crypto c10c31b5e94b6f7a0283272dc2bb27163dcea24b
-golang.org/x/net 4876518f9e71663000c348837735820161a42df7
-golang.org/x/oauth2 045497edb6234273d67dbc25da3f2ddbc4c4cacf
-golang.org/x/time a4bde12657593d5e90d0533a3e4fd95e635124cb
-google.golang.org/api 9bf6e6e569ff057f75d9604a46c52928f17d2b54
-google.golang.org/appengine 12d5545dc1cfa6047a286d5e853841b6471f4c19
-google.golang.org/cloud 975617b05ea8a58727e6c1a06b6161ff4185a9f2
-google.golang.org/grpc d3ddb4469d5a1b949fc7a7da7c1d6a0d1b6de994
-gopkg.in/check.v1 64131543e7896d5bcc6bd5a76287eb75ea96c673
-gopkg.in/square/go-jose.v1 40d457b439244b546f023d056628e5184136899b
-gopkg.in/yaml.v2 v2.2.1
-rsc.io/letsencrypt e770c10b0f1a64775ae91d240407ce00d1a5bdeb https://github.com/dmcgowan/letsencrypt.git
-github.com/opencontainers/go-digest a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb
-github.com/opencontainers/image-spec 67d2d5658fe0476ab9bf414cec164077ebff3920 # v1.0.2
diff --git a/vendor/github.com/docker/go-metrics/CONTRIBUTING.md b/vendor/github.com/docker/go-metrics/CONTRIBUTING.md
deleted file mode 100644
index b8a512c36..000000000
--- a/vendor/github.com/docker/go-metrics/CONTRIBUTING.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# Contributing
-
-## Sign your work
-
-The sign-off is a simple line at the end of the explanation for the patch. Your
-signature certifies that you wrote the patch or otherwise have the right to pass
-it on as an open-source patch. The rules are pretty simple: if you can certify
-the below (from [developercertificate.org](http://developercertificate.org/)):
-
-```
-Developer Certificate of Origin
-Version 1.1
-
-Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
-660 York Street, Suite 102,
-San Francisco, CA 94110 USA
-
-Everyone is permitted to copy and distribute verbatim copies of this
-license document, but changing it is not allowed.
-
-Developer's Certificate of Origin 1.1
-
-By making a contribution to this project, I certify that:
-
-(a) The contribution was created in whole or in part by me and I
- have the right to submit it under the open source license
- indicated in the file; or
-
-(b) The contribution is based upon previous work that, to the best
- of my knowledge, is covered under an appropriate open source
- license and I have the right under that license to submit that
- work with modifications, whether created in whole or in part
- by me, under the same open source license (unless I am
- permitted to submit under a different license), as indicated
- in the file; or
-
-(c) The contribution was provided directly to me by some other
- person who certified (a), (b) or (c) and I have not modified
- it.
-
-(d) I understand and agree that this project and the contribution
- are public and that a record of the contribution (including all
- personal information I submit with it, including my sign-off) is
- maintained indefinitely and may be redistributed consistent with
- this project or the open source license(s) involved.
-```
-
-Then you just add a line to every git commit message:
-
- Signed-off-by: Joe Smith <joe.smith@email.com>
-
-Use your real name (sorry, no pseudonyms or anonymous contributions.)
-
-If you set your `user.name` and `user.email` git configs, you can sign your
-commit automatically with `git commit -s`.
diff --git a/vendor/github.com/docker/go-metrics/LICENSE b/vendor/github.com/docker/go-metrics/LICENSE
deleted file mode 100644
index 8f3fee627..000000000
--- a/vendor/github.com/docker/go-metrics/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- https://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- Copyright 2013-2016 Docker, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- https://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/docker/go-metrics/LICENSE.docs b/vendor/github.com/docker/go-metrics/LICENSE.docs
deleted file mode 100644
index e26cd4fc8..000000000
--- a/vendor/github.com/docker/go-metrics/LICENSE.docs
+++ /dev/null
@@ -1,425 +0,0 @@
-Attribution-ShareAlike 4.0 International
-
-=======================================================================
-
-Creative Commons Corporation ("Creative Commons") is not a law firm and
-does not provide legal services or legal advice. Distribution of
-Creative Commons public licenses does not create a lawyer-client or
-other relationship. Creative Commons makes its licenses and related
-information available on an "as-is" basis. Creative Commons gives no
-warranties regarding its licenses, any material licensed under their
-terms and conditions, or any related information. Creative Commons
-disclaims all liability for damages resulting from their use to the
-fullest extent possible.
-
-Using Creative Commons Public Licenses
-
-Creative Commons public licenses provide a standard set of terms and
-conditions that creators and other rights holders may use to share
-original works of authorship and other material subject to copyright
-and certain other rights specified in the public license below. The
-following considerations are for informational purposes only, are not
-exhaustive, and do not form part of our licenses.
-
- Considerations for licensors: Our public licenses are
- intended for use by those authorized to give the public
- permission to use material in ways otherwise restricted by
- copyright and certain other rights. Our licenses are
- irrevocable. Licensors should read and understand the terms
- and conditions of the license they choose before applying it.
- Licensors should also secure all rights necessary before
- applying our licenses so that the public can reuse the
- material as expected. Licensors should clearly mark any
- material not subject to the license. This includes other CC-
- licensed material, or material used under an exception or
- limitation to copyright. More considerations for licensors:
- wiki.creativecommons.org/Considerations_for_licensors
-
- Considerations for the public: By using one of our public
- licenses, a licensor grants the public permission to use the
- licensed material under specified terms and conditions. If
- the licensor's permission is not necessary for any reason--for
- example, because of any applicable exception or limitation to
- copyright--then that use is not regulated by the license. Our
- licenses grant only permissions under copyright and certain
- other rights that a licensor has authority to grant. Use of
- the licensed material may still be restricted for other
- reasons, including because others have copyright or other
- rights in the material. A licensor may make special requests,
- such as asking that all changes be marked or described.
- Although not required by our licenses, you are encouraged to
- respect those requests where reasonable. More_considerations
- for the public:
- wiki.creativecommons.org/Considerations_for_licensees
-
-=======================================================================
-
-Creative Commons Attribution-ShareAlike 4.0 International Public
-License
-
-By exercising the Licensed Rights (defined below), You accept and agree
-to be bound by the terms and conditions of this Creative Commons
-Attribution-ShareAlike 4.0 International Public License ("Public
-License"). To the extent this Public License may be interpreted as a
-contract, You are granted the Licensed Rights in consideration of Your
-acceptance of these terms and conditions, and the Licensor grants You
-such rights in consideration of benefits the Licensor receives from
-making the Licensed Material available under these terms and
-conditions.
-
-
-Section 1 -- Definitions.
-
- a. Adapted Material means material subject to Copyright and Similar
- Rights that is derived from or based upon the Licensed Material
- and in which the Licensed Material is translated, altered,
- arranged, transformed, or otherwise modified in a manner requiring
- permission under the Copyright and Similar Rights held by the
- Licensor. For purposes of this Public License, where the Licensed
- Material is a musical work, performance, or sound recording,
- Adapted Material is always produced where the Licensed Material is
- synched in timed relation with a moving image.
-
- b. Adapter's License means the license You apply to Your Copyright
- and Similar Rights in Your contributions to Adapted Material in
- accordance with the terms and conditions of this Public License.
-
- c. BY-SA Compatible License means a license listed at
- creativecommons.org/compatiblelicenses, approved by Creative
- Commons as essentially the equivalent of this Public License.
-
- d. Copyright and Similar Rights means copyright and/or similar rights
- closely related to copyright including, without limitation,
- performance, broadcast, sound recording, and Sui Generis Database
- Rights, without regard to how the rights are labeled or
- categorized. For purposes of this Public License, the rights
- specified in Section 2(b)(1)-(2) are not Copyright and Similar
- Rights.
-
- e. Effective Technological Measures means those measures that, in the
- absence of proper authority, may not be circumvented under laws
- fulfilling obligations under Article 11 of the WIPO Copyright
- Treaty adopted on December 20, 1996, and/or similar international
- agreements.
-
- f. Exceptions and Limitations means fair use, fair dealing, and/or
- any other exception or limitation to Copyright and Similar Rights
- that applies to Your use of the Licensed Material.
-
- g. License Elements means the license attributes listed in the name
- of a Creative Commons Public License. The License Elements of this
- Public License are Attribution and ShareAlike.
-
- h. Licensed Material means the artistic or literary work, database,
- or other material to which the Licensor applied this Public
- License.
-
- i. Licensed Rights means the rights granted to You subject to the
- terms and conditions of this Public License, which are limited to
- all Copyright and Similar Rights that apply to Your use of the
- Licensed Material and that the Licensor has authority to license.
-
- j. Licensor means the individual(s) or entity(ies) granting rights
- under this Public License.
-
- k. Share means to provide material to the public by any means or
- process that requires permission under the Licensed Rights, such
- as reproduction, public display, public performance, distribution,
- dissemination, communication, or importation, and to make material
- available to the public including in ways that members of the
- public may access the material from a place and at a time
- individually chosen by them.
-
- l. Sui Generis Database Rights means rights other than copyright
- resulting from Directive 96/9/EC of the European Parliament and of
- the Council of 11 March 1996 on the legal protection of databases,
- as amended and/or succeeded, as well as other essentially
- equivalent rights anywhere in the world.
-
- m. You means the individual or entity exercising the Licensed Rights
- under this Public License. Your has a corresponding meaning.
-
-
-Section 2 -- Scope.
-
- a. License grant.
-
- 1. Subject to the terms and conditions of this Public License,
- the Licensor hereby grants You a worldwide, royalty-free,
- non-sublicensable, non-exclusive, irrevocable license to
- exercise the Licensed Rights in the Licensed Material to:
-
- a. reproduce and Share the Licensed Material, in whole or
- in part; and
-
- b. produce, reproduce, and Share Adapted Material.
-
- 2. Exceptions and Limitations. For the avoidance of doubt, where
- Exceptions and Limitations apply to Your use, this Public
- License does not apply, and You do not need to comply with
- its terms and conditions.
-
- 3. Term. The term of this Public License is specified in Section
- 6(a).
-
- 4. Media and formats; technical modifications allowed. The
- Licensor authorizes You to exercise the Licensed Rights in
- all media and formats whether now known or hereafter created,
- and to make technical modifications necessary to do so. The
- Licensor waives and/or agrees not to assert any right or
- authority to forbid You from making technical modifications
- necessary to exercise the Licensed Rights, including
- technical modifications necessary to circumvent Effective
- Technological Measures. For purposes of this Public License,
- simply making modifications authorized by this Section 2(a)
- (4) never produces Adapted Material.
-
- 5. Downstream recipients.
-
- a. Offer from the Licensor -- Licensed Material. Every
- recipient of the Licensed Material automatically
- receives an offer from the Licensor to exercise the
- Licensed Rights under the terms and conditions of this
- Public License.
-
- b. Additional offer from the Licensor -- Adapted Material.
- Every recipient of Adapted Material from You
- automatically receives an offer from the Licensor to
- exercise the Licensed Rights in the Adapted Material
- under the conditions of the Adapter's License You apply.
-
- c. No downstream restrictions. You may not offer or impose
- any additional or different terms or conditions on, or
- apply any Effective Technological Measures to, the
- Licensed Material if doing so restricts exercise of the
- Licensed Rights by any recipient of the Licensed
- Material.
-
- 6. No endorsement. Nothing in this Public License constitutes or
- may be construed as permission to assert or imply that You
- are, or that Your use of the Licensed Material is, connected
- with, or sponsored, endorsed, or granted official status by,
- the Licensor or others designated to receive attribution as
- provided in Section 3(a)(1)(A)(i).
-
- b. Other rights.
-
- 1. Moral rights, such as the right of integrity, are not
- licensed under this Public License, nor are publicity,
- privacy, and/or other similar personality rights; however, to
- the extent possible, the Licensor waives and/or agrees not to
- assert any such rights held by the Licensor to the limited
- extent necessary to allow You to exercise the Licensed
- Rights, but not otherwise.
-
- 2. Patent and trademark rights are not licensed under this
- Public License.
-
- 3. To the extent possible, the Licensor waives any right to
- collect royalties from You for the exercise of the Licensed
- Rights, whether directly or through a collecting society
- under any voluntary or waivable statutory or compulsory
- licensing scheme. In all other cases the Licensor expressly
- reserves any right to collect such royalties.
-
-
-Section 3 -- License Conditions.
-
-Your exercise of the Licensed Rights is expressly made subject to the
-following conditions.
-
- a. Attribution.
-
- 1. If You Share the Licensed Material (including in modified
- form), You must:
-
- a. retain the following if it is supplied by the Licensor
- with the Licensed Material:
-
- i. identification of the creator(s) of the Licensed
- Material and any others designated to receive
- attribution, in any reasonable manner requested by
- the Licensor (including by pseudonym if
- designated);
-
- ii. a copyright notice;
-
- iii. a notice that refers to this Public License;
-
- iv. a notice that refers to the disclaimer of
- warranties;
-
- v. a URI or hyperlink to the Licensed Material to the
- extent reasonably practicable;
-
- b. indicate if You modified the Licensed Material and
- retain an indication of any previous modifications; and
-
- c. indicate the Licensed Material is licensed under this
- Public License, and include the text of, or the URI or
- hyperlink to, this Public License.
-
- 2. You may satisfy the conditions in Section 3(a)(1) in any
- reasonable manner based on the medium, means, and context in
- which You Share the Licensed Material. For example, it may be
- reasonable to satisfy the conditions by providing a URI or
- hyperlink to a resource that includes the required
- information.
-
- 3. If requested by the Licensor, You must remove any of the
- information required by Section 3(a)(1)(A) to the extent
- reasonably practicable.
-
- b. ShareAlike.
-
- In addition to the conditions in Section 3(a), if You Share
- Adapted Material You produce, the following conditions also apply.
-
- 1. The Adapter's License You apply must be a Creative Commons
- license with the same License Elements, this version or
- later, or a BY-SA Compatible License.
-
- 2. You must include the text of, or the URI or hyperlink to, the
- Adapter's License You apply. You may satisfy this condition
- in any reasonable manner based on the medium, means, and
- context in which You Share Adapted Material.
-
- 3. You may not offer or impose any additional or different terms
- or conditions on, or apply any Effective Technological
- Measures to, Adapted Material that restrict exercise of the
- rights granted under the Adapter's License You apply.
-
-
-Section 4 -- Sui Generis Database Rights.
-
-Where the Licensed Rights include Sui Generis Database Rights that
-apply to Your use of the Licensed Material:
-
- a. for the avoidance of doubt, Section 2(a)(1) grants You the right
- to extract, reuse, reproduce, and Share all or a substantial
- portion of the contents of the database;
-
- b. if You include all or a substantial portion of the database
- contents in a database in which You have Sui Generis Database
- Rights, then the database in which You have Sui Generis Database
- Rights (but not its individual contents) is Adapted Material,
-
- including for purposes of Section 3(b); and
- c. You must comply with the conditions in Section 3(a) if You Share
- all or a substantial portion of the contents of the database.
-
-For the avoidance of doubt, this Section 4 supplements and does not
-replace Your obligations under this Public License where the Licensed
-Rights include other Copyright and Similar Rights.
-
-
-Section 5 -- Disclaimer of Warranties and Limitation of Liability.
-
- a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
- EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
- AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
- ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
- IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
- WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
- ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
- KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
- ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
-
- b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
- TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
- NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
- INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
- COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
- USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
- ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
- DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
- IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
-
- c. The disclaimer of warranties and limitation of liability provided
- above shall be interpreted in a manner that, to the extent
- possible, most closely approximates an absolute disclaimer and
- waiver of all liability.
-
-
-Section 6 -- Term and Termination.
-
- a. This Public License applies for the term of the Copyright and
- Similar Rights licensed here. However, if You fail to comply with
- this Public License, then Your rights under this Public License
- terminate automatically.
-
- b. Where Your right to use the Licensed Material has terminated under
- Section 6(a), it reinstates:
-
- 1. automatically as of the date the violation is cured, provided
- it is cured within 30 days of Your discovery of the
- violation; or
-
- 2. upon express reinstatement by the Licensor.
-
- For the avoidance of doubt, this Section 6(b) does not affect any
- right the Licensor may have to seek remedies for Your violations
- of this Public License.
-
- c. For the avoidance of doubt, the Licensor may also offer the
- Licensed Material under separate terms or conditions or stop
- distributing the Licensed Material at any time; however, doing so
- will not terminate this Public License.
-
- d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
- License.
-
-
-Section 7 -- Other Terms and Conditions.
-
- a. The Licensor shall not be bound by any additional or different
- terms or conditions communicated by You unless expressly agreed.
-
- b. Any arrangements, understandings, or agreements regarding the
- Licensed Material not stated herein are separate from and
- independent of the terms and conditions of this Public License.
-
-
-Section 8 -- Interpretation.
-
- a. For the avoidance of doubt, this Public License does not, and
- shall not be interpreted to, reduce, limit, restrict, or impose
- conditions on any use of the Licensed Material that could lawfully
- be made without permission under this Public License.
-
- b. To the extent possible, if any provision of this Public License is
- deemed unenforceable, it shall be automatically reformed to the
- minimum extent necessary to make it enforceable. If the provision
- cannot be reformed, it shall be severed from this Public License
- without affecting the enforceability of the remaining terms and
- conditions.
-
- c. No term or condition of this Public License will be waived and no
- failure to comply consented to unless expressly agreed to by the
- Licensor.
-
- d. Nothing in this Public License constitutes or may be interpreted
- as a limitation upon, or waiver of, any privileges and immunities
- that apply to the Licensor or You, including from the legal
- processes of any jurisdiction or authority.
-
-
-=======================================================================
-
-Creative Commons is not a party to its public licenses.
-Notwithstanding, Creative Commons may elect to apply one of its public
-licenses to material it publishes and in those instances will be
-considered the "Licensor." Except for the limited purpose of indicating
-that material is shared under a Creative Commons public license or as
-otherwise permitted by the Creative Commons policies published at
-creativecommons.org/policies, Creative Commons does not authorize the
-use of the trademark "Creative Commons" or any other trademark or logo
-of Creative Commons without its prior written consent including,
-without limitation, in connection with any unauthorized modifications
-to any of its public licenses or any other arrangements,
-understandings, or agreements concerning use of licensed material. For
-the avoidance of doubt, this paragraph does not form part of the public
-licenses.
-
-Creative Commons may be contacted at creativecommons.org.
diff --git a/vendor/github.com/docker/go-metrics/NOTICE b/vendor/github.com/docker/go-metrics/NOTICE
deleted file mode 100644
index 8915f0277..000000000
--- a/vendor/github.com/docker/go-metrics/NOTICE
+++ /dev/null
@@ -1,16 +0,0 @@
-Docker
-Copyright 2012-2015 Docker, Inc.
-
-This product includes software developed at Docker, Inc. (https://www.docker.com).
-
-The following is courtesy of our legal counsel:
-
-
-Use and transfer of Docker may be subject to certain restrictions by the
-United States and other governments.
-It is your responsibility to ensure that your use and/or transfer does not
-violate applicable laws.
-
-For more information, please see https://www.bis.doc.gov
-
-See also https://www.apache.org/dev/crypto.html and/or seek legal counsel.
diff --git a/vendor/github.com/docker/go-metrics/README.md b/vendor/github.com/docker/go-metrics/README.md
deleted file mode 100644
index a9e947cb5..000000000
--- a/vendor/github.com/docker/go-metrics/README.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# go-metrics [![GoDoc](https://godoc.org/github.com/docker/go-metrics?status.svg)](https://godoc.org/github.com/docker/go-metrics) ![Badge Badge](http://doyouevenbadge.com/github.com/docker/go-metrics)
-
-This package is small wrapper around the prometheus go client to help enforce convention and best practices for metrics collection in Docker projects.
-
-## Best Practices
-
-This packages is meant to be used for collecting metrics in Docker projects.
-It is not meant to be used as a replacement for the prometheus client but to help enforce consistent naming across metrics collected.
-If you have not already read the prometheus best practices around naming and labels you can read the page [here](https://prometheus.io/docs/practices/naming/).
-
-The following are a few Docker specific rules that will help you name and work with metrics in your project.
-
-1. Namespace and Subsystem
-
-This package provides you with a namespace type that allows you to specify the same namespace and subsystem for your metrics.
-
-```go
-ns := metrics.NewNamespace("engine", "daemon", metrics.Labels{
- "version": dockerversion.Version,
- "commit": dockerversion.GitCommit,
-})
-```
-
-In the example above we are creating metrics for the Docker engine's daemon package.
-`engine` would be the namespace in this example where `daemon` is the subsystem or package where we are collecting the metrics.
-
-A namespace also allows you to attach constant labels to the metrics such as the git commit and version that it is collecting.
-
-2. Declaring your Metrics
-
-Try to keep all your metric declarations in one file.
-This makes it easy for others to see what constant labels are defined on the namespace and what labels are defined on the metrics when they are created.
-
-3. Use labels instead of multiple metrics
-
-Labels allow you to define one metric such as the time it takes to perform a certain action on an object.
-If we wanted to collect timings on various container actions such as create, start, and delete then we can define one metric called `container_actions` and use labels to specify the type of action.
-
-
-```go
-containerActions = ns.NewLabeledTimer("container_actions", "The number of milliseconds it takes to process each container action", "action")
-```
-
-The last parameter is the label name or key.
-When adding a data point to the metric you will use the `WithValues` function to specify the `action` that you are collecting for.
-
-```go
-containerActions.WithValues("create").UpdateSince(start)
-```
-
-4. Always use a unit
-
-The metric name should describe what you are measuring but you also need to provide the unit that it is being measured with.
-For a timer, the standard unit is seconds and a counter's standard unit is a total.
-For gauges you must provide the unit.
-This package provides a standard set of units for use within the Docker projects.
-
-```go
-Nanoseconds Unit = "nanoseconds"
-Seconds Unit = "seconds"
-Bytes Unit = "bytes"
-Total Unit = "total"
-```
-
-If you need to use a unit but it is not defined in the package please open a PR to add it but first try to see if one of the already created units will work for your metric, i.e. seconds or nanoseconds vs adding milliseconds.
-
-## Docs
-
-Package documentation can be found [here](https://godoc.org/github.com/docker/go-metrics).
-
-## HTTP Metrics
-
-To instrument a http handler, you can wrap the code like this:
-
-```go
-namespace := metrics.NewNamespace("docker_distribution", "http", metrics.Labels{"handler": "your_http_handler_name"})
-httpMetrics := namespace.NewDefaultHttpMetrics()
-metrics.Register(namespace)
-instrumentedHandler = metrics.InstrumentHandler(httpMetrics, unInstrumentedHandler)
-```
-Note: The `handler` label must be provided when a new namespace is created.
-
-## Additional Metrics
-
-Additional metrics are also defined here that are not available in the prometheus client.
-If you need a custom metrics and it is generic enough to be used by multiple projects, define it here.
-
-
-## Copyright and license
-
-Copyright © 2016 Docker, Inc. All rights reserved, except as follows. Code is released under the Apache 2.0 license. The README.md file, and files in the "docs" folder are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file "LICENSE.docs". You may obtain a duplicate copy of the same license, titled CC-BY-SA-4.0, at http://creativecommons.org/licenses/by/4.0/.
diff --git a/vendor/github.com/docker/go-metrics/counter.go b/vendor/github.com/docker/go-metrics/counter.go
deleted file mode 100644
index fe36316a4..000000000
--- a/vendor/github.com/docker/go-metrics/counter.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package metrics
-
-import "github.com/prometheus/client_golang/prometheus"
-
-// Counter is a metrics that can only increment its current count
-type Counter interface {
- // Inc adds Sum(vs) to the counter. Sum(vs) must be positive.
- //
- // If len(vs) == 0, increments the counter by 1.
- Inc(vs ...float64)
-}
-
-// LabeledCounter is counter that must have labels populated before use.
-type LabeledCounter interface {
- WithValues(vs ...string) Counter
-}
-
-type labeledCounter struct {
- pc *prometheus.CounterVec
-}
-
-func (lc *labeledCounter) WithValues(vs ...string) Counter {
- return &counter{pc: lc.pc.WithLabelValues(vs...)}
-}
-
-func (lc *labeledCounter) Describe(ch chan<- *prometheus.Desc) {
- lc.pc.Describe(ch)
-}
-
-func (lc *labeledCounter) Collect(ch chan<- prometheus.Metric) {
- lc.pc.Collect(ch)
-}
-
-type counter struct {
- pc prometheus.Counter
-}
-
-func (c *counter) Inc(vs ...float64) {
- if len(vs) == 0 {
- c.pc.Inc()
- }
-
- c.pc.Add(sumFloat64(vs...))
-}
-
-func (c *counter) Describe(ch chan<- *prometheus.Desc) {
- c.pc.Describe(ch)
-}
-
-func (c *counter) Collect(ch chan<- prometheus.Metric) {
- c.pc.Collect(ch)
-}
diff --git a/vendor/github.com/docker/go-metrics/docs.go b/vendor/github.com/docker/go-metrics/docs.go
deleted file mode 100644
index 8fbdfc697..000000000
--- a/vendor/github.com/docker/go-metrics/docs.go
+++ /dev/null
@@ -1,3 +0,0 @@
-// This package is small wrapper around the prometheus go client to help enforce convention and best practices for metrics collection in Docker projects.
-
-package metrics
diff --git a/vendor/github.com/docker/go-metrics/gauge.go b/vendor/github.com/docker/go-metrics/gauge.go
deleted file mode 100644
index 74296e877..000000000
--- a/vendor/github.com/docker/go-metrics/gauge.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package metrics
-
-import "github.com/prometheus/client_golang/prometheus"
-
-// Gauge is a metric that allows incrementing and decrementing a value
-type Gauge interface {
- Inc(...float64)
- Dec(...float64)
-
- // Add adds the provided value to the gauge's current value
- Add(float64)
-
- // Set replaces the gauge's current value with the provided value
- Set(float64)
-}
-
-// LabeledGauge describes a gauge the must have values populated before use.
-type LabeledGauge interface {
- WithValues(labels ...string) Gauge
-}
-
-type labeledGauge struct {
- pg *prometheus.GaugeVec
-}
-
-func (lg *labeledGauge) WithValues(labels ...string) Gauge {
- return &gauge{pg: lg.pg.WithLabelValues(labels...)}
-}
-
-func (lg *labeledGauge) Describe(c chan<- *prometheus.Desc) {
- lg.pg.Describe(c)
-}
-
-func (lg *labeledGauge) Collect(c chan<- prometheus.Metric) {
- lg.pg.Collect(c)
-}
-
-type gauge struct {
- pg prometheus.Gauge
-}
-
-func (g *gauge) Inc(vs ...float64) {
- if len(vs) == 0 {
- g.pg.Inc()
- }
-
- g.Add(sumFloat64(vs...))
-}
-
-func (g *gauge) Dec(vs ...float64) {
- if len(vs) == 0 {
- g.pg.Dec()
- }
-
- g.Add(-sumFloat64(vs...))
-}
-
-func (g *gauge) Add(v float64) {
- g.pg.Add(v)
-}
-
-func (g *gauge) Set(v float64) {
- g.pg.Set(v)
-}
-
-func (g *gauge) Describe(c chan<- *prometheus.Desc) {
- g.pg.Describe(c)
-}
-
-func (g *gauge) Collect(c chan<- prometheus.Metric) {
- g.pg.Collect(c)
-}
diff --git a/vendor/github.com/docker/go-metrics/go.mod b/vendor/github.com/docker/go-metrics/go.mod
deleted file mode 100644
index 7e328f0cf..000000000
--- a/vendor/github.com/docker/go-metrics/go.mod
+++ /dev/null
@@ -1,5 +0,0 @@
-module github.com/docker/go-metrics
-
-go 1.11
-
-require github.com/prometheus/client_golang v1.1.0
diff --git a/vendor/github.com/docker/go-metrics/go.sum b/vendor/github.com/docker/go-metrics/go.sum
deleted file mode 100644
index b8fb9d079..000000000
--- a/vendor/github.com/docker/go-metrics/go.sum
+++ /dev/null
@@ -1,67 +0,0 @@
-github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
-github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
-github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
-github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
-github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
-github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
-github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
-github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
-github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
-github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
-github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
-github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
-github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
-github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
-github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
-github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
-github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
-github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
-github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
-github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
-github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
-github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
-github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8=
-github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
-github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
-github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=
-github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
-github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
-github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo=
-github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
-github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
-github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
-github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
-github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
-github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
-golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/vendor/github.com/docker/go-metrics/handler.go b/vendor/github.com/docker/go-metrics/handler.go
deleted file mode 100644
index 05601e9ec..000000000
--- a/vendor/github.com/docker/go-metrics/handler.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package metrics
-
-import (
- "net/http"
-
- "github.com/prometheus/client_golang/prometheus"
- "github.com/prometheus/client_golang/prometheus/promhttp"
-)
-
-// HTTPHandlerOpts describes a set of configurable options of http metrics
-type HTTPHandlerOpts struct {
- DurationBuckets []float64
- RequestSizeBuckets []float64
- ResponseSizeBuckets []float64
-}
-
-const (
- InstrumentHandlerResponseSize = iota
- InstrumentHandlerRequestSize
- InstrumentHandlerDuration
- InstrumentHandlerCounter
- InstrumentHandlerInFlight
-)
-
-type HTTPMetric struct {
- prometheus.Collector
- handlerType int
-}
-
-var (
- defaultDurationBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 25, 60}
- defaultRequestSizeBuckets = prometheus.ExponentialBuckets(1024, 2, 22) //1K to 4G
- defaultResponseSizeBuckets = defaultRequestSizeBuckets
-)
-
-// Handler returns the global http.Handler that provides the prometheus
-// metrics format on GET requests. This handler is no longer instrumented.
-func Handler() http.Handler {
- return promhttp.Handler()
-}
-
-func InstrumentHandler(metrics []*HTTPMetric, handler http.Handler) http.HandlerFunc {
- return InstrumentHandlerFunc(metrics, handler.ServeHTTP)
-}
-
-func InstrumentHandlerFunc(metrics []*HTTPMetric, handlerFunc http.HandlerFunc) http.HandlerFunc {
- var handler http.Handler
- handler = http.HandlerFunc(handlerFunc)
- for _, metric := range metrics {
- switch metric.handlerType {
- case InstrumentHandlerResponseSize:
- if collector, ok := metric.Collector.(prometheus.ObserverVec); ok {
- handler = promhttp.InstrumentHandlerResponseSize(collector, handler)
- }
- case InstrumentHandlerRequestSize:
- if collector, ok := metric.Collector.(prometheus.ObserverVec); ok {
- handler = promhttp.InstrumentHandlerRequestSize(collector, handler)
- }
- case InstrumentHandlerDuration:
- if collector, ok := metric.Collector.(prometheus.ObserverVec); ok {
- handler = promhttp.InstrumentHandlerDuration(collector, handler)
- }
- case InstrumentHandlerCounter:
- if collector, ok := metric.Collector.(*prometheus.CounterVec); ok {
- handler = promhttp.InstrumentHandlerCounter(collector, handler)
- }
- case InstrumentHandlerInFlight:
- if collector, ok := metric.Collector.(prometheus.Gauge); ok {
- handler = promhttp.InstrumentHandlerInFlight(collector, handler)
- }
- }
- }
- return handler.ServeHTTP
-}
diff --git a/vendor/github.com/docker/go-metrics/helpers.go b/vendor/github.com/docker/go-metrics/helpers.go
deleted file mode 100644
index 68b7f51b3..000000000
--- a/vendor/github.com/docker/go-metrics/helpers.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package metrics
-
-func sumFloat64(vs ...float64) float64 {
- var sum float64
- for _, v := range vs {
- sum += v
- }
-
- return sum
-}
diff --git a/vendor/github.com/docker/go-metrics/namespace.go b/vendor/github.com/docker/go-metrics/namespace.go
deleted file mode 100644
index 798315451..000000000
--- a/vendor/github.com/docker/go-metrics/namespace.go
+++ /dev/null
@@ -1,315 +0,0 @@
-package metrics
-
-import (
- "fmt"
- "sync"
-
- "github.com/prometheus/client_golang/prometheus"
-)
-
-type Labels map[string]string
-
-// NewNamespace returns a namespaces that is responsible for managing a collection of
-// metrics for a particual namespace and subsystem
-//
-// labels allows const labels to be added to all metrics created in this namespace
-// and are commonly used for data like application version and git commit
-func NewNamespace(name, subsystem string, labels Labels) *Namespace {
- if labels == nil {
- labels = make(map[string]string)
- }
- return &Namespace{
- name: name,
- subsystem: subsystem,
- labels: labels,
- }
-}
-
-// Namespace describes a set of metrics that share a namespace and subsystem.
-type Namespace struct {
- name string
- subsystem string
- labels Labels
- mu sync.Mutex
- metrics []prometheus.Collector
-}
-
-// WithConstLabels returns a namespace with the provided set of labels merged
-// with the existing constant labels on the namespace.
-//
-// Only metrics created with the returned namespace will get the new constant
-// labels. The returned namespace must be registered separately.
-func (n *Namespace) WithConstLabels(labels Labels) *Namespace {
- n.mu.Lock()
- ns := &Namespace{
- name: n.name,
- subsystem: n.subsystem,
- labels: mergeLabels(n.labels, labels),
- }
- n.mu.Unlock()
- return ns
-}
-
-func (n *Namespace) NewCounter(name, help string) Counter {
- c := &counter{pc: prometheus.NewCounter(n.newCounterOpts(name, help))}
- n.Add(c)
- return c
-}
-
-func (n *Namespace) NewLabeledCounter(name, help string, labels ...string) LabeledCounter {
- c := &labeledCounter{pc: prometheus.NewCounterVec(n.newCounterOpts(name, help), labels)}
- n.Add(c)
- return c
-}
-
-func (n *Namespace) newCounterOpts(name, help string) prometheus.CounterOpts {
- return prometheus.CounterOpts{
- Namespace: n.name,
- Subsystem: n.subsystem,
- Name: makeName(name, Total),
- Help: help,
- ConstLabels: prometheus.Labels(n.labels),
- }
-}
-
-func (n *Namespace) NewTimer(name, help string) Timer {
- t := &timer{
- m: prometheus.NewHistogram(n.newTimerOpts(name, help)),
- }
- n.Add(t)
- return t
-}
-
-func (n *Namespace) NewLabeledTimer(name, help string, labels ...string) LabeledTimer {
- t := &labeledTimer{
- m: prometheus.NewHistogramVec(n.newTimerOpts(name, help), labels),
- }
- n.Add(t)
- return t
-}
-
-func (n *Namespace) newTimerOpts(name, help string) prometheus.HistogramOpts {
- return prometheus.HistogramOpts{
- Namespace: n.name,
- Subsystem: n.subsystem,
- Name: makeName(name, Seconds),
- Help: help,
- ConstLabels: prometheus.Labels(n.labels),
- }
-}
-
-func (n *Namespace) NewGauge(name, help string, unit Unit) Gauge {
- g := &gauge{
- pg: prometheus.NewGauge(n.newGaugeOpts(name, help, unit)),
- }
- n.Add(g)
- return g
-}
-
-func (n *Namespace) NewLabeledGauge(name, help string, unit Unit, labels ...string) LabeledGauge {
- g := &labeledGauge{
- pg: prometheus.NewGaugeVec(n.newGaugeOpts(name, help, unit), labels),
- }
- n.Add(g)
- return g
-}
-
-func (n *Namespace) newGaugeOpts(name, help string, unit Unit) prometheus.GaugeOpts {
- return prometheus.GaugeOpts{
- Namespace: n.name,
- Subsystem: n.subsystem,
- Name: makeName(name, unit),
- Help: help,
- ConstLabels: prometheus.Labels(n.labels),
- }
-}
-
-func (n *Namespace) Describe(ch chan<- *prometheus.Desc) {
- n.mu.Lock()
- defer n.mu.Unlock()
-
- for _, metric := range n.metrics {
- metric.Describe(ch)
- }
-}
-
-func (n *Namespace) Collect(ch chan<- prometheus.Metric) {
- n.mu.Lock()
- defer n.mu.Unlock()
-
- for _, metric := range n.metrics {
- metric.Collect(ch)
- }
-}
-
-func (n *Namespace) Add(collector prometheus.Collector) {
- n.mu.Lock()
- n.metrics = append(n.metrics, collector)
- n.mu.Unlock()
-}
-
-func (n *Namespace) NewDesc(name, help string, unit Unit, labels ...string) *prometheus.Desc {
- name = makeName(name, unit)
- namespace := n.name
- if n.subsystem != "" {
- namespace = fmt.Sprintf("%s_%s", namespace, n.subsystem)
- }
- name = fmt.Sprintf("%s_%s", namespace, name)
- return prometheus.NewDesc(name, help, labels, prometheus.Labels(n.labels))
-}
-
-// mergeLabels merges two or more labels objects into a single map, favoring
-// the later labels.
-func mergeLabels(lbs ...Labels) Labels {
- merged := make(Labels)
-
- for _, target := range lbs {
- for k, v := range target {
- merged[k] = v
- }
- }
-
- return merged
-}
-
-func makeName(name string, unit Unit) string {
- if unit == "" {
- return name
- }
-
- return fmt.Sprintf("%s_%s", name, unit)
-}
-
-func (n *Namespace) NewDefaultHttpMetrics(handlerName string) []*HTTPMetric {
- return n.NewHttpMetricsWithOpts(handlerName, HTTPHandlerOpts{
- DurationBuckets: defaultDurationBuckets,
- RequestSizeBuckets: defaultResponseSizeBuckets,
- ResponseSizeBuckets: defaultResponseSizeBuckets,
- })
-}
-
-func (n *Namespace) NewHttpMetrics(handlerName string, durationBuckets, requestSizeBuckets, responseSizeBuckets []float64) []*HTTPMetric {
- return n.NewHttpMetricsWithOpts(handlerName, HTTPHandlerOpts{
- DurationBuckets: durationBuckets,
- RequestSizeBuckets: requestSizeBuckets,
- ResponseSizeBuckets: responseSizeBuckets,
- })
-}
-
-func (n *Namespace) NewHttpMetricsWithOpts(handlerName string, opts HTTPHandlerOpts) []*HTTPMetric {
- var httpMetrics []*HTTPMetric
- inFlightMetric := n.NewInFlightGaugeMetric(handlerName)
- requestTotalMetric := n.NewRequestTotalMetric(handlerName)
- requestDurationMetric := n.NewRequestDurationMetric(handlerName, opts.DurationBuckets)
- requestSizeMetric := n.NewRequestSizeMetric(handlerName, opts.RequestSizeBuckets)
- responseSizeMetric := n.NewResponseSizeMetric(handlerName, opts.ResponseSizeBuckets)
- httpMetrics = append(httpMetrics, inFlightMetric, requestDurationMetric, requestTotalMetric, requestSizeMetric, responseSizeMetric)
- return httpMetrics
-}
-
-func (n *Namespace) NewInFlightGaugeMetric(handlerName string) *HTTPMetric {
- labels := prometheus.Labels(n.labels)
- labels["handler"] = handlerName
- metric := prometheus.NewGauge(prometheus.GaugeOpts{
- Namespace: n.name,
- Subsystem: n.subsystem,
- Name: "in_flight_requests",
- Help: "The in-flight HTTP requests",
- ConstLabels: prometheus.Labels(labels),
- })
- httpMetric := &HTTPMetric{
- Collector: metric,
- handlerType: InstrumentHandlerInFlight,
- }
- n.Add(httpMetric)
- return httpMetric
-}
-
-func (n *Namespace) NewRequestTotalMetric(handlerName string) *HTTPMetric {
- labels := prometheus.Labels(n.labels)
- labels["handler"] = handlerName
- metric := prometheus.NewCounterVec(
- prometheus.CounterOpts{
- Namespace: n.name,
- Subsystem: n.subsystem,
- Name: "requests_total",
- Help: "Total number of HTTP requests made.",
- ConstLabels: prometheus.Labels(labels),
- },
- []string{"code", "method"},
- )
- httpMetric := &HTTPMetric{
- Collector: metric,
- handlerType: InstrumentHandlerCounter,
- }
- n.Add(httpMetric)
- return httpMetric
-}
-func (n *Namespace) NewRequestDurationMetric(handlerName string, buckets []float64) *HTTPMetric {
- if len(buckets) == 0 {
- panic("DurationBuckets must be provided")
- }
- labels := prometheus.Labels(n.labels)
- labels["handler"] = handlerName
- opts := prometheus.HistogramOpts{
- Namespace: n.name,
- Subsystem: n.subsystem,
- Name: "request_duration_seconds",
- Help: "The HTTP request latencies in seconds.",
- Buckets: buckets,
- ConstLabels: prometheus.Labels(labels),
- }
- metric := prometheus.NewHistogramVec(opts, []string{"method"})
- httpMetric := &HTTPMetric{
- Collector: metric,
- handlerType: InstrumentHandlerDuration,
- }
- n.Add(httpMetric)
- return httpMetric
-}
-
-func (n *Namespace) NewRequestSizeMetric(handlerName string, buckets []float64) *HTTPMetric {
- if len(buckets) == 0 {
- panic("RequestSizeBuckets must be provided")
- }
- labels := prometheus.Labels(n.labels)
- labels["handler"] = handlerName
- opts := prometheus.HistogramOpts{
- Namespace: n.name,
- Subsystem: n.subsystem,
- Name: "request_size_bytes",
- Help: "The HTTP request sizes in bytes.",
- Buckets: buckets,
- ConstLabels: prometheus.Labels(labels),
- }
- metric := prometheus.NewHistogramVec(opts, []string{})
- httpMetric := &HTTPMetric{
- Collector: metric,
- handlerType: InstrumentHandlerRequestSize,
- }
- n.Add(httpMetric)
- return httpMetric
-}
-
-func (n *Namespace) NewResponseSizeMetric(handlerName string, buckets []float64) *HTTPMetric {
- if len(buckets) == 0 {
- panic("ResponseSizeBuckets must be provided")
- }
- labels := prometheus.Labels(n.labels)
- labels["handler"] = handlerName
- opts := prometheus.HistogramOpts{
- Namespace: n.name,
- Subsystem: n.subsystem,
- Name: "response_size_bytes",
- Help: "The HTTP response sizes in bytes.",
- Buckets: buckets,
- ConstLabels: prometheus.Labels(labels),
- }
- metrics := prometheus.NewHistogramVec(opts, []string{})
- httpMetric := &HTTPMetric{
- Collector: metrics,
- handlerType: InstrumentHandlerResponseSize,
- }
- n.Add(httpMetric)
- return httpMetric
-}
diff --git a/vendor/github.com/docker/go-metrics/register.go b/vendor/github.com/docker/go-metrics/register.go
deleted file mode 100644
index 708358df0..000000000
--- a/vendor/github.com/docker/go-metrics/register.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package metrics
-
-import "github.com/prometheus/client_golang/prometheus"
-
-// Register adds all the metrics in the provided namespace to the global
-// metrics registry
-func Register(n *Namespace) {
- prometheus.MustRegister(n)
-}
-
-// Deregister removes all the metrics in the provided namespace from the
-// global metrics registry
-func Deregister(n *Namespace) {
- prometheus.Unregister(n)
-}
diff --git a/vendor/github.com/docker/go-metrics/timer.go b/vendor/github.com/docker/go-metrics/timer.go
deleted file mode 100644
index 824c98739..000000000
--- a/vendor/github.com/docker/go-metrics/timer.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package metrics
-
-import (
- "time"
-
- "github.com/prometheus/client_golang/prometheus"
-)
-
-// StartTimer begins a timer observation at the callsite. When the target
-// operation is completed, the caller should call the return done func().
-func StartTimer(timer Timer) (done func()) {
- start := time.Now()
- return func() {
- timer.Update(time.Since(start))
- }
-}
-
-// Timer is a metric that allows collecting the duration of an action in seconds
-type Timer interface {
- // Update records an observation, duration, and converts to the target
- // units.
- Update(duration time.Duration)
-
- // UpdateSince will add the duration from the provided starting time to the
- // timer's summary with the precisions that was used in creation of the timer
- UpdateSince(time.Time)
-}
-
-// LabeledTimer is a timer that must have label values populated before use.
-type LabeledTimer interface {
- WithValues(labels ...string) *labeledTimerObserver
-}
-
-type labeledTimer struct {
- m *prometheus.HistogramVec
-}
-
-type labeledTimerObserver struct {
- m prometheus.Observer
-}
-
-func (lbo *labeledTimerObserver) Update(duration time.Duration) {
- lbo.m.Observe(duration.Seconds())
-}
-
-func (lbo *labeledTimerObserver) UpdateSince(since time.Time) {
- lbo.m.Observe(time.Since(since).Seconds())
-}
-
-func (lt *labeledTimer) WithValues(labels ...string) *labeledTimerObserver {
- return &labeledTimerObserver{m: lt.m.WithLabelValues(labels...)}
-}
-
-func (lt *labeledTimer) Describe(c chan<- *prometheus.Desc) {
- lt.m.Describe(c)
-}
-
-func (lt *labeledTimer) Collect(c chan<- prometheus.Metric) {
- lt.m.Collect(c)
-}
-
-type timer struct {
- m prometheus.Observer
-}
-
-func (t *timer) Update(duration time.Duration) {
- t.m.Observe(duration.Seconds())
-}
-
-func (t *timer) UpdateSince(since time.Time) {
- t.m.Observe(time.Since(since).Seconds())
-}
-
-func (t *timer) Describe(c chan<- *prometheus.Desc) {
- c <- t.m.(prometheus.Metric).Desc()
-}
-
-func (t *timer) Collect(c chan<- prometheus.Metric) {
- // Are there any observers that don't implement Collector? It is really
- // unclear what the point of the upstream change was, but we'll let this
- // panic if we get an observer that doesn't implement collector. In this
- // case, we should almost always see metricVec objects, so this should
- // never panic.
- t.m.(prometheus.Collector).Collect(c)
-}
diff --git a/vendor/github.com/docker/go-metrics/unit.go b/vendor/github.com/docker/go-metrics/unit.go
deleted file mode 100644
index c96622f90..000000000
--- a/vendor/github.com/docker/go-metrics/unit.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package metrics
-
-// Unit represents the type or precision of a metric that is appended to
-// the metrics fully qualified name
-type Unit string
-
-const (
- Nanoseconds Unit = "nanoseconds"
- Seconds Unit = "seconds"
- Bytes Unit = "bytes"
- Total Unit = "total"
-)