pool: Fix linter error about deprecated methods #182

Merged
fyrchik merged 1 commit from aarifullin/frostfs-sdk-go:bug/linter_prm_obj_put into master 2023-10-23 15:11:33 +00:00

View file

@ -110,16 +110,11 @@ func (it *internalTarget) WriteObject(ctx context.Context, o *object.Object) err
} }
func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) error { func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) error {
var cliPrm sdkClient.PrmObjectPutInit cliPrm := sdkClient.PrmObjectPutInit{
cliPrm.SetCopiesNumberByVectors(it.prm.copiesNumber) CopiesNumber: it.prm.copiesNumber,
if it.prm.stoken != nil { Session: it.prm.stoken,
cliPrm.WithinSession(*it.prm.stoken) Key: it.prm.key,
} BearerToken: it.prm.btoken,
if it.prm.key != nil {
cliPrm.UseKey(*it.prm.key)
}
if it.prm.btoken != nil {
cliPrm.WithBearerToken(*it.prm.btoken)
} }
wrt, err := it.client.ObjectPutInit(ctx, cliPrm) wrt, err := it.client.ObjectPutInit(ctx, cliPrm)
@ -141,16 +136,13 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b
if it.useStream { if it.useStream {
return false, nil return false, nil
} }
var cliPrm sdkClient.PrmObjectPutSingle cliPrm := sdkClient.PrmObjectPutSingle{
cliPrm.SetCopiesNumber(it.prm.copiesNumber) CopiesNumber: it.prm.copiesNumber,
cliPrm.UseKey(it.prm.key) Key: it.prm.key,
if it.prm.stoken != nil { Session: it.prm.stoken,
cliPrm.WithinSession(*it.prm.stoken) BearerToken: it.prm.btoken,
Object: o,
} }
if it.prm.btoken != nil {
cliPrm.WithBearerToken(*it.prm.btoken)
}
cliPrm.SetObject(o.ToV2())
res, err := it.client.ObjectPutSingle(ctx, cliPrm) res, err := it.client.ObjectPutSingle(ctx, cliPrm)
if err != nil && status.Code(err) == codes.Unimplemented { if err != nil && status.Code(err) == codes.Unimplemented {