Mirror writes to database: Manifests PUT Handler (when tag is NOT provided)
Context
This issue is meant to investigate steps that are required to mirror metadata writes generated from calls the Manifests PUT Handler when the tag is not present.
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
Manifest
andDescriptor
-
Validate payload digest
-
Determine if this
Manifest
is 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
blobDataPath
from the digest (<root>/v2/blobs/<algorithm>/<first two hex bytes of digest>/<hex digest>/data
) - Call
StorageDriver.PutContent
to write the content to theblobDataPath
- save the
distribution.Descriptor
returned 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.Tag
is not""
- Instantiate a
distribution.TagService
and 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
linkedBlobStore
and 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. call
StorageDriver.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.