From ea38860aab27c7be00ad62f24b6608f91cd682cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Niewrza=C5=82?= Date: Tue, 17 May 2022 15:50:12 +0200 Subject: [PATCH] satellite/metainfo: align satellite StreamID protobuf version with metabase For object Version in different places we are using different types. Satellite StreamID is using int32 but metabase accepts int64. Metabase type is correct one and we should align other places with it. As a small addition this change is also passing version correctly between requests instead of using hardcoded value. Change-Id: I63634d73c0a48c009e4db5f203ff18b7f3218b02 --- .../internalpb/delegated_repair_drpc.pb.go | 2 +- satellite/internalpb/inspector_drpc.pb.go | 2 +- satellite/internalpb/metainfo_sat.pb.go | 75 ++++++++++--------- satellite/internalpb/metainfo_sat.proto | 2 +- satellite/metainfo/endpoint_object.go | 10 +-- satellite/metainfo/endpoint_segment.go | 6 +- 6 files changed, 49 insertions(+), 48 deletions(-) diff --git a/satellite/internalpb/delegated_repair_drpc.pb.go b/satellite/internalpb/delegated_repair_drpc.pb.go index 77fef26e9..9111e5adf 100644 --- a/satellite/internalpb/delegated_repair_drpc.pb.go +++ b/satellite/internalpb/delegated_repair_drpc.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-drpc. DO NOT EDIT. -// protoc-gen-go-drpc version: v0.0.24 +// protoc-gen-go-drpc version: v0.0.28 // source: delegated_repair.proto package internalpb diff --git a/satellite/internalpb/inspector_drpc.pb.go b/satellite/internalpb/inspector_drpc.pb.go index c5673b781..73114c3b2 100644 --- a/satellite/internalpb/inspector_drpc.pb.go +++ b/satellite/internalpb/inspector_drpc.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-drpc. DO NOT EDIT. -// protoc-gen-go-drpc version: v0.0.24 +// protoc-gen-go-drpc version: v0.0.28 // source: inspector.proto package internalpb diff --git a/satellite/internalpb/metainfo_sat.pb.go b/satellite/internalpb/metainfo_sat.pb.go index f49f3e18e..d21384c3e 100644 --- a/satellite/internalpb/metainfo_sat.pb.go +++ b/satellite/internalpb/metainfo_sat.pb.go @@ -28,7 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type StreamID struct { Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` EncryptedObjectKey []byte `protobuf:"bytes,2,opt,name=encrypted_object_key,json=encryptedObjectKey,proto3" json:"encrypted_object_key,omitempty"` - Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` + Version int64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` EncryptionParameters *pb.EncryptionParameters `protobuf:"bytes,12,opt,name=encryption_parameters,json=encryptionParameters,proto3" json:"encryption_parameters,omitempty"` CreationDate time.Time `protobuf:"bytes,5,opt,name=creation_date,json=creationDate,proto3,stdtime" json:"creation_date"` ExpirationDate time.Time `protobuf:"bytes,6,opt,name=expiration_date,json=expirationDate,proto3,stdtime" json:"expiration_date"` @@ -79,7 +79,7 @@ func (m *StreamID) GetEncryptedObjectKey() []byte { return nil } -func (m *StreamID) GetVersion() int32 { +func (m *StreamID) GetVersion() int64 { if m != nil { return m.Version } @@ -222,39 +222,40 @@ func init() { func init() { proto.RegisterFile("metainfo_sat.proto", fileDescriptor_47c60bd892d94aaf) } var fileDescriptor_47c60bd892d94aaf = []byte{ - // 544 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0x7e, 0xfd, 0x46, 0xf9, 0xda, 0x24, 0x4d, 0xb5, 0x4d, 0x91, 0x15, 0x8a, 0x62, 0x15, 0x21, - 0x85, 0x8b, 0x8d, 0xda, 0x13, 0x47, 0xa2, 0x70, 0x88, 0xf8, 0x68, 0x71, 0xe0, 0xc2, 0xc5, 0x5a, - 0xdb, 0x53, 0x6b, 0x5b, 0x7b, 0xd7, 0xda, 0x9d, 0xa0, 0xe6, 0xc8, 0x3f, 0xe0, 0x67, 0xf1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0x5d, 0x8b, 0x85, 0x0d, 0x17, - 0xe3, 0xc2, 0xc7, 0x1f, 0x77, 0xb3, 0xee, 0x65, 0x81, 0xaf, 0x96, 0xfe, 0xa0, 0x60, 0x95, 0x49, - 0x4c, 0x3f, 0x90, 0x63, 0xa9, 0x78, 0xc2, 0x05, 0x4b, 0x03, 0xa9, 0x62, 0x50, 0x41, 0xca, 0x33, - 0x8e, 0xda, 0xee, 0x38, 0xad, 0xf9, 0xe0, 0xec, 0xc9, 0xee, 0xa3, 0xaf, 0xe2, 0x58, 0x81, 0xd6, - 0x10, 0x5f, 0x14, 0xb4, 0xb7, 0x05, 0xcb, 0x3f, 0xaa, 0xdf, 0xee, 0xb0, 0x7b, 0x0e, 0xa7, 0xfb, - 0xcf, 0x87, 0xf3, 0xc0, 0xfa, 0x7a, 0x0f, 0xad, 0x6f, 0xf1, 0xec, 0xf3, 0x53, 0x8d, 0x52, 0x5d, - 0xbb, 0x5c, 0x7a, 0x26, 0xf0, 0x1a, 0x92, 0xc7, 0x05, 0x82, 0x12, 0x2c, 0xcd, 0xc3, 0xb0, 0x63, - 0xfe, 0x70, 0xfe, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x1c, 0x56, 0xf6, 0x23, 0x04, 0x00, 0x00, + // 548 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xfe, 0xf9, 0x17, 0xe5, 0xdf, 0x26, 0x69, 0xaa, 0x6d, 0x8a, 0xac, 0x50, 0x14, 0xab, 0x08, + 0xc9, 0x5c, 0x6c, 0xd4, 0x9e, 0x38, 0x12, 0x85, 0x43, 0xc4, 0x9f, 0x16, 0x07, 0x2e, 0x5c, 0xac, + 0xb5, 0x3d, 0xb5, 0xb6, 0xb5, 0x77, 0xad, 0xdd, 0x09, 0x6a, 0x8e, 0xbc, 0x01, 0x8f, 0xc5, 0x33, + 0x70, 0x28, 0x6f, 0xc1, 0x19, 0x79, 0x1d, 0x3b, 0x91, 0x68, 0x0f, 0x70, 0x9b, 0xf9, 0xe6, 0xdb, + 0x6f, 0x76, 0xbe, 0x19, 0x42, 0x73, 0x40, 0xc6, 0xc5, 0x95, 0x0c, 0x35, 0x43, 0xaf, 0x50, 0x12, + 0x25, 0xa5, 0x9a, 0x21, 0x64, 0x19, 0x47, 0xf0, 0xea, 0xea, 0xf4, 0x10, 0x44, 0xac, 0x36, 0x05, + 0x72, 0x29, 0x2a, 0xd6, 0x94, 0xa4, 0x32, 0x95, 0xdb, 0x78, 0x96, 0x4a, 0x99, 0x66, 0xe0, 0x9b, + 0x2c, 0x5a, 0x5f, 0xf9, 0xc8, 0x73, 0xd0, 0xc8, 0xf2, 0x62, 0x4b, 0x38, 0xa8, 0x85, 0xaa, 0xfc, + 0xf4, 0x57, 0x8b, 0xf4, 0x56, 0xa8, 0x80, 0xe5, 0xcb, 0x05, 0x7d, 0x44, 0x3a, 0xd1, 0x3a, 0xbe, + 0x01, 0xb4, 0x2d, 0xc7, 0x72, 0x87, 0xc1, 0x36, 0xa3, 0x2f, 0xc8, 0x64, 0xdb, 0x15, 0x92, 0x50, + 0x46, 0xd7, 0x10, 0x63, 0x78, 0x03, 0x1b, 0xfb, 0x7f, 0xc3, 0xa2, 0x4d, 0xed, 0xc2, 0x94, 0xde, + 0xc0, 0x86, 0xda, 0xa4, 0xfb, 0x05, 0x94, 0xe6, 0x52, 0xd8, 0x2d, 0xc7, 0x72, 0x5b, 0x41, 0x9d, + 0xd2, 0x4f, 0xe4, 0x78, 0x37, 0x41, 0x58, 0x30, 0xc5, 0x72, 0x40, 0x50, 0xda, 0x1e, 0x3a, 0x96, + 0x3b, 0x38, 0x73, 0xbc, 0xbd, 0xf9, 0x5e, 0x37, 0xe1, 0x65, 0xc3, 0x0b, 0x26, 0x70, 0x0f, 0x4a, + 0x97, 0x64, 0x14, 0x2b, 0x60, 0x46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c1, 0x21, 0x86, 0xb2, 0x6b, + 0xb9, 0xb0, 0xe1, 0x7c, 0x5c, 0xfa, 0xf8, 0xe3, 0x6e, 0xd6, 0xbd, 0x2c, 0xf1, 0xe5, 0x22, 0x18, + 0x94, 0xac, 0x2a, 0x49, 0xe8, 0x07, 0x72, 0x2c, 0x15, 0x4f, 0xb9, 0x60, 0x59, 0x28, 0x55, 0x02, + 0x2a, 0xcc, 0x78, 0xce, 0x51, 0xdb, 0x1d, 0xa7, 0xe5, 0x0e, 0xce, 0x9e, 0xec, 0x3e, 0xfa, 0x2a, + 0x49, 0x14, 0x68, 0x0d, 0xc9, 0x45, 0x49, 0x7b, 0x5b, 0xb2, 0x82, 0xa3, 0xfa, 0xed, 0x0e, 0xbb, + 0xe7, 0x70, 0xba, 0xff, 0x7c, 0x38, 0x0f, 0xac, 0xaf, 0xf7, 0xd0, 0xfa, 0xe6, 0xcf, 0x3e, 0x3f, + 0xd5, 0x28, 0xd5, 0xb5, 0xc7, 0xa5, 0x6f, 0x02, 0xbf, 0x21, 0xf9, 0x5c, 0x20, 0x28, 0xc1, 0xb2, + 0x22, 0x8a, 0x3a, 0xe6, 0x0f, 0xe7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x43, 0x2e, 0x40, 0x6c, + 0x23, 0x04, 0x00, 0x00, } diff --git a/satellite/internalpb/metainfo_sat.proto b/satellite/internalpb/metainfo_sat.proto index 5deb5e747..da576d77c 100644 --- a/satellite/internalpb/metainfo_sat.proto +++ b/satellite/internalpb/metainfo_sat.proto @@ -14,7 +14,7 @@ import "metainfo.proto"; message StreamID { bytes bucket = 1; bytes encrypted_object_key = 2; - int32 version = 3; + int64 version = 3; encryption.EncryptionParameters encryption_parameters = 12; diff --git a/satellite/metainfo/endpoint_object.go b/satellite/metainfo/endpoint_object.go index ccd69ad9c..7d4c3d9f7 100644 --- a/satellite/metainfo/endpoint_object.go +++ b/satellite/metainfo/endpoint_object.go @@ -162,7 +162,7 @@ func (endpoint *Endpoint) BeginObject(ctx context.Context, req *pb.ObjectBeginRe satStreamID, err := endpoint.packStreamID(ctx, &internalpb.StreamID{ Bucket: req.Bucket, EncryptedObjectKey: req.EncryptedPath, - Version: int32(object.Version), + Version: int64(object.Version), CreationDate: object.CreatedAt, ExpirationDate: req.ExpiresAt, StreamId: streamID[:], @@ -1126,7 +1126,7 @@ func (endpoint *Endpoint) objectToProto(ctx context.Context, object metabase.Obj streamID, err := endpoint.packStreamID(ctx, &internalpb.StreamID{ Bucket: []byte(object.BucketName), EncryptedObjectKey: []byte(object.ObjectKey), - Version: int32(object.Version), // TODO incompatible types + Version: int64(object.Version), CreationDate: object.CreatedAt, ExpirationDate: expires, StreamId: object.StreamID[:], @@ -1268,7 +1268,7 @@ func (endpoint *Endpoint) objectEntryToProtoListItem(ctx context.Context, bucket satStreamID, err := endpoint.packStreamID(ctx, &internalpb.StreamID{ Bucket: bucket, EncryptedObjectKey: append([]byte(prefixToPrependInSatStreamID), item.EncryptedPath...), - Version: item.Version, + Version: int64(item.Version), CreationDate: item.CreatedAt, ExpirationDate: item.ExpiresAt, StreamId: entry.StreamID[:], @@ -1534,7 +1534,7 @@ func (endpoint *Endpoint) BeginMoveObject(ctx context.Context, req *pb.ObjectBeg satStreamID, err := endpoint.packStreamID(ctx, &internalpb.StreamID{ Bucket: req.Bucket, EncryptedObjectKey: req.EncryptedObjectKey, - Version: int32(metabase.DefaultVersion), + Version: int64(metabase.DefaultVersion), StreamId: result.StreamID[:], EncryptionParameters: &pb.EncryptionParameters{ CipherSuite: pb.CipherSuite(result.EncryptionParameters.CipherSuite), @@ -1763,7 +1763,7 @@ func (endpoint *Endpoint) BeginCopyObject(ctx context.Context, req *pb.ObjectBeg satStreamID, err := endpoint.packStreamID(ctx, &internalpb.StreamID{ Bucket: req.Bucket, EncryptedObjectKey: req.EncryptedObjectKey, - Version: int32(metabase.DefaultVersion), + Version: int64(metabase.DefaultVersion), StreamId: result.StreamID[:], EncryptionParameters: &pb.EncryptionParameters{ CipherSuite: pb.CipherSuite(result.EncryptionParameters.CipherSuite), diff --git a/satellite/metainfo/endpoint_segment.go b/satellite/metainfo/endpoint_segment.go index 3a11606ef..49ed4cb8c 100644 --- a/satellite/metainfo/endpoint_segment.go +++ b/satellite/metainfo/endpoint_segment.go @@ -102,7 +102,7 @@ func (endpoint *Endpoint) BeginSegment(ctx context.Context, req *pb.SegmentBegin BucketName: string(streamID.Bucket), ObjectKey: metabase.ObjectKey(streamID.EncryptedObjectKey), StreamID: id, - Version: 1, + Version: metabase.Version(streamID.Version), }, Position: metabase.SegmentPosition{ Part: uint32(req.Position.PartNumber), @@ -248,7 +248,7 @@ func (endpoint *Endpoint) CommitSegment(ctx context.Context, req *pb.SegmentComm BucketName: string(streamID.Bucket), ObjectKey: metabase.ObjectKey(streamID.EncryptedObjectKey), StreamID: id, - Version: 1, + Version: metabase.Version(streamID.Version), }, ExpiresAt: expiresAt, EncryptedKey: req.EncryptedKey, @@ -364,7 +364,7 @@ func (endpoint *Endpoint) MakeInlineSegment(ctx context.Context, req *pb.Segment BucketName: string(streamID.Bucket), ObjectKey: metabase.ObjectKey(streamID.EncryptedObjectKey), StreamID: id, - Version: 1, + Version: metabase.Version(streamID.Version), }, ExpiresAt: expiresAt, EncryptedKey: req.EncryptedKey,