Skip to content

Commit

Permalink
Rename Size_ to Size
Browse files Browse the repository at this point in the history
Previouslty "Size" was reserved by protoc-gen-gogoctrd and user-generated
"Size" was automatically renamed to "Size_" to avoid conflicts.

Signed-off-by: Kazuyoshi Kato <[email protected]>
  • Loading branch information
kzys committed Apr 22, 2022
1 parent e3db7de commit 1a095e1
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion container_checkpoint_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Conta
platformSpec := platforms.DefaultSpec()
index.Manifests = append(index.Manifests, imagespec.Descriptor{
MediaType: d.MediaType,
Size: d.Size_,
Size: d.Size,
Digest: digest.Digest(d.Digest),
Platform: &platformSpec,
Annotations: d.Annotations,
Expand Down
2 changes: 1 addition & 1 deletion content/proxy/content_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (ra *remoteReaderAt) ReadAt(p []byte, off int64) (n int, err error) {
rr := &contentapi.ReadContentRequest{
Digest: ra.digest.String(),
Offset: off,
Size_: int64(len(p)),
Size: int64(len(p)),
}
// we need a child context with cancel, or the eventually called
// grpc.NewStream will leak the goroutine until the whole thing is cleared.
Expand Down
4 changes: 2 additions & 2 deletions content/proxy/content_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (pcs *proxyContentStore) negotiate(ctx context.Context, ref string, size in
func infoToGRPC(info *content.Info) *contentapi.Info {
return &contentapi.Info{
Digest: info.Digest.String(),
Size_: info.Size,
Size: info.Size,
CreatedAt: protobuf.ToTimestamp(info.CreatedAt),
UpdatedAt: protobuf.ToTimestamp(info.UpdatedAt),
Labels: info.Labels,
Expand All @@ -227,7 +227,7 @@ func infoToGRPC(info *content.Info) *contentapi.Info {
func infoFromGRPC(info *contentapi.Info) content.Info {
return content.Info{
Digest: digest.Digest(info.Digest),
Size: info.Size_,
Size: info.Size,
CreatedAt: protobuf.FromTimestamp(info.CreatedAt),
UpdatedAt: protobuf.FromTimestamp(info.UpdatedAt),
Labels: info.Labels,
Expand Down
2 changes: 1 addition & 1 deletion contrib/snapshotservice/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (s service) Usage(ctx context.Context, ur *snapshotsapi.UsageRequest) (*sna

return &snapshotsapi.UsageResponse{
Inodes: usage.Inodes,
Size_: usage.Size,
Size: usage.Size,
}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func toDescriptor(d *types.Descriptor) ocispec.Descriptor {
return ocispec.Descriptor{
MediaType: d.MediaType,
Digest: digest.Digest(d.Digest),
Size: d.Size_,
Size: d.Size,
Annotations: d.Annotations,
}
}
Expand All @@ -107,7 +107,7 @@ func fromDescriptor(d ocispec.Descriptor) *types.Descriptor {
return &types.Descriptor{
MediaType: d.MediaType,
Digest: d.Digest.String(),
Size_: d.Size,
Size: d.Size,
Annotations: d.Annotations,
}
}
Expand Down
4 changes: 2 additions & 2 deletions image_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func imagesFromProto(imagespb []*imagesapi.Image) []images.Image {
func descFromProto(desc *types.Descriptor) ocispec.Descriptor {
return ocispec.Descriptor{
MediaType: desc.MediaType,
Size: desc.Size_,
Size: desc.Size,
Digest: digest.Digest(desc.Digest),
Annotations: desc.Annotations,
}
Expand All @@ -150,7 +150,7 @@ func descFromProto(desc *types.Descriptor) ocispec.Descriptor {
func descToProto(desc *ocispec.Descriptor) *types.Descriptor {
return &types.Descriptor{
MediaType: desc.MediaType,
Size_: desc.Size,
Size: desc.Size,
Digest: desc.Digest.String(),
Annotations: desc.Annotations,
}
Expand Down
2 changes: 1 addition & 1 deletion integration/remote/remote_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (r *ImageService) ImageStatus(image *runtimeapi.ImageSpec, opts ...grpc.Cal
}

if resp.Image != nil {
if resp.Image.Id == "" || resp.Image.Size_ == 0 {
if resp.Image.Id == "" || resp.Image.Size() == 0 {
errorMessage := fmt.Sprintf("Id or size of image %q is not set", image.Image)
klog.Errorf("ImageStatus failed: %s", errorMessage)
return nil, errors.New(errorMessage)
Expand Down
8 changes: 4 additions & 4 deletions services/content/contentserver/contentserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (s *service) List(req *api.ListContentRequest, session api.Content_ListServ
if err := s.store.Walk(session.Context(), func(info content.Info) error {
buffer = append(buffer, &api.Info{
Digest: info.Digest.String(),
Size_: info.Size,
Size: info.Size,
CreatedAt: protobuf.ToTimestamp(info.CreatedAt),
Labels: info.Labels,
})
Expand Down Expand Up @@ -167,7 +167,7 @@ func (s *service) Read(req *api.ReadContentRequest, session api.Content_ReadServ
offset = req.Offset
// size is read size, not the expected size of the blob (oi.Size), which the caller might not be aware of.
// offset+size can be larger than oi.Size.
size = req.Size_
size = req.Size

// TODO(stevvooe): Using the global buffer pool. At 32KB, it is probably
// little inefficient for work over a fast network. We can tune this later.
Expand Down Expand Up @@ -456,7 +456,7 @@ func (s *service) Abort(ctx context.Context, req *api.AbortRequest) (*ptypes.Emp
func infoToGRPC(info content.Info) *api.Info {
return &api.Info{
Digest: info.Digest.String(),
Size_: info.Size,
Size: info.Size,
CreatedAt: protobuf.ToTimestamp(info.CreatedAt),
UpdatedAt: protobuf.ToTimestamp(info.UpdatedAt),
Labels: info.Labels,
Expand All @@ -466,7 +466,7 @@ func infoToGRPC(info content.Info) *api.Info {
func infoFromGRPC(info *api.Info) content.Info {
return content.Info{
Digest: digest.Digest(info.Digest),
Size: info.Size_,
Size: info.Size,
CreatedAt: protobuf.FromTimestamp(info.CreatedAt),
UpdatedAt: protobuf.FromTimestamp(info.UpdatedAt),
Labels: info.Labels,
Expand Down
4 changes: 2 additions & 2 deletions services/diff/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func toDescriptor(d *types.Descriptor) ocispec.Descriptor {
return ocispec.Descriptor{
MediaType: d.MediaType,
Digest: digest.Digest(d.Digest),
Size: d.Size_,
Size: d.Size,
Annotations: d.Annotations,
}
}
Expand All @@ -186,7 +186,7 @@ func fromDescriptor(d ocispec.Descriptor) *types.Descriptor {
return &types.Descriptor{
MediaType: d.MediaType,
Digest: d.Digest.String(),
Size_: d.Size,
Size: d.Size,
Annotations: d.Annotations,
}
}
4 changes: 2 additions & 2 deletions services/images/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func imageFromProto(imagepb *imagesapi.Image) images.Image {
func descFromProto(desc *types.Descriptor) ocispec.Descriptor {
return ocispec.Descriptor{
MediaType: desc.MediaType,
Size: desc.Size_,
Size: desc.Size,
Digest: digest.Digest(desc.Digest),
Annotations: desc.Annotations,
}
Expand All @@ -68,7 +68,7 @@ func descFromProto(desc *types.Descriptor) ocispec.Descriptor {
func descToProto(desc *ocispec.Descriptor) *types.Descriptor {
return &types.Descriptor{
MediaType: desc.MediaType,
Size_: desc.Size,
Size: desc.Size,
Digest: desc.Digest.String(),
Annotations: desc.Annotations,
}
Expand Down
2 changes: 1 addition & 1 deletion services/snapshots/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func fromInfo(info snapshots.Info) *snapshotsapi.Info {
func fromUsage(usage snapshots.Usage) *snapshotsapi.UsageResponse {
return &snapshotsapi.UsageResponse{
Inodes: usage.Inodes,
Size_: usage.Size,
Size: usage.Size,
}
}

Expand Down
4 changes: 2 additions & 2 deletions services/tasks/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (l *local) Create(ctx context.Context, r *api.CreateTaskRequest, _ ...grpc.
reader, err := l.store.ReaderAt(ctx, ocispec.Descriptor{
MediaType: r.Checkpoint.MediaType,
Digest: digest.Digest(r.Checkpoint.Digest),
Size: r.Checkpoint.Size_,
Size: r.Checkpoint.Size,
Annotations: r.Checkpoint.Annotations,
})
if err != nil {
Expand Down Expand Up @@ -694,7 +694,7 @@ func (l *local) writeContent(ctx context.Context, mediaType, ref string, r io.Re
return &types.Descriptor{
MediaType: mediaType,
Digest: writer.Digest().String(),
Size_: size,
Size: size,
Annotations: make(map[string]string),
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion snapshots/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func toInfo(info *snapshotsapi.Info) snapshots.Info {
func toUsage(resp *snapshotsapi.UsageResponse) snapshots.Usage {
return snapshots.Usage{
Inodes: resp.Inodes,
Size: resp.Size_,
Size: resp.Size,
}
}

Expand Down
2 changes: 1 addition & 1 deletion task.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ func (t *task) checkpointTask(ctx context.Context, index *v1.Index, request *tas
for _, d := range response.Descriptors {
index.Manifests = append(index.Manifests, v1.Descriptor{
MediaType: d.MediaType,
Size: d.Size_,
Size: d.Size,
Digest: digest.Digest(d.Digest),
Platform: &v1.Platform{
OS: goruntime.GOOS,
Expand Down
2 changes: 1 addition & 1 deletion task_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func WithTaskCheckpoint(im Image) NewTaskOpts {
if m.MediaType == images.MediaTypeContainerd1Checkpoint {
info.Checkpoint = &types.Descriptor{
MediaType: m.MediaType,
Size_: m.Size,
Size: m.Size,
Digest: m.Digest.String(),
Annotations: m.Annotations,
}
Expand Down

0 comments on commit 1a095e1

Please sign in to comment.