[#111] client: Add comments to `Client` and `New`

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
remotes/fyrchik/master
Pavel Karpy 2022-01-10 12:19:46 +03:00 committed by Alex Vanin
parent b50bff53e7
commit 13d72efd60
1 changed files with 14 additions and 0 deletions

View File

@ -4,12 +4,26 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
)
// Client is a wrapper over raw NeoFS API client.
//
// It is not allowed to override client's behaviour:
// the parameters for the all operations are write-only
// and the results of the all operations are read-only.
//
// Working client must be created via constructor New.
// Using the Client that has been created with new(Client)
// expression (or just declaring a Client variable) is unsafe
// and can lead to panic.
type Client struct {
raw *client.Client
opts *clientOptions
}
// New creates, initializes and returns the Client instance.
//
// If multiple options of the same config value are supplied,
// the option with the highest index in the arguments will be used.
func New(opts ...Option) (*Client, error) {
clientOptions := defaultClientOptions()