From 55c52c8d5d6bf0d5dab97f14649e8709d4ba290a Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 2 Aug 2023 18:56:41 +0300 Subject: [PATCH] [#121] pool: Make PrmContainerGet fields public * Also refactor client PrmContainerGet usage Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/container_get.go | 12 ++++++------ pool/pool.go | 13 ++++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/client/container_get.go b/client/container_get.go index 0e2d028..d2ef0fe 100644 --- a/client/container_get.go +++ b/client/container_get.go @@ -18,22 +18,22 @@ import ( // PrmContainerGet groups parameters of ContainerGet operation. type PrmContainerGet struct { - // FrostFS request X-Headers + // FrostFS request X-Headers. XHeaders []string - CID *cid.ID + ContainerID *cid.ID } // SetContainer sets identifier of the container to be read. // Required parameter. // -// Deprecated: Use PrmContainerGet.CID instead. +// Deprecated: Use PrmContainerGet.ContainerID instead. func (prm *PrmContainerGet) SetContainer(cid cid.ID) { - prm.CID = &cid + prm.ContainerID = &cid } func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) { - if prm.CID == nil { + if prm.ContainerID == nil { return nil, errorMissingContainer } @@ -42,7 +42,7 @@ func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, er } var cidV2 refs.ContainerID - prm.CID.WriteToV2(&cidV2) + prm.ContainerID.WriteToV2(&cidV2) reqBody := new(v2container.GetRequestBody) reqBody.SetContainerID(&cidV2) diff --git a/pool/pool.go b/pool/pool.go index 04b84aa..833b57e 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -438,8 +438,9 @@ func (c *clientWrapper) containerGet(ctx context.Context, prm PrmContainerGet) ( return container.Container{}, err } - var cliPrm sdkClient.PrmContainerGet - cliPrm.SetContainer(prm.cnrID) + cliPrm := sdkClient.PrmContainerGet{ + ContainerID: &prm.ContainerID, + } start := time.Now() res, err := cl.ContainerGet(ctx, cliPrm) @@ -1444,12 +1445,14 @@ func (x *PrmContainerPut) SetWaitParams(waitParams WaitParams) { // PrmContainerGet groups parameters of GetContainer operation. type PrmContainerGet struct { - cnrID cid.ID + ContainerID cid.ID } // SetContainerID specifies identifier of the container to be read. -func (x *PrmContainerGet) SetContainerID(cnrID cid.ID) { - x.cnrID = cnrID +// +// Deprecated: Use PrmContainerGet.ContainerID instead. +func (prm *PrmContainerGet) SetContainerID(cnrID cid.ID) { + prm.ContainerID = cnrID } // PrmContainerList groups parameters of ListContainers operation.