[#564] neofs: Merge if with same condition in CreateContainer

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-06-30 11:58:51 +03:00 committed by Kira
parent 4a8a248f34
commit 5bfc549746
2 changed files with 8 additions and 14 deletions

View file

@ -71,6 +71,10 @@ func (t *TestNeoFS) CreateContainer(_ context.Context, prm PrmContainerCreate) (
container.SetCreationTime(&cnr, time.Now()) container.SetCreationTime(&cnr, time.Now())
if prm.Name != "" { if prm.Name != "" {
var d container.Domain
d.SetName(prm.Name)
container.WriteDomain(&cnr, d)
container.SetName(&cnr, prm.Name) container.SetName(&cnr, prm.Name)
} }
@ -78,13 +82,6 @@ func (t *TestNeoFS) CreateContainer(_ context.Context, prm PrmContainerCreate) (
cnr.SetAttribute(prm.AdditionalAttributes[i][0], prm.AdditionalAttributes[i][1]) cnr.SetAttribute(prm.AdditionalAttributes[i][0], prm.AdditionalAttributes[i][1])
} }
if prm.Name != "" {
var d container.Domain
d.SetName(prm.Name)
container.WriteDomain(&cnr, d)
}
b := make([]byte, 32) b := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, b); err != nil { if _, err := io.ReadFull(rand.Reader, b); err != nil {
return nil, err return nil, err

View file

@ -120,6 +120,10 @@ func (x *NeoFS) CreateContainer(ctx context.Context, prm layer.PrmContainerCreat
container.SetCreationTime(&cnr, time.Now()) container.SetCreationTime(&cnr, time.Now())
if prm.Name != "" { if prm.Name != "" {
var d container.Domain
d.SetName(prm.Name)
container.WriteDomain(&cnr, d)
container.SetName(&cnr, prm.Name) container.SetName(&cnr, prm.Name)
} }
@ -136,13 +140,6 @@ func (x *NeoFS) CreateContainer(ctx context.Context, prm layer.PrmContainerCreat
container.DisableHomomorphicHashing(&cnr) container.DisableHomomorphicHashing(&cnr)
} }
if prm.Name != "" {
var d container.Domain
d.SetName(prm.Name)
container.WriteDomain(&cnr, d)
}
var prmPut pool.PrmContainerPut var prmPut pool.PrmContainerPut
prmPut.SetContainer(cnr) prmPut.SetContainer(cnr)
prmPut.SetWaitParams(x.await) prmPut.SetWaitParams(x.await)