From d36dfe8c615799107262716898af21dbee25ab83 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 15 Nov 2021 15:56:16 +0300 Subject: [PATCH] [#271] Update neo-sdk-go to the latest version Refactoring invoking pool methods for anonymous requests. Signed-off-by: Denis Kirillov --- api/auth/center.go | 2 +- api/cache/accessbox.go | 2 +- api/cache/names.go | 2 +- api/cache/objects.go | 2 +- api/cache/objects_test.go | 4 +-- api/cache/objectslist.go | 4 +-- api/cache/objectslist_test.go | 4 +-- api/data/info.go | 6 ++-- api/handler/acl.go | 4 +-- api/handler/acl_test.go | 4 +-- api/handler/api.go | 2 +- api/handler/list.go | 2 +- api/handler/object_list.go | 2 +- api/handler/put.go | 2 +- api/layer/container.go | 6 ++-- api/layer/layer.go | 42 ++++++++--------------- api/layer/object.go | 8 ++--- api/layer/object_test.go | 2 +- api/layer/system_object.go | 4 +-- api/layer/util.go | 2 +- api/layer/util_test.go | 6 ++-- api/layer/versioning.go | 2 +- api/layer/versioning_test.go | 50 +++++++++++++++------------- authmate/authmate.go | 16 ++++----- cmd/authmate/main.go | 2 +- creds/accessbox/accessbox.go | 6 ++-- creds/accessbox/bearer_token_test.go | 6 ++-- creds/tokens/credentials.go | 8 ++--- go.mod | 2 +- go.sum | 8 ++--- 30 files changed, 99 insertions(+), 113 deletions(-) diff --git a/api/auth/center.go b/api/auth/center.go index c4c7b6ac..bff200cb 100644 --- a/api/auth/center.go +++ b/api/auth/center.go @@ -17,11 +17,11 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" v4 "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-s3-gw/api/cache" apiErrors "github.com/nspcc-dev/neofs-s3-gw/api/errors" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" "github.com/nspcc-dev/neofs-s3-gw/creds/tokens" + "github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/pool" "go.uber.org/zap" ) diff --git a/api/cache/accessbox.go b/api/cache/accessbox.go index b31b5ec0..71da17f8 100644 --- a/api/cache/accessbox.go +++ b/api/cache/accessbox.go @@ -4,8 +4,8 @@ import ( "time" "github.com/bluele/gcache" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" + "github.com/nspcc-dev/neofs-sdk-go/object" ) type ( diff --git a/api/cache/names.go b/api/cache/names.go index b205519b..1ebec49c 100644 --- a/api/cache/names.go +++ b/api/cache/names.go @@ -4,7 +4,7 @@ import ( "time" "github.com/bluele/gcache" - "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-sdk-go/object" ) // ObjectsNameCache provides for lru cache for objects. diff --git a/api/cache/objects.go b/api/cache/objects.go index f7e70d3a..0bb823c4 100644 --- a/api/cache/objects.go +++ b/api/cache/objects.go @@ -4,7 +4,7 @@ import ( "time" "github.com/bluele/gcache" - "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-sdk-go/object" ) // ObjectsCache provides lru cache for objects. diff --git a/api/cache/objects_test.go b/api/cache/objects_test.go index 2a222352..861f0d39 100644 --- a/api/cache/objects_test.go +++ b/api/cache/objects_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" + "github.com/nspcc-dev/neofs-sdk-go/object" + objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test" "github.com/stretchr/testify/require" ) diff --git a/api/cache/objectslist.go b/api/cache/objectslist.go index f3b58e04..f39ab7e5 100644 --- a/api/cache/objectslist.go +++ b/api/cache/objectslist.go @@ -6,8 +6,8 @@ import ( "time" "github.com/bluele/gcache" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/object" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/object" ) /* diff --git a/api/cache/objectslist_test.go b/api/cache/objectslist_test.go index 8569dfe9..e2bcd452 100644 --- a/api/cache/objectslist_test.go +++ b/api/cache/objectslist_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/object" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/object" "github.com/stretchr/testify/require" ) diff --git a/api/data/info.go b/api/data/info.go index 100b5bb5..cd330f0c 100644 --- a/api/data/info.go +++ b/api/data/info.go @@ -4,9 +4,9 @@ import ( "encoding/xml" "time" - 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" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/object" + "github.com/nspcc-dev/neofs-sdk-go/owner" ) const ( diff --git a/api/handler/acl.go b/api/handler/acl.go index 6e8356ea..9f9b3f31 100644 --- a/api/handler/acl.go +++ b/api/handler/acl.go @@ -11,13 +11,13 @@ import ( "strings" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/errors" "github.com/nspcc-dev/neofs-s3-gw/api/layer" + "github.com/nspcc-dev/neofs-sdk-go/eacl" + "github.com/nspcc-dev/neofs-sdk-go/object" ) var ( diff --git a/api/handler/acl_test.go b/api/handler/acl_test.go index d827eb20..14e78389 100644 --- a/api/handler/acl_test.go +++ b/api/handler/acl_test.go @@ -10,9 +10,9 @@ import ( "testing" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-s3-gw/api" + "github.com/nspcc-dev/neofs-sdk-go/eacl" + "github.com/nspcc-dev/neofs-sdk-go/object" "github.com/stretchr/testify/require" ) diff --git a/api/handler/api.go b/api/handler/api.go index 452dea0d..40bf35dd 100644 --- a/api/handler/api.go +++ b/api/handler/api.go @@ -3,9 +3,9 @@ package handler import ( "errors" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/layer" + "github.com/nspcc-dev/neofs-sdk-go/netmap" "go.uber.org/zap" ) diff --git a/api/handler/list.go b/api/handler/list.go index 3fe83a0a..d023ed25 100644 --- a/api/handler/list.go +++ b/api/handler/list.go @@ -5,8 +5,8 @@ import ( "net/http" "time" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-s3-gw/api" + "github.com/nspcc-dev/neofs-sdk-go/owner" ) // ListMultipartUploadsResult contains ListMultipartUploadsResult XML representation. diff --git a/api/handler/object_list.go b/api/handler/object_list.go index e978fb7d..d061b825 100644 --- a/api/handler/object_list.go +++ b/api/handler/object_list.go @@ -6,11 +6,11 @@ import ( "strconv" "time" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/errors" "github.com/nspcc-dev/neofs-s3-gw/api/layer" + "github.com/nspcc-dev/neofs-sdk-go/object" ) // ListObjectsV1Handler handles objects listing requests for API version 1. diff --git a/api/handler/put.go b/api/handler/put.go index 3e07ff66..3aa41665 100644 --- a/api/handler/put.go +++ b/api/handler/put.go @@ -14,13 +14,13 @@ import ( "strings" "time" - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/auth" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/errors" "github.com/nspcc-dev/neofs-s3-gw/api/layer" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" + "github.com/nspcc-dev/neofs-sdk-go/eacl" "go.uber.org/zap" ) diff --git a/api/layer/container.go b/api/layer/container.go index 22bc641a..5307c2ca 100644 --- a/api/layer/container.go +++ b/api/layer/container.go @@ -8,12 +8,12 @@ import ( "strings" "time" - "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-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/errors" + "github.com/nspcc-dev/neofs-sdk-go/container" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/eacl" "github.com/nspcc-dev/neofs-sdk-go/pool" "go.uber.org/zap" ) diff --git a/api/layer/layer.go b/api/layer/layer.go index e740c473..c689ddb3 100644 --- a/api/layer/layer.go +++ b/api/layer/layer.go @@ -6,26 +6,25 @@ import ( "crypto/ecdsa" "fmt" "io" - "math" "net/url" "strings" "time" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "github.com/nspcc-dev/neofs-api-go/pkg/client" - 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" "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/cache" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/errors" "github.com/nspcc-dev/neofs-s3-gw/authmate" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" + "github.com/nspcc-dev/neofs-sdk-go/client" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/eacl" + "github.com/nspcc-dev/neofs-sdk-go/netmap" + "github.com/nspcc-dev/neofs-sdk-go/object" + "github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/pool" + "github.com/nspcc-dev/neofs-sdk-go/session" "go.uber.org/zap" ) @@ -257,19 +256,6 @@ func (n *layer) EphemeralKey() *keys.PublicKey { return n.anonKey.Key.PublicKey() } -// randomSession returns client.WithSession for ephemeral key or nil if access box matches gate key. -func (n *layer) randomSession(ctx context.Context) client.CallOption { - c, _, err := n.pool.Connection() - if err != nil { - return client.WithSession(nil) - } - st, err := c.CreateSession(ctx, math.MaxUint64, client.WithKey(&n.anonKey.Key.PrivateKey)) - if err != nil { - return client.WithSession(nil) - } - return client.WithSession(st) -} - // Owner returns owner id from BearerToken (context) or from client owner. func (n *layer) Owner(ctx context.Context) *owner.ID { if data, ok := ctx.Value(api.BoxData).(*accessbox.Box); ok && data != nil && data.Gate != nil { @@ -280,22 +266,22 @@ func (n *layer) Owner(ctx context.Context) *owner.ID { return id } -// CallOptions returns []client.CallOption options: client.WithBearer and client.WithKey. -func (n *layer) CallOptions(ctx context.Context) []client.CallOption { +// CallOptions returns []pool.CallOption options: client.WithBearer or client.WithKey (if request is anonymous). +func (n *layer) CallOptions(ctx context.Context) []pool.CallOption { if data, ok := ctx.Value(api.BoxData).(*accessbox.Box); ok && data != nil && data.Gate != nil { - return []client.CallOption{client.WithBearer(data.Gate.BearerToken)} + return []pool.CallOption{pool.WithBearer(data.Gate.BearerToken)} } - return []client.CallOption{client.WithKey(&n.anonKey.Key.PrivateKey), n.randomSession(ctx)} + return []pool.CallOption{pool.WithKey(&n.anonKey.Key.PrivateKey)} } // SessionOpt returns client.WithSession call option with token from context or with nil token. -func (n *layer) SessionOpt(ctx context.Context) client.CallOption { +func (n *layer) SessionOpt(ctx context.Context) pool.CallOption { if data, ok := ctx.Value(api.BoxData).(*accessbox.Box); ok && data != nil && data.Gate != nil { - return client.WithSession(data.Gate.SessionToken) + return pool.WithSession(data.Gate.SessionToken) } - return client.WithSession(nil) + return pool.WithSession(nil) } // Get NeoFS Object by refs.Address (should be used by auth.Center). diff --git a/api/layer/object.go b/api/layer/object.go index 92304f69..7fd6d141 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -9,14 +9,14 @@ import ( "strings" "time" - "github.com/nspcc-dev/neofs-api-go/pkg/client" - 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-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/cache" "github.com/nspcc-dev/neofs-s3-gw/api/data" apiErrors "github.com/nspcc-dev/neofs-s3-gw/api/errors" + "github.com/nspcc-dev/neofs-sdk-go/client" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/object" + "github.com/nspcc-dev/neofs-sdk-go/owner" "go.uber.org/zap" ) diff --git a/api/layer/object_test.go b/api/layer/object_test.go index 8bfa69a8..53e75953 100644 --- a/api/layer/object_test.go +++ b/api/layer/object_test.go @@ -5,8 +5,8 @@ import ( "crypto/sha256" "testing" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-s3-gw/api/data" + "github.com/nspcc-dev/neofs-sdk-go/object" "github.com/stretchr/testify/require" ) diff --git a/api/layer/system_object.go b/api/layer/system_object.go index 5c941150..72536db0 100644 --- a/api/layer/system_object.go +++ b/api/layer/system_object.go @@ -6,10 +6,10 @@ import ( "strconv" "time" - "github.com/nspcc-dev/neofs-api-go/pkg/client" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/errors" + "github.com/nspcc-dev/neofs-sdk-go/client" + "github.com/nspcc-dev/neofs-sdk-go/object" "go.uber.org/zap" ) diff --git a/api/layer/util.go b/api/layer/util.go index 09fc903f..d62a5e99 100644 --- a/api/layer/util.go +++ b/api/layer/util.go @@ -8,10 +8,10 @@ import ( "strings" "time" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" + "github.com/nspcc-dev/neofs-sdk-go/object" ) type ( diff --git a/api/layer/util_test.go b/api/layer/util_test.go index f738d65b..ea809e81 100644 --- a/api/layer/util_test.go +++ b/api/layer/util_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - 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-s3-gw/api/data" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/object" + "github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/stretchr/testify/require" ) diff --git a/api/layer/versioning.go b/api/layer/versioning.go index 51aaeb20..bf5ebd20 100644 --- a/api/layer/versioning.go +++ b/api/layer/versioning.go @@ -7,9 +7,9 @@ import ( "strconv" "strings" - "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/errors" + "github.com/nspcc-dev/neofs-sdk-go/object" ) type objectVersions struct { diff --git a/api/layer/versioning_test.go b/api/layer/versioning_test.go index d2f6dfbc..7756d267 100644 --- a/api/layer/versioning_test.go +++ b/api/layer/versioning_test.go @@ -12,19 +12,19 @@ import ( "testing" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "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/session" - "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" + "github.com/nspcc-dev/neofs-sdk-go/client" + "github.com/nspcc-dev/neofs-sdk-go/container" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/eacl" "github.com/nspcc-dev/neofs-sdk-go/logger" + "github.com/nspcc-dev/neofs-sdk-go/object" + "github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/pool" + "github.com/nspcc-dev/neofs-sdk-go/session" + "github.com/nspcc-dev/neofs-sdk-go/token" "github.com/stretchr/testify/require" ) @@ -41,7 +41,7 @@ func newTestPool() *testPool { } } -func (t *testPool) PutObject(ctx context.Context, params *client.PutObjectParams, option ...client.CallOption) (*object.ID, error) { +func (t *testPool) PutObject(ctx context.Context, params *client.PutObjectParams, option ...pool.CallOption) (*object.ID, error) { b := make([]byte, 32) if _, err := io.ReadFull(rand.Reader, b); err != nil { return nil, err @@ -68,12 +68,12 @@ func (t *testPool) PutObject(ctx context.Context, params *client.PutObjectParams return raw.ID(), nil } -func (t *testPool) DeleteObject(ctx context.Context, params *client.DeleteObjectParams, option ...client.CallOption) error { +func (t *testPool) DeleteObject(ctx context.Context, params *client.DeleteObjectParams, option ...pool.CallOption) error { delete(t.objects, params.Address().String()) return nil } -func (t *testPool) GetObject(ctx context.Context, params *client.GetObjectParams, option ...client.CallOption) (*object.Object, error) { +func (t *testPool) GetObject(ctx context.Context, params *client.GetObjectParams, option ...pool.CallOption) (*object.Object, error) { if obj, ok := t.objects[params.Address().String()]; ok { if params.PayloadWriter() != nil { _, err := params.PayloadWriter().Write(obj.Payload()) @@ -87,24 +87,24 @@ func (t *testPool) GetObject(ctx context.Context, params *client.GetObjectParams return nil, fmt.Errorf("object not found " + params.Address().String()) } -func (t *testPool) GetObjectHeader(ctx context.Context, params *client.ObjectHeaderParams, option ...client.CallOption) (*object.Object, error) { +func (t *testPool) GetObjectHeader(ctx context.Context, params *client.ObjectHeaderParams, option ...pool.CallOption) (*object.Object, error) { p := new(client.GetObjectParams).WithAddress(params.Address()) return t.GetObject(ctx, p) } -func (t *testPool) ObjectPayloadRangeData(ctx context.Context, params *client.RangeDataParams, option ...client.CallOption) ([]byte, error) { +func (t *testPool) ObjectPayloadRangeData(ctx context.Context, params *client.RangeDataParams, option ...pool.CallOption) ([]byte, error) { panic("implement me") } -func (t *testPool) ObjectPayloadRangeSHA256(ctx context.Context, params *client.RangeChecksumParams, option ...client.CallOption) ([][32]byte, error) { +func (t *testPool) ObjectPayloadRangeSHA256(ctx context.Context, params *client.RangeChecksumParams, option ...pool.CallOption) ([][32]byte, error) { panic("implement me") } -func (t *testPool) ObjectPayloadRangeTZ(ctx context.Context, params *client.RangeChecksumParams, option ...client.CallOption) ([][64]byte, error) { +func (t *testPool) ObjectPayloadRangeTZ(ctx context.Context, params *client.RangeChecksumParams, option ...pool.CallOption) ([][64]byte, error) { panic("implement me") } -func (t *testPool) SearchObject(ctx context.Context, params *client.SearchObjectParams, option ...client.CallOption) ([]*object.ID, error) { +func (t *testPool) SearchObject(ctx context.Context, params *client.SearchObjectParams, option ...pool.CallOption) ([]*object.ID, error) { cidStr := params.ContainerID().String() var res []*object.ID @@ -143,7 +143,7 @@ func isMatched(attributes []*object.Attribute, filter object.SearchFilter) bool return false } -func (t *testPool) PutContainer(ctx context.Context, container *container.Container, option ...client.CallOption) (*cid.ID, error) { +func (t *testPool) PutContainer(ctx context.Context, container *container.Container, option ...pool.CallOption) (*cid.ID, error) { b := make([]byte, 32) if _, err := io.ReadFull(rand.Reader, b); err != nil { return nil, err @@ -156,7 +156,7 @@ func (t *testPool) PutContainer(ctx context.Context, container *container.Contai return id, nil } -func (t *testPool) GetContainer(ctx context.Context, id *cid.ID, option ...client.CallOption) (*container.Container, error) { +func (t *testPool) GetContainer(ctx context.Context, id *cid.ID, option ...pool.CallOption) (*container.Container, error) { for k, v := range t.containers { if k == id.String() { return v, nil @@ -166,7 +166,7 @@ func (t *testPool) GetContainer(ctx context.Context, id *cid.ID, option ...clien return nil, fmt.Errorf("container not found " + id.String()) } -func (t *testPool) ListContainers(ctx context.Context, id *owner.ID, option ...client.CallOption) ([]*cid.ID, error) { +func (t *testPool) ListContainers(ctx context.Context, id *owner.ID, option ...pool.CallOption) ([]*cid.ID, error) { var res []*cid.ID for k := range t.containers { cID := cid.New() @@ -179,20 +179,20 @@ func (t *testPool) ListContainers(ctx context.Context, id *owner.ID, option ...c return res, nil } -func (t *testPool) DeleteContainer(ctx context.Context, id *cid.ID, option ...client.CallOption) error { +func (t *testPool) DeleteContainer(ctx context.Context, id *cid.ID, option ...pool.CallOption) error { delete(t.containers, id.String()) return nil } -func (t *testPool) GetEACL(ctx context.Context, id *cid.ID, option ...client.CallOption) (*client.EACLWithSignature, error) { +func (t *testPool) GetEACL(ctx context.Context, id *cid.ID, option ...pool.CallOption) (*client.EACLWithSignature, error) { panic("implement me") } -func (t *testPool) SetEACL(ctx context.Context, table *eacl.Table, option ...client.CallOption) error { +func (t *testPool) SetEACL(ctx context.Context, table *eacl.Table, option ...pool.CallOption) error { panic("implement me") } -func (t *testPool) AnnounceContainerUsedSpace(ctx context.Context, announcements []container.UsedSpaceAnnouncement, option ...client.CallOption) error { +func (t *testPool) AnnounceContainerUsedSpace(ctx context.Context, announcements []container.UsedSpaceAnnouncement, option ...pool.CallOption) error { panic("implement me") } @@ -200,6 +200,10 @@ func (t *testPool) Connection() (client.Client, *session.Token, error) { panic("implement me") } +func (t *testPool) Close() { + panic("implement me") +} + func (t *testPool) OwnerID() *owner.ID { return nil } diff --git a/authmate/authmate.go b/authmate/authmate.go index d31ff553..63c3d9ef 100644 --- a/authmate/authmate.go +++ b/authmate/authmate.go @@ -15,19 +15,19 @@ import ( "github.com/google/uuid" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "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" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-s3-gw/api/cache" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" "github.com/nspcc-dev/neofs-s3-gw/creds/tokens" + "github.com/nspcc-dev/neofs-sdk-go/container" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/eacl" + "github.com/nspcc-dev/neofs-sdk-go/netmap" + "github.com/nspcc-dev/neofs-sdk-go/object" + "github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/policy" "github.com/nspcc-dev/neofs-sdk-go/pool" + "github.com/nspcc-dev/neofs-sdk-go/session" + "github.com/nspcc-dev/neofs-sdk-go/token" "go.uber.org/zap" ) diff --git a/cmd/authmate/main.go b/cmd/authmate/main.go index c501cfde..c3c63d46 100644 --- a/cmd/authmate/main.go +++ b/cmd/authmate/main.go @@ -13,10 +13,10 @@ import ( "time" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-s3-gw/authmate" "github.com/nspcc-dev/neofs-s3-gw/internal/version" "github.com/nspcc-dev/neofs-s3-gw/internal/wallet" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" "github.com/nspcc-dev/neofs-sdk-go/pool" "github.com/spf13/viper" "github.com/urfave/cli/v2" diff --git a/creds/accessbox/accessbox.go b/creds/accessbox/accessbox.go index 65790611..3903cbbb 100644 --- a/creds/accessbox/accessbox.go +++ b/creds/accessbox/accessbox.go @@ -11,9 +11,9 @@ import ( "io" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-sdk-go/netmap" + "github.com/nspcc-dev/neofs-sdk-go/session" + "github.com/nspcc-dev/neofs-sdk-go/token" "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/hkdf" "google.golang.org/protobuf/proto" diff --git a/creds/accessbox/bearer_token_test.go b/creds/accessbox/bearer_token_test.go index 32a90a16..0fe0a390 100644 --- a/creds/accessbox/bearer_token_test.go +++ b/creds/accessbox/bearer_token_test.go @@ -5,9 +5,9 @@ import ( "github.com/google/uuid" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-sdk-go/eacl" + "github.com/nspcc-dev/neofs-sdk-go/session" + "github.com/nspcc-dev/neofs-sdk-go/token" "github.com/stretchr/testify/require" ) diff --git a/creds/tokens/credentials.go b/creds/tokens/credentials.go index 203b6bdb..9fd5bdc0 100644 --- a/creds/tokens/credentials.go +++ b/creds/tokens/credentials.go @@ -9,12 +9,12 @@ import ( "time" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-api-go/pkg/client" - 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-s3-gw/api/cache" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" + "github.com/nspcc-dev/neofs-sdk-go/client" + cid "github.com/nspcc-dev/neofs-sdk-go/container/id" + "github.com/nspcc-dev/neofs-sdk-go/object" + "github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/pool" ) diff --git a/go.mod b/go.mod index a926dc73..75b4f634 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/gorilla/mux v1.8.0 github.com/nspcc-dev/neo-go v0.97.3 github.com/nspcc-dev/neofs-api-go v1.30.0 - github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210728122117-c55ae2c13f78 + github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211115110427-df6a622c20e8 github.com/prometheus/client_golang v1.11.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.7.1 diff --git a/go.sum b/go.sum index 1fcda647..6668fe62 100644 --- a/go.sum +++ b/go.sum @@ -308,15 +308,14 @@ github.com/nspcc-dev/neo-go v0.97.3 h1:qui/ZYJhga14UwFwrLJj+8t/ms8enTSUwBxKAsjlI github.com/nspcc-dev/neo-go v0.97.3/go.mod h1:31LelE8G5NZwGmePCykqui6BpPyEklTVbOvEh5xEvz8= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= -github.com/nspcc-dev/neofs-api-go v1.28.3/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= github.com/nspcc-dev/neofs-api-go v1.30.0 h1:Nns7QjmQGk9I5lWMCtmeD9D3de46uyH3H07WBeXTEI0= github.com/nspcc-dev/neofs-api-go v1.30.0/go.mod h1:KC8T91skIg8juvUh7lQabswQ9J6KmnXErpH8qwDitXA= 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-sdk-go v0.0.0-20210728122117-c55ae2c13f78 h1:8mZv0k88G3f95PEiDuc1lEjPhENS/Vw1ijxNsTFdQG4= -github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210728122117-c55ae2c13f78/go.mod h1:NOjwgDKeU8ZoXO0k2cwMi5HV3BRJVJLLaXrYpVjF1LU= +github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211115110427-df6a622c20e8 h1:nhJSZwE2qbrCrVq4TsHlqYlwXePpqD7BsoEsu4TY5vs= +github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211115110427-df6a622c20e8/go.mod h1:kISVlyRa5l6UIDFigT2AZSW7yUK0QOEmd5mw9WPeYVI= 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= @@ -649,7 +648,6 @@ google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBr google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 h1:XTH066D35LyHehRwlYhoK3qA+Hcgvg5xREG4kFQEW1Y= google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -660,7 +658,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= @@ -673,7 +670,6 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=