diff --git a/pool/mock_test.go b/pool/mock_test.go index 69cf050..f0cb661 100644 --- a/pool/mock_test.go +++ b/pool/mock_test.go @@ -8,6 +8,7 @@ import ( "github.com/google/uuid" sessionv2 "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-sdk-go/accounting" + sdkClient "github.com/nspcc-dev/neofs-sdk-go/client" apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status" "github.com/nspcc-dev/neofs-sdk-go/container" cid "github.com/nspcc-dev/neofs-sdk-go/container/id" @@ -187,3 +188,7 @@ func (m *mockClient) restartIfUnhealthy(ctx context.Context) (healthy bool, chan } return } + +func (m *mockClient) getClient() (*sdkClient.Client, error) { + return nil, errors.New("now supported to return sdkClient from mockClient") +} diff --git a/pool/pool.go b/pool/pool.go index 0144101..dbcbd64 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -76,6 +76,8 @@ type client interface { dial(ctx context.Context) error // see clientWrapper.restartIfUnhealthy. restartIfUnhealthy(ctx context.Context) (bool, bool) + + getClient() (*sdkClient.Client, error) } // clientStatus provide access to some metrics for connection. @@ -2104,6 +2106,16 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error { }) } +// RawClient returns single client instance to have possibility to work with exact one. +func (p *Pool) RawClient() (*sdkClient.Client, error) { + conn, err := p.connection() + if err != nil { + return nil, err + } + + return conn.getClient() +} + type objectReadCloser struct { reader *sdkClient.ObjectReader elapsedTimeCallback func(time.Duration)