mirror of
https://github.com/distribution/distribution.git
synced 2025-09-09 02:40:00 +00:00
Move context package internal
Our context package predates the establishment of current best practices regarding context usage and it shows. It encourages bad practices such as using contexts to propagate non-request-scoped values like the application version and using string-typed keys for context values. Move the package internal to remove it from the API surface of distribution/v3@v3.0.0 so we are free to iterate on it without being constrained by compatibility. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/distribution/distribution/v3"
|
||||
"github.com/distribution/distribution/v3/context"
|
||||
"github.com/distribution/distribution/v3/internal/dcontext"
|
||||
"github.com/distribution/distribution/v3/manifest/manifestlist"
|
||||
"github.com/distribution/distribution/v3/manifest/schema2"
|
||||
"github.com/opencontainers/go-digest"
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// MakeManifestList constructs a manifest list out of a list of manifest digests
|
||||
func MakeManifestList(blobstatter distribution.BlobStatter, manifestDigests []digest.Digest) (*manifestlist.DeserializedManifestList, error) {
|
||||
ctx := context.Background()
|
||||
ctx := dcontext.Background()
|
||||
|
||||
manifestDescriptors := make([]manifestlist.ManifestDescriptor, 0, len(manifestDigests))
|
||||
for _, manifestDigest := range manifestDigests {
|
||||
@@ -39,7 +39,7 @@ func MakeManifestList(blobstatter distribution.BlobStatter, manifestDigests []di
|
||||
// MakeSchema2Manifest constructs a schema 2 manifest from a given list of digests and returns
|
||||
// the digest of the manifest
|
||||
func MakeSchema2Manifest(repository distribution.Repository, digests []digest.Digest) (distribution.Manifest, error) {
|
||||
ctx := context.Background()
|
||||
ctx := dcontext.Background()
|
||||
blobStore := repository.Blobs(ctx)
|
||||
|
||||
var configJSON []byte
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/distribution/distribution/v3"
|
||||
"github.com/distribution/distribution/v3/context"
|
||||
"github.com/distribution/distribution/v3/internal/dcontext"
|
||||
"github.com/opencontainers/go-digest"
|
||||
)
|
||||
|
||||
@@ -96,7 +96,7 @@ func CreateRandomLayers(n int) (map[digest.Digest]io.ReadSeeker, error) {
|
||||
|
||||
// UploadBlobs lets you upload blobs to a repository
|
||||
func UploadBlobs(repository distribution.Repository, layers map[digest.Digest]io.ReadSeeker) error {
|
||||
ctx := context.Background()
|
||||
ctx := dcontext.Background()
|
||||
for dgst, rs := range layers {
|
||||
wr, err := repository.Blobs(ctx).Create(ctx)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user