Cleanup code comments and lint fixes
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
		| @@ -101,7 +101,6 @@ func (ts *localTransferService) importStream(ctx context.Context, i transfer.Ima | |||||||
| 			tops.Progress(transfer.Progress{ | 			tops.Progress(transfer.Progress{ | ||||||
| 				Event: "saved", | 				Event: "saved", | ||||||
| 				Name:  img.Name, | 				Name:  img.Name, | ||||||
| 				//Digest: img.Target.Digest.String(), |  | ||||||
| 			}) | 			}) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -103,7 +103,6 @@ func (j *ProgressTracker) HandleProgress(ctx context.Context, pf transfer.Progre | |||||||
| 							Event:    j.transferState, | 							Event:    j.transferState, | ||||||
| 							Name:     job.name, | 							Name:     job.name, | ||||||
| 							Parents:  job.parents, | 							Parents:  job.parents, | ||||||
| 							//Digest:   job.desc.Digest.String(), |  | ||||||
| 							Progress: status.Offset, | 							Progress: status.Offset, | ||||||
| 							Total:    status.Total, | 							Total:    status.Total, | ||||||
| 						}) | 						}) | ||||||
| @@ -120,7 +119,6 @@ func (j *ProgressTracker) HandleProgress(ctx context.Context, pf transfer.Progre | |||||||
| 							Event:    "complete", | 							Event:    "complete", | ||||||
| 							Name:     job.name, | 							Name:     job.name, | ||||||
| 							Parents:  job.parents, | 							Parents:  job.parents, | ||||||
| 							//Digest:   job.desc.Digest.String(), |  | ||||||
| 							Progress: job.desc.Size, | 							Progress: job.desc.Size, | ||||||
| 							Total:    job.desc.Size, | 							Total:    job.desc.Size, | ||||||
| 						}) | 						}) | ||||||
|   | |||||||
| @@ -18,6 +18,7 @@ package proxy | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
|  | 	"errors" | ||||||
| 	"io" | 	"io" | ||||||
|  |  | ||||||
| 	transferapi "github.com/containerd/containerd/api/services/transfer/v1" | 	transferapi "github.com/containerd/containerd/api/services/transfer/v1" | ||||||
| @@ -61,7 +62,7 @@ func (p *proxyTransferer) Transfer(ctx context.Context, src interface{}, dst int | |||||||
| 			for { | 			for { | ||||||
| 				a, err := stream.Recv() | 				a, err := stream.Recv() | ||||||
| 				if err != nil { | 				if err != nil { | ||||||
| 					if err != io.EOF { | 					if !errors.Is(err, io.EOF) { | ||||||
| 						log.G(ctx).WithError(err).Error("progress stream failed to recv") | 						log.G(ctx).WithError(err).Error("progress stream failed to recv") | ||||||
| 					} | 					} | ||||||
| 					return | 					return | ||||||
|   | |||||||
| @@ -113,7 +113,7 @@ func SendStream(ctx context.Context, r io.Reader, stream streaming.Stream) { | |||||||
| 			b := (*buf)[:max] | 			b := (*buf)[:max] | ||||||
| 			n, err := r.Read(b) | 			n, err := r.Read(b) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				if err != io.EOF { | 				if !errors.Is(err, io.EOF) { | ||||||
| 					log.G(ctx).WithError(err).Errorf("failed to read stream source") | 					log.G(ctx).WithError(err).Errorf("failed to read stream source") | ||||||
| 					// TODO: Send error message on stream before close to allow remote side to return error | 					// TODO: Send error message on stream before close to allow remote side to return error | ||||||
| 				} | 				} | ||||||
|   | |||||||
| @@ -85,7 +85,7 @@ type ImageExportStreamer interface { | |||||||
| } | } | ||||||
|  |  | ||||||
| type ImageUnpacker interface { | type ImageUnpacker interface { | ||||||
| 	// TODO: Or unpack options? | 	// TODO: consider using unpack options | ||||||
| 	UnpackPlatforms() []unpack.Platform | 	UnpackPlatforms() []unpack.Platform | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -103,6 +103,10 @@ func WithProgress(f ProgressFunc) Opt { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Progress is used to represent a particular progress event or incremental | ||||||
|  | // update for the provided named object. The parents represent the names of | ||||||
|  | // the objects which initiated the progress for the provided named object. | ||||||
|  | // The name and what object it represents is determined by the implementation. | ||||||
| type Progress struct { | type Progress struct { | ||||||
| 	Event    string | 	Event    string | ||||||
| 	Name     string | 	Name     string | ||||||
| @@ -111,21 +115,3 @@ type Progress struct { | |||||||
| 	Total    int64 | 	Total    int64 | ||||||
| 	// Descriptor? | 	// Descriptor? | ||||||
| } | } | ||||||
|  |  | ||||||
| /* |  | ||||||
| // Distribution options |  | ||||||
| // Stream handler |  | ||||||
| // Progress rate |  | ||||||
| // Unpack options |  | ||||||
| // Remote options |  | ||||||
| // Cases: |  | ||||||
| //  Registry -> Content/ImageStore (pull) |  | ||||||
| //  Registry -> Registry |  | ||||||
| //  Content/ImageStore -> Registry (push) |  | ||||||
| //  Content/ImageStore -> Content/ImageStore (tag) |  | ||||||
| // Common fetch/push interface for registry, content/imagestore, OCI index |  | ||||||
| // Always starts with string for source and destination, on client side, does not need to resolve |  | ||||||
| //  Higher level implementation just takes strings and options |  | ||||||
| //  Lower level implementation takes pusher/fetcher? |  | ||||||
|  |  | ||||||
| */ |  | ||||||
|   | |||||||
| @@ -17,6 +17,7 @@ | |||||||
| package streaming | package streaming | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
|  | 	"errors" | ||||||
| 	"io" | 	"io" | ||||||
|  |  | ||||||
| 	api "github.com/containerd/containerd/api/services/streaming/v1" | 	api "github.com/containerd/containerd/api/services/streaming/v1" | ||||||
| @@ -107,7 +108,7 @@ func (ss *serviceStream) Send(a typeurl.Any) error { | |||||||
|  |  | ||||||
| func (ss *serviceStream) Recv() (a typeurl.Any, err error) { | func (ss *serviceStream) Recv() (a typeurl.Any, err error) { | ||||||
| 	a, err = ss.s.Recv() | 	a, err = ss.s.Recv() | ||||||
| 	if err != io.EOF { | 	if !errors.Is(err, io.EOF) { | ||||||
| 		err = errdefs.FromGRPC(err) | 		err = errdefs.FromGRPC(err) | ||||||
| 	} | 	} | ||||||
| 	return | 	return | ||||||
|   | |||||||
| @@ -119,7 +119,6 @@ func (s *service) Transfer(ctx context.Context, req *transferapi.TransferRequest | |||||||
| 		return nil, errdefs.ToGRPC(err) | 		return nil, errdefs.ToGRPC(err) | ||||||
| 	} | 	} | ||||||
| 	dst, err := s.convertAny(ctx, req.Destination) | 	dst, err := s.convertAny(ctx, req.Destination) | ||||||
| 	plugins.ResolveType(req.Source) |  | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errdefs.ToGRPC(err) | 		return nil, errdefs.ToGRPC(err) | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Derek McGowan
					Derek McGowan