From 0aa14a6d82af448d3f3671b3d42120048c0fc211 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 6 Jul 2021 12:18:18 +0300 Subject: [PATCH 1/2] [#23] Update NeoFS API Go library to v1.28.2 Release includes fix of session token corruption by `Client`. --- go.mod | 2 +- go.sum | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 25c51c6..7eb689f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521073959-f0d4d129b7f1 - github.com/nspcc-dev/neofs-api-go v1.27.0 + github.com/nspcc-dev/neofs-api-go v1.28.2 github.com/stretchr/testify v1.6.1 go.uber.org/zap v1.10.0 google.golang.org/grpc v1.29.1 diff --git a/go.sum b/go.sum index ed17a36..5f39d88 100644 --- a/go.sum +++ b/go.sum @@ -137,11 +137,13 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= -github.com/nspcc-dev/neo-go v0.95.1 h1:5fgLFOul1Ax/maFkgLkD5rDUwY/nB/xX/Jpcd8hLHaI= github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= +github.com/nspcc-dev/neo-go v0.95.3 h1:RxBKcmmatbSM2cETGhv3ritmrkU0gUnWItNZvtrBtI0= +github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6APMNiC6MrY= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= -github.com/nspcc-dev/neofs-api-go v1.27.0 h1:SiqD1wb50l/ahCNV8/D9R3ua/sFS8oRCJ5jV+ux6AzE= -github.com/nspcc-dev/neofs-api-go v1.27.0/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= +github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= +github.com/nspcc-dev/neofs-api-go v1.28.2 h1:T74HsOcDANc8LXbhNHI+k3KksSA/dK6VHKtYDmDE6PM= +github.com/nspcc-dev/neofs-api-go v1.28.2/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= From 9c906987caa2c483965ca99469c9831142a56473 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 6 Jul 2021 12:20:23 +0300 Subject: [PATCH 2/2] [#23] Remove usage of deprecated code elements in API Go v1.28.2 Remove usage of deprecated `NodeInfo.Address` method. Replace it with new methods which work with group of addresses. --- pkg/pool/pool.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/pool/pool.go b/pkg/pool/pool.go index c1265ea..5abbde8 100644 --- a/pkg/pool/pool.go +++ b/pkg/pool/pool.go @@ -13,6 +13,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/container" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/session" @@ -103,11 +104,21 @@ func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) { } st, err := c.CreateSession(ctx, options.SessionExpirationEpoch) if err != nil { - address := "unknown" + var address interface{} = "unknown" + if epi, err := c.EndpointInfo(ctx); err == nil { - address = epi.NodeInfo().Address() + ni := epi.NodeInfo() + + addresses := make([]string, 0, ni.NumberOfAddresses()) + + netmap.IterateAllAddresses(ni, func(addr string) { + addresses = append(addresses, addr) + }) + + address = addresses } - return nil, fmt.Errorf("failed to create neofs session token for client %s: %w", address, err) + + return nil, fmt.Errorf("failed to create neofs session token for client %v: %w", address, err) } clientPacks[i] = &clientPack{client: c, sessionToken: st, healthy: true} }