@@ -80,7 +80,7 @@ type chunkedDiffer struct {
8080 convertToZstdChunked bool
8181
8282 // Chunked metadata
83- // This is usually set in GetDiffer , but if convertToZstdChunked, it is only computed in chunkedDiffer.ApplyDiff
83+ // This is usually set in NewDiffer , but if convertToZstdChunked, it is only computed in chunkedDiffer.ApplyDiff
8484 // ==========
8585 // tocDigest is the digest of the TOC document when the layer
8686 // is partially pulled, or "" if not relevant to consumers.
@@ -95,7 +95,7 @@ type chunkedDiffer struct {
9595 skipValidation bool
9696
9797 // Long-term caches
98- // This is set in GetDiffer , when the caller must not hold any storage locks, and later consumed in .ApplyDiff()
98+ // This is set in NewDiffer , when the caller must not hold any storage locks, and later consumed in .ApplyDiff()
9999 // ==========
100100 layersCache * layersCache
101101 copyBuffer []byte
@@ -200,10 +200,11 @@ func (c *chunkedDiffer) Close() error {
200200 return nil
201201}
202202
203- // GetDiffer returns a differ than can be used with [Store.PrepareStagedLayer].
203+ // NewDiffer returns a differ than can be used with [Store.PrepareStagedLayer].
204204// If it returns an error that matches ErrFallbackToOrdinaryLayerDownload, the caller can
205205// retry the operation with a different method.
206- func GetDiffer (ctx context.Context , store storage.Store , blobDigest digest.Digest , blobSize int64 , annotations map [string ]string , iss ImageSourceSeekable ) (graphdriver.Differ , error ) {
206+ // The caller must call Close() on the returned Differ.
207+ func NewDiffer (ctx context.Context , store storage.Store , blobDigest digest.Digest , blobSize int64 , annotations map [string ]string , iss ImageSourceSeekable ) (graphdriver.Differ , error ) {
207208 pullOptions := parsePullOptions (store )
208209
209210 if ! pullOptions .enablePartialImages {
@@ -266,7 +267,7 @@ func (e errFallbackCanConvert) Unwrap() error {
266267 return e .err
267268}
268269
269- // getProperDiffer is an implementation detail of GetDiffer .
270+ // getProperDiffer is an implementation detail of NewDiffer .
270271// It returns a “proper” differ (not a convert_images one) if possible.
271272// May return an error matching ErrFallbackToOrdinaryLayerDownload if a fallback to an alternative
272273// (either makeConvertFromRawDiffer, or a non-partial pull) is permissible.
@@ -1873,7 +1874,7 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions, diff
18731874 }
18741875 output .UncompressedDigest = digester .Digest ()
18751876 default :
1876- // We are checking for this earlier in GetDiffer , so this should not be reachable.
1877+ // We are checking for this earlier in NewDiffer , so this should not be reachable.
18771878 return output , fmt .Errorf (`internal error: layer's UncompressedDigest is unknown and "insecure_allow_unpredictable_image_contents" is not set` )
18781879 }
18791880 }
0 commit comments