Mirror writes to database: Manifests PUT Handler (when tag is provided)
Context
This issue is meant to investigate steps which are required to mirror metadata writes generated from calls the Manifests PUT Handler.
Affected Route(s)
PUT /v2/<name>/manifests/<reference>
Detailed Handler Operations.
-
Instantiate a
distribution.ManifestService, the concrete type is astorage.manifestStore -
Copy manifest payload into a
bytes.Buffer -
Get the
mediaType -
Unmarshal the buffer into a
ManifestandDescriptor -
Validate payload digest
-
Determine if this
Manifestis an OCI Manifest -
Call
ManifestService.Put(manifestHandler, Manifest, options...- Switch on
manifest.(type)and pass of to ManifestHandlers, these all use alinkedBlobStore- Type specific verification
- Get mediatype and payload from
Manifest -
linkedblobStore.Put(ctx, mediatype, payload)- determine the digest from the payload
-
blobStore.Put(ctx, mediatype, payload)- Return early if content already present
- Get the
blobDataPathfrom the digest (<root>/v2/blobs/<algorithm>/<first two hex bytes of digest>/<hex digest>/data) - Call
StorageDriver.PutContentto write the content to theblobDataPath
- save the
distribution.Descriptorreturned fromblobStore.Put - call
linkedblobStore.blobAccessController.SetDescriptor(ctx, digest, distribution.Descriptor)which is a noop... - call
linkedblobStore.linkBlob(ctx, distribution.Descriptor)- find the
manifestRevisionLinkPathSpec(<root>/v2/repositories/<name>/_manifests/revisions/<algorithm>/<hex digest>/link) - call
linkedBlobStore.blobStore.link(ctx, manifestRevisionLinkPathSpec, distribution.Descriptor.Digest)- call
StorageDriver.PutContent(ctx, manifestRevisionLinkPathSpec, []byte(Descriptor.Digest))
- call
- find the
- Switch on
-
If the
manifestHandler.Tagis not""- Instantiate a
distribution.TagServiceand callTagService.Tag(ctx,manifestHandler.Tag, distribution.Descriptor), the concrete type is astorage.tagStore- get the path for
manifestTagCurrentPathSpec(<root>/v2/repositories/<name>/_manifests/tags/<tag>/current/link) - Instantiate a
linkedBlobStoreand calllinkedBlobStore.linkBlob(ctx, distribution.Descriptor)- find the
manifestTagIndexEntryLinkPathSpec:(<root>/v2/repositories/<name>/_manifests/tags/<tag>/index/<algorithm>/<hex digest>/link) - call
linkedBlobStore.blobStore.link(ctx, manifestTagIndexEntryLinkPathSpec, distribution.Descriptor.Digest) 1. callStorageDriver.PutContent(ctx, manifestTagIndexEntryLinkPathSpec, []byte(Descriptor.Digest))
- find the
- call `blobStore.blobStore.link(ctx, manifestTagCurrentPathSpec, distribution.Descriptor.Digest)
- call `StorageDriver.PutContent(ctx, manifestTagCurrentPathSpec, []byte(distribution.Descriptor.Digest))
- get the path for
- Instantiate a
-
Construct a canonical url for the uploaded manifest.
-
Write
http.StatusCreated
Storage Path Example
Here's a diagram of the writes that would be performed on a new manifest with a tag.
Edited by Tim Rizzi