From abfaa0bd48a7e51b9150ed459cd03de914f76822 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Fri, 4 Jun 2021 16:00:58 +0300 Subject: [PATCH 1/2] [#68] go.mod: Update api-go and sdk-go versions Updated version of api-go from 1.26.1 to 1.27.0. Removed replace in go.mod. Updated version of sdk-go. Signed-off-by: Angira Kekteeva --- go.mod | 6 ++---- go.sum | 12 ++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 44921250..2f1ee8eb 100644 --- a/go.mod +++ b/go.mod @@ -6,10 +6,10 @@ require ( github.com/aws/aws-sdk-go v1.37.9 github.com/google/uuid v1.2.0 github.com/gorilla/mux v1.8.0 - github.com/nspcc-dev/neofs-api-go v1.26.1 + github.com/nspcc-dev/neofs-api-go v1.27.0 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-node v1.22.0 - github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210527182636-cbfc17a1a9a2 + github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210604112451-f16d38c7b92a github.com/prometheus/client_golang v1.9.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.7.1 @@ -22,5 +22,3 @@ require ( golang.org/x/text v0.3.5 // indirect google.golang.org/grpc v1.36.1 ) - -replace github.com/nspcc-dev/neofs-sdk-go => github.com/roman-khimov/neofs-sdk-go v0.0.0-20210528201347-878f2cd855eb diff --git a/go.sum b/go.sum index 9b194596..2f36ff38 100644 --- a/go.sum +++ b/go.sum @@ -330,18 +330,20 @@ github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkP 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.92.0/go.mod h1:L7PyTzjK1j/PCAxvbKiVFkCMZDvsv82JbXlPxaH1t0Q= -github.com/nspcc-dev/neo-go v0.95.0 h1:bttArYkIuhBJWSZsZ1xVW8MJsj5SvZwAhqVN3HZPNbo= -github.com/nspcc-dev/neo-go v0.95.0/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= +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/neofs-api-go v1.22.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= -github.com/nspcc-dev/neofs-api-go v1.26.1 h1:GMIuEB6Hv9IXP9SJd/1f8Df6gRriPkSplpmpJXgQ/1I= -github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= +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-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= github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-node v1.22.0 h1:TJ4d5zopItYYWMEajegVWBgAw8HjZFe12IkNm3Tt+rk= github.com/nspcc-dev/neofs-node v1.22.0/go.mod h1:ecpXrzIe1vcp5FBjPsIaHKVIVvxsv4GVBCw21WYcY3c= +github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210604112451-f16d38c7b92a h1:bVvyR+Y+UmElTFKY0ifjtvWteYSm93jihKV1rh4wW5s= +github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210604112451-f16d38c7b92a/go.mod h1:1djNrOkpTTbNUlJM/MvTmohJUaWKUMy9JHSCCA8rJEc= github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= @@ -423,8 +425,6 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/roman-khimov/neofs-sdk-go v0.0.0-20210528201347-878f2cd855eb h1:zRVPiWiS89g8GRLKqvQ/FYGx+qHmWl/UW6ozGRhkHyY= -github.com/roman-khimov/neofs-sdk-go v0.0.0-20210528201347-878f2cd855eb/go.mod h1:QZE7VaNQRyNFS+3gsrNEQEiLe+d6AR6EteX1M9geh6A= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= From b3b190adc0e54f787b5ff9c3a334624f60d71d05 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Fri, 4 Jun 2021 16:01:42 +0300 Subject: [PATCH 2/2] [#68] *: Replace deprecated Signed-off-by: Angira Kekteeva --- api/layer/container.go | 7 ++++--- api/layer/layer.go | 4 ++-- api/layer/object.go | 4 ++-- api/layer/util_test.go | 6 +++--- authmate/authmate.go | 9 +++++---- cmd/authmate/main.go | 10 +++++----- creds/bearer/credentials.go | 6 +++--- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/api/layer/container.go b/api/layer/container.go index d6c720c0..55b5912e 100644 --- a/api/layer/container.go +++ b/api/layer/container.go @@ -6,6 +6,7 @@ import ( "time" "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/owner" "github.com/nspcc-dev/neofs-s3-gw/api" "go.uber.org/zap" @@ -15,7 +16,7 @@ type ( // BucketInfo stores basic bucket data. BucketInfo struct { Name string - CID *container.ID + CID *cid.ID Owner *owner.ID Created time.Time } @@ -30,7 +31,7 @@ type ( } ) -func (n *layer) containerInfo(ctx context.Context, cid *container.ID) (*BucketInfo, error) { +func (n *layer) containerInfo(ctx context.Context, cid *cid.ID) (*BucketInfo, error) { var ( err error res *container.Container @@ -88,7 +89,7 @@ func (n *layer) containerList(ctx context.Context) ([]*BucketInfo, error) { var ( err error own = n.Owner(ctx) - res []*container.ID + res []*cid.ID rid = api.GetRequestID(ctx) ) diff --git a/api/layer/layer.go b/api/layer/layer.go index ec41bafe..e238b426 100644 --- a/api/layer/layer.go +++ b/api/layer/layer.go @@ -10,7 +10,7 @@ import ( "time" "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/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/token" @@ -259,7 +259,7 @@ func (n *layer) GetObject(ctx context.Context, p *GetObjectParams) error { return nil } -func (n *layer) checkObject(ctx context.Context, cid *container.ID, filename string) error { +func (n *layer) checkObject(ctx context.Context, cid *cid.ID, filename string) error { var err error if _, err = n.objectFindID(ctx, &findParams{cid: cid, val: filename}); err == nil { diff --git a/api/layer/object.go b/api/layer/object.go index 8957ea9e..b13fb43b 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -9,7 +9,7 @@ import ( "time" "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/object" "github.com/nspcc-dev/neofs-s3-gw/api" "google.golang.org/grpc/codes" @@ -19,7 +19,7 @@ import ( type ( findParams struct { val string - cid *container.ID + cid *cid.ID } getParams struct { diff --git a/api/layer/util_test.go b/api/layer/util_test.go index 07491558..151b8f7c 100644 --- a/api/layer/util_test.go +++ b/api/layer/util_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "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/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/stretchr/testify/require" @@ -83,11 +83,11 @@ func testNameFromObjectName(name string) (string, string) { func Test_objectInfoFromMeta(t *testing.T) { uid := owner.NewID() oid := object.NewID() - cid := container.NewID() + containerID := cid.New() bkt := &BucketInfo{ Name: "test-container", - CID: cid, + CID: containerID, Owner: uid, Created: time.Now(), } diff --git a/authmate/authmate.go b/authmate/authmate.go index 52ce854c..b994c3f5 100644 --- a/authmate/authmate.go +++ b/authmate/authmate.go @@ -14,6 +14,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "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" @@ -45,7 +46,7 @@ func New(log *zap.Logger, conns pool.Pool) *Agent { type ( // IssueSecretOptions contains options for passing to Agent.IssueSecret method. IssueSecretOptions struct { - ContainerID *container.ID + ContainerID *cid.ID ContainerFriendlyName string NeoFSKey *ecdsa.PrivateKey OwnerPrivateKey hcs.PrivateKey @@ -73,7 +74,7 @@ type ( } ) -func (a *Agent) checkContainer(ctx context.Context, cid *container.ID, friendlyName string) (*container.ID, error) { +func (a *Agent) checkContainer(ctx context.Context, cid *cid.ID, friendlyName string) (*cid.ID, error) { conn, _, err := a.pool.Connection() if err != nil { return nil, err @@ -127,7 +128,7 @@ func (a *Agent) checkContainer(ctx context.Context, cid *container.ID, friendlyN func (a *Agent) IssueSecret(ctx context.Context, w io.Writer, options *IssueSecretOptions) error { var ( err error - cid *container.ID + cid *cid.ID ) a.log.Info("check container", zap.Stringer("cid", options.ContainerID)) @@ -238,7 +239,7 @@ func newReplica(name string, count uint32) (r *netmap.Replica) { return } -func buildEACLTable(cid *container.ID, eaclTable []byte) (*eacl.Table, error) { +func buildEACLTable(cid *cid.ID, eaclTable []byte) (*eacl.Table, error) { table := eacl.NewTable() if len(eaclTable) != 0 { return table, table.UnmarshalJSON(eaclTable) diff --git a/cmd/authmate/main.go b/cmd/authmate/main.go index 1cef2d92..37318df8 100644 --- a/cmd/authmate/main.go +++ b/cmd/authmate/main.go @@ -12,7 +12,7 @@ import ( "syscall" "time" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-s3-gw/authmate" "github.com/nspcc-dev/neofs-s3-gw/creds/hcs" @@ -246,10 +246,10 @@ func issueSecret() *cli.Command { } agent := authmate.New(log, client) - var cid *container.ID + var containerID *cid.ID if len(containerIDFlag) > 0 { - cid = container.NewID() - if err := cid.Parse(containerIDFlag); err != nil { + containerID = cid.New() + if err := containerID.Parse(containerIDFlag); err != nil { return cli.Exit(fmt.Sprintf("failed to parse auth container id: %s", err), 3) } } @@ -269,7 +269,7 @@ func issueSecret() *cli.Command { } issueSecretOptions := &authmate.IssueSecretOptions{ - ContainerID: cid, + ContainerID: containerID, ContainerFriendlyName: containerFriendlyName, NeoFSKey: key, OwnerPrivateKey: owner.PrivateKey(), diff --git a/creds/bearer/credentials.go b/creds/bearer/credentials.go index 1d6cf60d..ffaf5509 100644 --- a/creds/bearer/credentials.go +++ b/creds/bearer/credentials.go @@ -9,7 +9,7 @@ import ( "time" "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/object" "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" @@ -21,7 +21,7 @@ type ( // Credentials is a bearer token get/put interface. Credentials interface { Get(context.Context, *object.Address) (*token.BearerToken, error) - Put(context.Context, *container.ID, *token.BearerToken, ...hcs.PublicKey) (*object.Address, error) + Put(context.Context, *cid.ID, *token.BearerToken, ...hcs.PublicKey) (*object.Address, error) } cred struct { @@ -88,7 +88,7 @@ func (c *cred) Get(ctx context.Context, address *object.Address) (*token.BearerT return box.Token(), nil } -func (c *cred) Put(ctx context.Context, cid *container.ID, tkn *token.BearerToken, keys ...hcs.PublicKey) (*object.Address, error) { +func (c *cred) Put(ctx context.Context, cid *cid.ID, tkn *token.BearerToken, keys ...hcs.PublicKey) (*object.Address, error) { var ( err error buf = c.acquireBuffer()