MCPcopy
hub / github.com/containerd/containerd / writeIndex

Function writeIndex

client/client.go:622–632  ·  view source on GitHub ↗
(ctx context.Context, index *ocispec.Index, client *Client, ref string)

Source from the content-addressed store, hash-verified

620}
621
622func writeIndex(ctx context.Context, index *ocispec.Index, client *Client, ref string) (d ocispec.Descriptor, err error) {
623 labels := map[string]string{}
624 for i, m := range index.Manifests {
625 labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i)] = m.Digest.String()
626 }
627 data, err := json.Marshal(index)
628 if err != nil {
629 return ocispec.Descriptor{}, err
630 }
631 return writeContent(ctx, client.ContentStore(), ocispec.MediaTypeImageIndex, ref, bytes.NewReader(data), content.WithLabels(labels))
632}
633
634func decodeIndex(ctx context.Context, store content.Provider, desc ocispec.Descriptor) (*ocispec.Index, error) {
635 var index ocispec.Index

Callers 2

CheckpointMethod · 0.85
CheckpointMethod · 0.85

Calls 5

WithLabelsFunction · 0.92
writeContentFunction · 0.85
ContentStoreMethod · 0.65
StringMethod · 0.45
MarshalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…