From 012ece40bb7f062abc54f13a705ad04bd888a035 Mon Sep 17 00:00:00 2001 From: Marina Biryukova Date: Mon, 21 Aug 2023 12:04:10 +0300 Subject: [PATCH] [#180] Fix linter issues Signed-off-by: Marina Biryukova --- go.mod | 2 +- go.sum | 6 ++++-- internal/frostfs/frostfs.go | 23 ++++------------------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index c0101bb..e13f8ea 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44 git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 - git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230816095347-6fdbe755179e + git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230821090303-202412230a05 github.com/aws/aws-sdk-go v1.44.6 github.com/bluele/gcache v0.0.2 github.com/go-chi/chi/v5 v5.0.8 diff --git a/go.sum b/go.sum index 7dd0517..4950161 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,10 @@ git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSV git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 h1:aGQ6QaAnTerQ5Dq5b2/f9DUQtSqPkZZ/bkMx/HKuLCo= git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6/go.mod h1:W8Nn08/l6aQ7UlIbpF7FsQou7TVpcRD1ZT1KG4TrFhE= -git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230816095347-6fdbe755179e h1:+78sZdTFeK2t+2qJ4Tmm5CItUjfcF4/nFMum3JnZ6PQ= -git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230816095347-6fdbe755179e/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230821073319-342524159ac3 h1:GBRTOTRrtIvxi2TgxG7z/J7uRXiyb1SxR4247FaYCgU= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230821073319-342524159ac3/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230821090303-202412230a05 h1:OuViMF54N87FXmaBEpYw3jhzaLrJ/EWOlPL1wUkimE0= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230821090303-202412230a05/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw= git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc= git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA= diff --git a/internal/frostfs/frostfs.go b/internal/frostfs/frostfs.go index 1d3d426..8b69c18 100644 --- a/internal/frostfs/frostfs.go +++ b/internal/frostfs/frostfs.go @@ -41,9 +41,7 @@ const ( // NewFrostFS creates new FrostFS using provided pool.Pool. func NewFrostFS(p *pool.Pool, key *keys.PrivateKey) *FrostFS { - var await pool.WaitParams - await.SetPollInterval(defaultPollInterval) - await.SetTimeout(defaultPollTimeout) + await := pool.WaitParams{PollInterval: defaultPollInterval, Timeout: defaultPollTimeout} var owner user.ID user.IDFromKey(&owner, key.PrivateKey.PublicKey) @@ -93,8 +91,7 @@ func (x *FrostFS) TimeToEpoch(ctx context.Context, now, futureTime time.Time) (u // Container implements frostfs.FrostFS interface method. func (x *FrostFS) Container(ctx context.Context, idCnr cid.ID) (*container.Container, error) { - var prm pool.PrmContainerGet - prm.SetContainerID(idCnr) + prm := pool.PrmContainerGet{ContainerID: idCnr} res, err := x.pool.GetContainer(ctx, prm) if err != nil { @@ -167,13 +164,7 @@ func (x *FrostFS) UserContainers(ctx context.Context, id user.ID) ([]cid.ID, err // SetContainerEACL implements frostfs.FrostFS interface method. func (x *FrostFS) SetContainerEACL(ctx context.Context, table eacl.Table, sessionToken *session.Container) error { - var prm pool.PrmContainerSetEACL - prm.SetTable(table) - prm.SetWaitParams(x.await) - - if sessionToken != nil { - prm.WithinSession(*sessionToken) - } + prm := pool.PrmContainerSetEACL{Table: table, Session: sessionToken, WaitParams: &x.await} err := x.pool.SetEACL(ctx, prm) return handleObjectError("save eACL via connection pool", err) @@ -194,13 +185,7 @@ func (x *FrostFS) ContainerEACL(ctx context.Context, id cid.ID) (*eacl.Table, er // DeleteContainer implements frostfs.FrostFS interface method. func (x *FrostFS) DeleteContainer(ctx context.Context, id cid.ID, token *session.Container) error { - var prm pool.PrmContainerDelete - prm.SetContainerID(id) - prm.SetWaitParams(x.await) - - if token != nil { - prm.SetSessionToken(*token) - } + prm := pool.PrmContainerDelete{ContainerID: id, Session: token, WaitParams: &x.await} err := x.pool.DeleteContainer(ctx, prm) return handleObjectError("delete container via connection pool", err)