MCPcopy Index your code
hub / github.com/containerd/containerd / NewLabeledStore

Function NewLabeledStore

plugins/content/local/store.go:88–109  ·  view source on GitHub ↗

NewLabeledStore returns a new content store using the provided label store Note: content stores which are used underneath a metadata store may not require labels and should use `NewStore`. `NewLabeledStore` is primarily useful for tests or standalone implementations.

(root string, ls LabelStore)

Source from the content-addressed store, hash-verified

86// require labels and should use `NewStore`. `NewLabeledStore` is primarily
87// useful for tests or standalone implementations.
88func NewLabeledStore(root string, ls LabelStore) (content.Store, error) {
89 if _, err := os.Stat(root); err != nil {
90 if !errors.Is(err, fs.ErrNotExist) {
91 return nil, fmt.Errorf("failed to stat %q: %w", root, err)
92 }
93 if err := os.MkdirAll(root, 0755); err != nil {
94 return nil, fmt.Errorf("failed to mkdir %q: %w", root, err)
95 }
96 }
97 supported, err := fsverity.IsSupported(root)
98 if err != nil {
99 log.L.WithError(err).WithField("path", root).Warnf("failed check for fsverity support")
100 }
101 s := &store{
102 root: root,
103 ls: ls,
104 integritySupported: supported,
105 locks: map[string]*lock{},
106 }
107 s.ensureIngestRootOnce = sync.OnceValue(s.ensureIngestRoot)
108 return s, nil
109}
110
111func (s *store) Info(ctx context.Context, dgst digest.Digest) (content.Info, error) {
112 p, err := s.blobPath(dgst)

Callers 5

NewContentStoreFunction · 0.92
NewStoreFunction · 0.85
TestContentFunction · 0.85
TestContentRootDirFunction · 0.85

Calls 3

IsSupportedFunction · 0.92
StatMethod · 0.65
MkdirAllMethod · 0.65

Tested by 3

TestContentFunction · 0.68
TestContentRootDirFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…