forked from TrueCloudLab/frostfs-api-go
7cb9b8f283
Add `Client.Raw` method which returns underlying raw protobuf client. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
40 lines
574 B
Go
40 lines
574 B
Go
package client
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/rpc/client"
|
|
)
|
|
|
|
// Client represents NeoFS client.
|
|
type Client interface {
|
|
Accounting
|
|
Container
|
|
Netmap
|
|
Object
|
|
Session
|
|
|
|
// Raw must return underlying raw protobuf client.
|
|
Raw() *client.Client
|
|
}
|
|
|
|
type clientImpl struct {
|
|
onceInit sync.Once
|
|
|
|
raw *client.Client
|
|
|
|
opts *clientOptions
|
|
}
|
|
|
|
func New(opts ...Option) (Client, error) {
|
|
clientOptions := defaultClientOptions()
|
|
|
|
for i := range opts {
|
|
opts[i](clientOptions)
|
|
}
|
|
|
|
return &clientImpl{
|
|
raw: client.New(),
|
|
opts: clientOptions,
|
|
}, nil
|
|
}
|