Merge pull request #8 from roman-khimov/api-go-session-token

pool: don't use deprecated token.SessionToken
This commit is contained in:
Angira Kekteeva 2021-06-04 14:24:51 +03:00 committed by GitHub
commit f16d38c7b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,7 +11,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/pkg/session"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/keepalive" "google.golang.org/grpc/keepalive"
) )
@ -83,13 +83,13 @@ func (pb *Builder) Build(ctx context.Context, options *BuilderOptions) (Pool, er
// Pool is an interface providing connection artifacts on request. // Pool is an interface providing connection artifacts on request.
type Pool interface { type Pool interface {
Connection() (client.Client, *token.SessionToken, error) Connection() (client.Client, *session.Token, error)
OwnerID() *owner.ID OwnerID() *owner.ID
} }
type clientPack struct { type clientPack struct {
client client.Client client client.Client
sessionToken *token.SessionToken sessionToken *session.Token
healthy bool healthy bool
} }
@ -148,7 +148,7 @@ func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) {
return pool, nil return pool, nil
} }
func (p *pool) Connection() (client.Client, *token.SessionToken, error) { func (p *pool) Connection() (client.Client, *session.Token, error) {
p.lock.RLock() p.lock.RLock()
defer p.lock.RUnlock() defer p.lock.RUnlock()
if len(p.clientPacks) == 1 { if len(p.clientPacks) == 1 {