satellite/metainfo: set PlainSize for inline segment

Plain size is required by metabase implementation.

Change-Id: I6739744bff4ce485e0066f2a49acdf38560d31fb
This commit is contained in:
Michal Niewrzal 2020-11-20 13:37:54 +01:00
parent 05fe497a6f
commit 5be4d413b0
3 changed files with 13 additions and 8 deletions

2
go.mod
View File

@ -42,7 +42,7 @@ require (
golang.org/x/sys v0.0.0-20200929083018-4d22bbb62b3c golang.org/x/sys v0.0.0-20200929083018-4d22bbb62b3c
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
google.golang.org/api v0.20.0 // indirect google.golang.org/api v0.20.0 // indirect
storj.io/common v0.0.0-20201119120404-37756b80ef3b storj.io/common v0.0.0-20201119173627-1cdb53f04fad
storj.io/drpc v0.0.16 storj.io/drpc v0.0.16
storj.io/monkit-jaeger v0.0.0-20200518165323-80778fc3f91b storj.io/monkit-jaeger v0.0.0-20200518165323-80778fc3f91b
storj.io/private v0.0.0-20201026143115-bc926bfa3bca storj.io/private v0.0.0-20201026143115-bc926bfa3bca

4
go.sum
View File

@ -906,8 +906,8 @@ storj.io/common v0.0.0-20200424175742-65ac59022f4f/go.mod h1:pZyXiIE7bGETIRXtfs0
storj.io/common v0.0.0-20201026135900-1aaeec90670b/go.mod h1:GqdmNf3fLm2UZX/7Zr0BLFCJ4gFjgm6eHrk/fnmr5jQ= storj.io/common v0.0.0-20201026135900-1aaeec90670b/go.mod h1:GqdmNf3fLm2UZX/7Zr0BLFCJ4gFjgm6eHrk/fnmr5jQ=
storj.io/common v0.0.0-20201106104920-372a344bdd45 h1:pv552R7MiRA8VLQC4qXczLjbl2Qb/MNyus2E9NBSXgI= storj.io/common v0.0.0-20201106104920-372a344bdd45 h1:pv552R7MiRA8VLQC4qXczLjbl2Qb/MNyus2E9NBSXgI=
storj.io/common v0.0.0-20201106104920-372a344bdd45/go.mod h1:ZkQZup2jpFZvvTgz+yPc7K4Vr4bBHM8AA66P57MZkjk= storj.io/common v0.0.0-20201106104920-372a344bdd45/go.mod h1:ZkQZup2jpFZvvTgz+yPc7K4Vr4bBHM8AA66P57MZkjk=
storj.io/common v0.0.0-20201119120404-37756b80ef3b h1:tYz4nbxG7gbkZ1MTHKhrS/IDTOKXSCHunWEShWxvliI= storj.io/common v0.0.0-20201119173627-1cdb53f04fad h1:DTQYc1yH+XwOFx8Dy6CBhLG9eCmYJ5YuK/eRIOxX03A=
storj.io/common v0.0.0-20201119120404-37756b80ef3b/go.mod h1:Cl1rpX3ZfVpOLw0Al6nRGwPbw2DwwXFF5J/63Nf4Sd8= storj.io/common v0.0.0-20201119173627-1cdb53f04fad/go.mod h1:Cl1rpX3ZfVpOLw0Al6nRGwPbw2DwwXFF5J/63Nf4Sd8=
storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw= storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw=
storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw= storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw=
storj.io/drpc v0.0.14 h1:GCBdymTt1BRw4oHmmUZZlxYXLVRxxYj6x3Ivide2J+I= storj.io/drpc v0.0.14 h1:GCBdymTt1BRw4oHmmUZZlxYXLVRxxYj6x3Ivide2J+I=

View File

@ -1434,7 +1434,9 @@ func (endpoint *Endpoint) commitSegment(ctx context.Context, req *pb.SegmentComm
EncryptedKey: req.EncryptedKey, EncryptedKey: req.EncryptedKey,
EncryptedKeyNonce: req.EncryptedKeyNonce[:], EncryptedKeyNonce: req.EncryptedKeyNonce[:],
EncryptedSize: int32(req.SizeEncryptedData), // TODO verify int32 vs int64 EncryptedSize: int32(req.SizeEncryptedData), // TODO incompatible types int32 vs int64
PlainSize: int32(req.PlainSize), // TODO incompatible types int32 vs int64
Position: metabase.SegmentPosition{ Position: metabase.SegmentPosition{
Part: uint32(segmentID.PartNumber), Part: uint32(segmentID.PartNumber),
Index: uint32(segmentID.Index), Index: uint32(segmentID.Index),
@ -1442,11 +1444,11 @@ func (endpoint *Endpoint) commitSegment(ctx context.Context, req *pb.SegmentComm
RootPieceID: segmentID.RootPieceId, RootPieceID: segmentID.RootPieceId,
Redundancy: rs, Redundancy: rs,
Pieces: pieces, Pieces: pieces,
PlainSize: int32(req.PlainSize),
}) })
if err != nil { if err != nil {
if metabase.ErrInvalidRequest.Has(err) {
return nil, nil, rpcstatus.Error(rpcstatus.InvalidArgument, err.Error())
}
endpoint.log.Error("internal", zap.Error(err)) endpoint.log.Error("internal", zap.Error(err))
return nil, nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) return nil, nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
} }
@ -1536,11 +1538,14 @@ func (endpoint *Endpoint) makeInlineSegment(ctx context.Context, req *pb.Segment
Index: uint32(req.Position.Index), Index: uint32(req.Position.Index),
}, },
PlainSize: 1, // TODO PlainSize: int32(req.PlainSize), // TODO incompatible types int32 vs int64
InlineData: req.EncryptedInlineData, InlineData: req.EncryptedInlineData,
}) })
if err != nil { if err != nil {
if metabase.ErrInvalidRequest.Has(err) {
return nil, nil, rpcstatus.Error(rpcstatus.InvalidArgument, err.Error())
}
endpoint.log.Error("internal", zap.Error(err)) endpoint.log.Error("internal", zap.Error(err))
return nil, nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) return nil, nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
} }