satellite/metainfo: return RS value with DownloadSegment response
Until now we where using single RS per object but it turns out that we need to be able to support RS per segment. We need to give uplink such information while downloading. Change-Id: I6565b7c08962b3a1429f6079e7c2023a0a7c8b72
This commit is contained in:
parent
28433327cc
commit
f1169ad7bd
2
go.mod
2
go.mod
@ -44,7 +44,7 @@ require (
|
||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
|
||||
google.golang.org/api v0.20.0 // indirect
|
||||
google.golang.org/protobuf v1.25.0 // indirect
|
||||
storj.io/common v0.0.0-20210208122718-577b1f8a0a0f
|
||||
storj.io/common v0.0.0-20210217105242-970e119468ed
|
||||
storj.io/drpc v0.0.16
|
||||
storj.io/monkit-jaeger v0.0.0-20210205021559-85f08034688c
|
||||
storj.io/private v0.0.0-20210203200143-9d2ec06f0d3c
|
||||
|
2
go.sum
2
go.sum
@ -938,6 +938,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-20210208122718-577b1f8a0a0f h1:O2/ia55Q/xhMBJ/WgeTQBEST7h8IWXZE4FEQyiM+RYc=
|
||||
storj.io/common v0.0.0-20210208122718-577b1f8a0a0f/go.mod h1:b8XP/TdW8OyTZ/J2BDFOIE9KojSUNZgImBFZI99zS04=
|
||||
storj.io/common v0.0.0-20210217105242-970e119468ed h1:hL0mXcag3pydoaRiQ8kYrj+qTSbR2Dp3nrC0penj/f0=
|
||||
storj.io/common v0.0.0-20210217105242-970e119468ed/go.mod h1:b8XP/TdW8OyTZ/J2BDFOIE9KojSUNZgImBFZI99zS04=
|
||||
storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw=
|
||||
storj.io/drpc v0.0.14/go.mod h1:82nfl+6YwRwF6UG31cEWWUqv/FaKvP5SGqUvoqTxCMA=
|
||||
storj.io/drpc v0.0.16 h1:9sxypc5lKi/0D69cR21BR0S21+IvXfON8L5nXMVNTwQ=
|
||||
|
@ -874,7 +874,7 @@ func (endpoint *Endpoint) GetObject(ctx context.Context, req *pb.ObjectGetReques
|
||||
return nil, rpcstatus.Error(rpcstatus.InvalidArgument, err.Error())
|
||||
}
|
||||
|
||||
object, err := endpoint.getObject(ctx, keyInfo.ProjectID, req.Bucket, req.EncryptedPath, req.Version)
|
||||
object, err := endpoint.getObject(ctx, keyInfo.ProjectID, req.Bucket, req.EncryptedPath, req.Version, req.RedundancySchemePerSegment)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -887,7 +887,7 @@ func (endpoint *Endpoint) GetObject(ctx context.Context, req *pb.ObjectGetReques
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (endpoint *Endpoint) getObject(ctx context.Context, projectID uuid.UUID, bucket, encryptedPath []byte, version int32) (*pb.Object, error) {
|
||||
func (endpoint *Endpoint) getObject(ctx context.Context, projectID uuid.UUID, bucket, encryptedPath []byte, version int32, rsPerSegment bool) (*pb.Object, error) {
|
||||
pointer, _, err := endpoint.getPointer(ctx, projectID, metabase.LastSegmentIndex, bucket, encryptedPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -923,6 +923,11 @@ func (endpoint *Endpoint) getObject(ctx context.Context, projectID uuid.UUID, bu
|
||||
},
|
||||
}
|
||||
|
||||
// don't return redundancy scheme if feature flag RedundancySchemePerSegment is set
|
||||
if rsPerSegment {
|
||||
return object, nil
|
||||
}
|
||||
|
||||
if pointer.Remote != nil {
|
||||
object.RedundancyScheme = pointer.Remote.Redundancy
|
||||
|
||||
@ -1697,6 +1702,7 @@ func (endpoint *Endpoint) DownloadSegment(ctx context.Context, req *pb.SegmentDo
|
||||
|
||||
EncryptedKeyNonce: encryptedKeyNonce,
|
||||
EncryptedKey: encryptedKey,
|
||||
RedundancyScheme: pointer.Remote.Redundancy,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user