0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

fix(proto): the size of the repo should be int64, since that is the same type used for the manifest/config/index/digest sizes it sums up. (#2120)

Using int32 may result in negative size values when returned by the graphql API

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
This commit is contained in:
Andrei Aaron 2023-12-08 21:38:30 +02:00 committed by GitHub
parent 79e14027ee
commit ec7af4979f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View file

@ -262,7 +262,7 @@ func AddImageMetaToRepoMeta(repoMeta *proto_go.RepoMeta, repoBlobs *proto_go.Rep
size, platforms, vendors := recalculateAggregateFields(repoMeta, repoBlobs)
repoMeta.Vendors = vendors
repoMeta.Platforms = platforms
repoMeta.Size = int32(size)
repoMeta.Size = size
imageBlobInfo := repoBlobs.Blobs[imageMeta.Digest.String()]
repoMeta.LastUpdatedImage = mConvert.GetProtoEarlierUpdatedImage(repoMeta.LastUpdatedImage,
@ -316,7 +316,7 @@ func RemoveImageFromRepoMeta(repoMeta *proto_go.RepoMeta, repoBlobs *proto_go.Re
}
}
repoMeta.Size = int32(updatedSize)
repoMeta.Size = updatedSize
repoMeta.Vendors = updatedVendors
repoMeta.Platforms = updatedPlatforms
repoMeta.LastUpdatedImage = updatedLastImage

View file

@ -445,7 +445,7 @@ func GetRepoMeta(protoRepoMeta *proto_go.RepoMeta) mTypes.RepoMeta {
Name: protoRepoMeta.Name,
Tags: GetTags(protoRepoMeta.Tags),
Rank: int(protoRepoMeta.Rank),
Size: int64(protoRepoMeta.Size),
Size: protoRepoMeta.Size,
Platforms: GetPlatforms(protoRepoMeta.Platforms),
Vendors: protoRepoMeta.Vendors,
IsStarred: protoRepoMeta.IsStarred,

View file

@ -19,7 +19,7 @@ func GetProtoRepoMeta(repo mTypes.RepoMeta) *proto_go.RepoMeta {
Statistics: GetProtoStatistics(repo.Statistics),
Signatures: GetProtoSignatures(repo.Signatures),
Referrers: GetProtoReferrers(repo.Referrers),
Size: int32(repo.Size),
Size: repo.Size,
Vendors: repo.Vendors,
Platforms: GetProtoPlatforms(repo.Platforms),
LastUpdatedImage: GetProtoLastUpdatedImage(repo.LastUpdatedImage),

View file

@ -358,7 +358,7 @@ type RepoMeta struct {
IsBookmarked bool `protobuf:"varint,7,opt,name=IsBookmarked,proto3" json:"IsBookmarked,omitempty"`
Rank int32 `protobuf:"varint,8,opt,name=Rank,proto3" json:"Rank,omitempty"`
Stars int32 `protobuf:"varint,9,opt,name=Stars,proto3" json:"Stars,omitempty"`
Size int32 `protobuf:"varint,10,opt,name=Size,proto3" json:"Size,omitempty"`
Size int64 `protobuf:"varint,10,opt,name=Size,proto3" json:"Size,omitempty"`
Vendors []string `protobuf:"bytes,11,rep,name=Vendors,proto3" json:"Vendors,omitempty"`
Platforms []*Platform `protobuf:"bytes,12,rep,name=Platforms,proto3" json:"Platforms,omitempty"`
LastUpdatedImage *RepoLastUpdatedImage `protobuf:"bytes,13,opt,name=LastUpdatedImage,proto3,oneof" json:"LastUpdatedImage,omitempty"`
@ -460,7 +460,7 @@ func (x *RepoMeta) GetStars() int32 {
return 0
}
func (x *RepoMeta) GetSize() int32 {
func (x *RepoMeta) GetSize() int64 {
if x != nil {
return x.Size
}
@ -1140,7 +1140,7 @@ var file_meta_meta_proto_rawDesc = []byte{
0x61, 0x6e, 0x6b, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x52, 0x61, 0x6e, 0x6b, 0x12,
0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x53, 0x74, 0x61, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x0a, 0x20,
0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x6e,
0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x6e,
0x64, 0x6f, 0x72, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x56, 0x65, 0x6e, 0x64,
0x6f, 0x72, 0x73, 0x12, 0x2e, 0x0a, 0x09, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x73,
0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6f, 0x63, 0x69, 0x5f, 0x76, 0x31, 0x2e,

View file

@ -52,7 +52,7 @@ message RepoMeta {
int32 Stars = 9;
int32 Size = 10;
int64 Size = 10;
repeated string Vendors = 11;
repeated oci_v1.Platform Platforms = 12;
optional RepoLastUpdatedImage LastUpdatedImage = 13;