Compare commits

...

1 commit

Author SHA1 Message Date
50aed4e9eb [#465] object: Set xHeader __SYSTEM__NETMAP_EPOCH
Affects requests `GET`, `RANGE`, `HEAD`.

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-07-02 11:06:15 +03:00
2 changed files with 15 additions and 5 deletions

View file

@ -138,12 +138,12 @@ func (s *multiaddressRemoteStorage) Range(ctx context.Context, address oid.Addre
prm.SetClient(s.client)
prm.SetTTL(requestParams.TTL)
prm.SetXHeaders(requestParams.XHeaders)
prm.SetNetmapEpoch(requestParams.Epoch)
prm.SetAddress(address)
prm.SetPrivateKey(requestParams.PrivateKey)
prm.SetSessionToken(requestParams.SessionToken)
prm.SetBearerToken(requestParams.BearerToken)
prm.SetXHeaders(requestParams.XHeaders)
prm.SetRange(rng)
if requestParams.IsRaw {
prm.SetRawFlag()
@ -179,12 +179,12 @@ func (s *multiaddressRemoteStorage) Head(ctx context.Context, address oid.Addres
prm.SetClient(s.client)
prm.SetTTL(requestParams.TTL)
prm.SetXHeaders(requestParams.XHeaders)
prm.SetNetmapEpoch(requestParams.Epoch)
prm.SetAddress(address)
prm.SetPrivateKey(requestParams.PrivateKey)
prm.SetSessionToken(requestParams.SessionToken)
prm.SetBearerToken(requestParams.BearerToken)
prm.SetXHeaders(requestParams.XHeaders)
if requestParams.IsRaw {
prm.SetRawFlag()
@ -203,12 +203,12 @@ func (s *multiaddressRemoteStorage) Get(ctx context.Context, address oid.Address
prm.SetClient(s.client)
prm.SetTTL(requestParams.TTL)
prm.SetXHeaders(requestParams.XHeaders)
prm.SetNetmapEpoch(requestParams.Epoch)
prm.SetAddress(address)
prm.SetPrivateKey(requestParams.PrivateKey)
prm.SetSessionToken(requestParams.SessionToken)
prm.SetBearerToken(requestParams.BearerToken)
prm.SetXHeaders(requestParams.XHeaders)
if requestParams.IsRaw {
prm.SetRawFlag()

View file

@ -7,7 +7,9 @@ import (
"errors"
"fmt"
"io"
"strconv"
apiSession "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
coreclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
@ -80,8 +82,16 @@ type readPrmCommon struct {
// SetNetmapEpoch sets the epoch number to be used to locate the objectSDK.
//
// By default current epoch on the server will be used.
func (x *readPrmCommon) SetNetmapEpoch(_ uint64) {
// FIXME(@fyrchik): https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/465
func (x *readPrmCommon) SetNetmapEpoch(epoch uint64) {
e := strconv.FormatUint(epoch, 10)
for i := 0; i < len(x.xHeaders); i = i + 2 {
if x.xHeaders[i] == apiSession.XHeaderNetmapEpoch {
x.xHeaders[i+1] = strconv.FormatUint(epoch, 10)
return
}
}
x.xHeaders = append(x.xHeaders, apiSession.XHeaderNetmapEpoch, e)
}
// GetObjectPrm groups parameters of GetObject operation.