manifest: Store layers inside manifests consistently as values.

Commit 1829fb61 ("manifest: Fix crash on startup when trying to clean up
unused files (#5840)") changed the config layer stored in manifests
from a pointer to a value. This was done in order to avoid potential
nil pointer dereferences after it is deserialized from JSON in the
event that the field is missing.

This changes the Layers slice to also be stored by value. This enables
consistency in handling across the two objects.
This commit is contained in:
Jesse Gross 2024-08-07 14:22:17 -07:00
parent 97ec8cfd4e
commit 7edaf6e7e8
6 changed files with 33 additions and 33 deletions

View file

@ -26,7 +26,7 @@ import (
var blobUploadManager sync.Map
type blobUpload struct {
*Layer
Layer
Total int64
Completed atomic.Int64
@ -362,7 +362,7 @@ func (p *progressWriter) Rollback() {
p.written = 0
}
func uploadBlob(ctx context.Context, mp ModelPath, layer *Layer, opts *registryOptions, fn func(api.ProgressResponse)) error {
func uploadBlob(ctx context.Context, mp ModelPath, layer Layer, opts *registryOptions, fn func(api.ProgressResponse)) error {
requestURL := mp.BaseURL()
requestURL = requestURL.JoinPath("v2", mp.GetNamespaceRepository(), "blobs", layer.Digest)