MCPcopy Create free account
hub / github.com/containerd/nerdctl / ReaderAt

Method ReaderAt

pkg/containerdutil/content.go:45–67  ·  view source on GitHub ↗
(ctx context.Context, desc ocispec.Descriptor)

Source from the content-addressed store, hash-verified

43}
44
45func (provider *providerWithCache) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error) {
46 key := desc.Digest.String()
47 // If we had en entry already, get the size over
48 value, ok := provider.cache[key]
49 if !ok {
50 newReaderAt, err := provider.native.ReaderAt(ctx, desc)
51 if err != nil {
52 return nil, err
53 }
54 // Build the final object
55 value = &readerAtWithCache{
56 newReaderAt,
57 -1,
58 func() {
59 delete(provider.cache, key)
60 },
61 }
62 // Cache it
63 provider.cache[key] = value
64 }
65
66 return value, nil
67}
68
69// ReaderAtWithCache implements the content.ReaderAt interface
70type readerAtWithCache struct {

Callers 3

isReusableESGZFunction · 0.45
readLayerContentFunction · 0.45
CreateFunction · 0.45

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected