forked from TrueCloudLab/frostfs-api-go
c819909906
Make `Client` to be the wrapper over raw protobuf client. Provide public method to get the underlying raw client. Change implementations of all methods with the new approach of the RPC execution. Additional changes: * key replaced from `New` argument to `WithDefaultPrivateKey` option; * `GetSelfBalance` is removed as non-viable; * `GetEACLWithSignature` is removed, `GetEACL` returns `EACLWithSignature`; * `AttachSessionToken` / `AttachBearerToken` are removed as non-viable; * redundant options are removed. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
37 lines
499 B
Go
37 lines
499 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
|
|
}
|
|
|
|
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
|
|
}
|