From 51c3618850bdadd0a6ed72b3a1f024a678498fe7 Mon Sep 17 00:00:00 2001 From: aarifullin Date: Mon, 23 Oct 2023 17:25:46 +0300 Subject: [PATCH 1/2] [#121] client: Make PrmContainerList fields public Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/container_list.go | 14 +++++++------- pool/pool.go | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/client/container_list.go b/client/container_list.go index 4197d3d..ebe27c3 100644 --- a/client/container_list.go +++ b/client/container_list.go @@ -17,26 +17,26 @@ import ( // PrmContainerList groups parameters of ContainerList operation. type PrmContainerList struct { - prmCommonMeta + XHeaders []string - ownerSet bool - ownerID user.ID + Account *user.ID } // SetAccount sets identifier of the FrostFS account to list the containers. // Required parameter. +// +// Deprecated: Use PrmContainerList.Account instead. func (x *PrmContainerList) SetAccount(id user.ID) { - x.ownerID = id - x.ownerSet = true + x.Account = &id } func (x *PrmContainerList) buildRequest(c *Client) (*v2container.ListRequest, error) { - if !x.ownerSet { + if x.Account == nil { return nil, errorAccountNotSet } var ownerV2 refs.OwnerID - x.ownerID.WriteToV2(&ownerV2) + x.Account.WriteToV2(&ownerV2) reqBody := new(v2container.ListRequestBody) reqBody.SetOwnerID(&ownerV2) diff --git a/pool/pool.go b/pool/pool.go index a333711..9eb00b9 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -503,8 +503,9 @@ func (c *clientWrapper) containerList(ctx context.Context, prm PrmContainerList) return nil, err } - var cliPrm sdkClient.PrmContainerList - cliPrm.SetAccount(prm.ownerID) + cliPrm := sdkClient.PrmContainerList{ + Account: &prm.ownerID, + } start := time.Now() res, err := cl.ContainerList(ctx, cliPrm) -- 2.45.3 From a48703350587c46fec82389ad23f2dc16452a5ae Mon Sep 17 00:00:00 2001 From: aarifullin Date: Thu, 26 Oct 2023 10:25:39 +0300 Subject: [PATCH 2/2] [#121] client: Nuke out unused prmCommonMeta Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/common.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/client/common.go b/client/common.go index ac9feb0..0df1806 100644 --- a/client/common.go +++ b/client/common.go @@ -24,24 +24,6 @@ func (x statusRes) Status() apistatus.Status { return x.st } -// groups meta parameters shared between all Client operations. -type prmCommonMeta struct { - // FrostFS request X-Headers - xHeaders []string -} - -// WithXHeaders specifies list of extended headers (string key-value pairs) -// to be attached to the request. Must have an even length. -// -// Slice must not be mutated until the operation completes. -func (x *prmCommonMeta) WithXHeaders(hs ...string) { - if len(hs)%2 != 0 { - panic("slice of X-Headers with odd length") - } - - x.xHeaders = hs -} - func writeXHeadersToMeta(xHeaders []string, h *v2session.RequestMetaHeader) { if len(xHeaders) == 0 { return -- 2.45.3