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

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-01-10 12:19:46 +03:00 committed by Alex Vanin
parent b50bff53e7
commit 13d72efd60

View file

@ -4,12 +4,26 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/rpc/client" "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 { type Client struct {
raw *client.Client raw *client.Client
opts *clientOptions 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) { func New(opts ...Option) (*Client, error) {
clientOptions := defaultClientOptions() clientOptions := defaultClientOptions()