From fbb95cff14274ff890a4ddbbc017bbd09ccc0a87 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 19 Jan 2022 14:58:15 +0300 Subject: [PATCH] [#1094] services/object: remove some FIXME comments Signed-off-by: Evgenii Stratonikov --- pkg/services/object/head/remote.go | 4 +++- pkg/services/object/util/prm.go | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/services/object/head/remote.go b/pkg/services/object/head/remote.go index cdb168ba28..f23ef1f475 100644 --- a/pkg/services/object/head/remote.go +++ b/pkg/services/object/head/remote.go @@ -32,6 +32,8 @@ type RemoteHeadPrm struct { node *netmap.NodeInfo } +const remoteOpTTL = 1 + var ErrNotFound = errors.New("object header not found") // NewRemoteHeader creates, initializes and returns new RemoteHeader instance. @@ -85,7 +87,7 @@ func (h *RemoteHeader) Head(ctx context.Context, prm *RemoteHeadPrm) (*object.Ob headPrm.SetClient(c) headPrm.SetPrivateKey(key) headPrm.SetAddress(prm.commonHeadPrm.addr) - headPrm.SetTTL(1) // FIXME: use constant + headPrm.SetTTL(remoteOpTTL) res, err := internalclient.HeadObject(headPrm) if err != nil { diff --git a/pkg/services/object/util/prm.go b/pkg/services/object/util/prm.go index dbf2fdaf94..37f7635d3f 100644 --- a/pkg/services/object/util/prm.go +++ b/pkg/services/object/util/prm.go @@ -8,6 +8,9 @@ import ( "github.com/nspcc-dev/neofs-sdk-go/token" ) +// maxLocalTTL is maximum TTL for an operation to be considered local. +const maxLocalTTL = 1 + type CommonPrm struct { local bool @@ -103,7 +106,7 @@ func CommonPrmFromV2(req interface { ttl := meta.GetTTL() prm := &CommonPrm{ - local: ttl <= 1, // FIXME: use constant + local: ttl <= maxLocalTTL, xhdrs: make([]*sessionsdk.XHeader, 0, len(xHdrs)), ttl: ttl - 1, // decrease TTL for new requests }