Skip to content

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>

API Reference

Detailed Handler Operations.

  1. Instantiate a distribution.ManifestService, the concrete type is a storage.manifestStore

  2. Copy manifest payload into a bytes.Buffer

  3. Get the mediaType

  4. Unmarshal the buffer into a Manifest and Descriptor

  5. Validate payload digest

  6. Determine if this Manifest is an OCI Manifest

  7. Call ManifestService.Put(manifestHandler, Manifest, options...

    1. Switch on manifest.(type) and pass of to ManifestHandlers, these all use a linkedBlobStore
      1. Type specific verification
      2. Get mediatype and payload from Manifest
      3. linkedblobStore.Put(ctx, mediatype, payload)
        1. determine the digest from the payload
        2. blobStore.Put(ctx, mediatype, payload)
          1. Return early if content already present
          2. Get the blobDataPath from the digest (<root>/v2/blobs/<algorithm>/<first two hex bytes of digest>/<hex digest>/data)
          3. Call StorageDriver.PutContent to write the content to the blobDataPath
        3. save the distribution.Descriptor returned from blobStore.Put
        4. call linkedblobStore.blobAccessController.SetDescriptor(ctx, digest, distribution.Descriptor) which is a noop...
        5. call linkedblobStore.linkBlob(ctx, distribution.Descriptor)
          1. find the manifestRevisionLinkPathSpec (<root>/v2/repositories/<name>/_manifests/revisions/<algorithm>/<hex digest>/link)
          2. call linkedBlobStore.blobStore.link(ctx, manifestRevisionLinkPathSpec, distribution.Descriptor.Digest)
            1. call StorageDriver.PutContent(ctx, manifestRevisionLinkPathSpec, []byte(Descriptor.Digest))
  8. If the manifestHandler.Tag is not ""

    1. Instantiate a distribution.TagService and call TagService.Tag(ctx,manifestHandler.Tag, distribution.Descriptor), the concrete type is a storage.tagStore
      1. get the path for manifestTagCurrentPathSpec (<root>/v2/repositories/<name>/_manifests/tags/<tag>/current/link)
      2. Instantiate a linkedBlobStore and call linkedBlobStore.linkBlob(ctx, distribution.Descriptor)
        1. find the manifestTagIndexEntryLinkPathSpec: (<root>/v2/repositories/<name>/_manifests/tags/<tag>/index/<algorithm>/<hex digest>/link)
        2. call linkedBlobStore.blobStore.link(ctx, manifestTagIndexEntryLinkPathSpec, distribution.Descriptor.Digest) 1. call StorageDriver.PutContent(ctx, manifestTagIndexEntryLinkPathSpec, []byte(Descriptor.Digest))
      3. call `blobStore.blobStore.link(ctx, manifestTagCurrentPathSpec, distribution.Descriptor.Digest)
        1. call `StorageDriver.PutContent(ctx, manifestTagCurrentPathSpec, []byte(distribution.Descriptor.Digest))
  9. Construct a canonical url for the uploaded manifest.

  10. Write http.StatusCreated

Storage Path Example

Here's a diagram of the writes that would be performed on a new manifest with a tag.

flowchart.svg flowchart.md