From 13d72efd60790e4fff345f8d81c9c0ac7f6f2754 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 10 Jan 2022 12:19:46 +0300 Subject: [PATCH] [#111] client: Add comments to `Client` and `New` Signed-off-by: Pavel Karpy --- client/client.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/client.go b/client/client.go index 46ec8e4..e9372fb 100644 --- a/client/client.go +++ b/client/client.go @@ -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()