Pārlūkot izejas kodu

distribution/xfer: add TODO for return error on Registered()

There's currently four implementations in our code: one in distribution, two in
BuildKit-related code, and one "mock" for testing:

- https://github.com/moby/moby/blob/65b8bcc3216ec64c8f761f35c6caba109b788254/builder/builder-next/worker/worker.go#L452-L455
- https://github.com/moby/moby/blob/65b8bcc3216ec64c8f761f35c6caba109b788254/builder/builder-next/adapters/containerimage/pull.go#L648-L651
- https://github.com/moby/moby/blob/65b8bcc3216ec64c8f761f35c6caba109b788254/distribution/pull_v2.go#L318-L321
- https://github.com/moby/moby/blob/65b8bcc3216ec64c8f761f35c6caba109b788254/distribution/xfer/download_test.go#L186-L188

All of these call a metadata-service to register the DiffID, and all of those
may return an error, which currently gets ignored.

We should consider changing the signature to return possible errors, so that
the callsite can decide how to handle them (which could be just "log" the error
or handle them in other ways).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 gadi atpakaļ
vecāks
revīzija
69b0913e1f
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      distribution/xfer/download.go

+ 5 - 0
distribution/xfer/download.go

@@ -94,6 +94,11 @@ type DownloadDescriptor interface {
 // DownloadDescriptorWithRegistered is successful.
 type DownloadDescriptorWithRegistered interface {
 	DownloadDescriptor
+
+	// TODO existing implementations in distribution and builder-next swallow errors
+	// when registering the diffID. Consider changing the Registered signature
+	// to return the error.
+
 	Registered(diffID layer.DiffID)
 }