From ecb441639e97589e7cb8ff36c1842521a0a1c825 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 11 Jan 2022 15:44:22 +0300 Subject: [PATCH] [#114] client: Fix comments according to new option Signed-off-by: Pavel Karpy --- client/accounting.go | 6 ++++-- client/container.go | 42 ++++++++++++++++++++++++++++-------------- client/netmap.go | 12 ++++++++---- client/object.go | 42 ++++++++++++++++++++++++++++-------------- client/reputation.go | 12 ++++++++---- 5 files changed, 76 insertions(+), 38 deletions(-) diff --git a/client/accounting.go b/client/accounting.go index d1aa37d..9b85bc7 100644 --- a/client/accounting.go +++ b/client/accounting.go @@ -28,8 +28,10 @@ func (x BalanceOfRes) Amount() *accounting.Decimal { // GetBalance receives owner balance through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`, +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*BalanceOfRes, error) { // apply all available options callOptions := c.defaultCallOptions() diff --git a/client/container.go b/client/container.go index 9c238ae..4377b39 100644 --- a/client/container.go +++ b/client/container.go @@ -65,8 +65,10 @@ func (x *ContainerPutRes) setID(id *cid.ID) { // PutContainer puts container through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*ContainerPutRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -173,8 +175,10 @@ func (x *ContainerGetRes) setContainer(cnr *container.Container) { // GetContainer receives container structure through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) GetContainer(ctx context.Context, id *cid.ID, opts ...CallOption) (*ContainerGetRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -253,8 +257,10 @@ func (x *ContainerListRes) setIDList(ids []*cid.ID) { // ListContainers receives all owner's containers through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...CallOption) (*ContainerListRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -327,8 +333,10 @@ type ContainerDeleteRes struct { // DeleteContainer deletes specified container through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) DeleteContainer(ctx context.Context, id *cid.ID, opts ...CallOption) (*ContainerDeleteRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -409,8 +417,10 @@ func (x *EACLRes) SetTable(table *eacl.Table) { // EACL receives eACL of the specified container through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) EACL(ctx context.Context, id *cid.ID, opts ...CallOption) (*EACLRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -479,8 +489,10 @@ type SetEACLRes struct { // SetEACL sets eACL through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) (*SetEACLRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -552,8 +564,10 @@ type AnnounceSpaceRes struct { // AnnounceContainerUsedSpace used by storage nodes to estimate their container // sizes during lifetime. Use it only in storage node applications. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) AnnounceContainerUsedSpace( ctx context.Context, announce []container.UsedSpaceAnnouncement, diff --git a/client/netmap.go b/client/netmap.go index 5fc5fe1..7b7f908 100644 --- a/client/netmap.go +++ b/client/netmap.go @@ -48,8 +48,10 @@ func (x *EndpointInfoRes) setInfo(info *EndpointInfo) { // in client constructor via address or open connection. This can be used as a // health check to see if node is alive and responses to requests. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*EndpointInfoRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -120,8 +122,10 @@ func (x *NetworkInfoRes) setInfo(info *netmap.NetworkInfo) { // NetworkInfo returns information about the NeoFS network of which the remote server is a part. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) NetworkInfo(ctx context.Context, opts ...CallOption) (*NetworkInfoRes, error) { // apply all available options callOptions := c.defaultCallOptions() diff --git a/client/object.go b/client/object.go index bbd6b38..cc4ae22 100644 --- a/client/object.go +++ b/client/object.go @@ -199,8 +199,10 @@ func (x ObjectPutRes) ID() *object.ID { // PutObject puts object through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*ObjectPutRes, error) { callOpts := c.defaultCallOptions() @@ -374,8 +376,10 @@ func (x *ObjectDeleteRes) setTombstoneAddress(addr *object.Address) { // // If target of tombstone address is not set, the address is ignored. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*ObjectDeleteRes, error) { callOpts := c.defaultCallOptions() @@ -600,8 +604,10 @@ func writeUnexpectedMessageTypeErr(res resCommon, val interface{}) { // GetObject receives object through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*ObjectGetRes, error) { callOpts := c.defaultCallOptions() @@ -812,8 +818,10 @@ type ObjectHeadRes struct { // HeadObject receives object's header through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) HeadObject(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*ObjectHeadRes, error) { callOpts := c.defaultCallOptions() @@ -1009,8 +1017,10 @@ func (x ObjectRangeRes) Data() []byte { // ObjectPayloadRangeData receives object's range payload data through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) (*ObjectRangeRes, error) { callOpts := c.defaultCallOptions() @@ -1201,8 +1211,10 @@ func (x ObjectRangeHashRes) Hashes() [][]byte { // HashObjectPayloadRanges receives range hash of the object // payload data through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) HashObjectPayloadRanges(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (*ObjectRangeHashRes, error) { callOpts := c.defaultCallOptions() @@ -1330,8 +1342,10 @@ func (x ObjectSearchRes) IDList() []*object.ID { // SearchObjects searches for the objects through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) SearchObjects(ctx context.Context, p *SearchObjectParams, opts ...CallOption) (*ObjectSearchRes, error) { callOpts := c.defaultCallOptions() diff --git a/client/reputation.go b/client/reputation.go index c8cfbd8..d6b8f9d 100644 --- a/client/reputation.go +++ b/client/reputation.go @@ -44,8 +44,10 @@ type AnnounceLocalTrustRes struct { // AnnounceLocalTrust announces node's local trusts through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustPrm, opts ...CallOption) (*AnnounceLocalTrustRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -139,8 +141,10 @@ type AnnounceIntermediateTrustRes struct { // AnnounceIntermediateTrust announces node's intermediate trusts through NeoFS API call. // -// Any client's internal or transport errors are returned as error, -// NeoFS status codes are included in the returned results. +// Any client's internal or transport errors are returned as `error`. +// If WithNeoFSErrorParsing option has been provided, unsuccessful +// NeoFS status codes are returned as `error`, otherwise, are included +// in the returned result structure. func (c *Client) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceIntermediateTrustPrm, opts ...CallOption) (*AnnounceIntermediateTrustRes, error) { // apply all available options callOptions := c.defaultCallOptions()