[#168] audit: Replace []*oid.ID with []oid.ID
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
eea0c0ecdc
commit
d4a8b1755c
3 changed files with 16 additions and 16 deletions
|
@ -141,7 +141,7 @@ func (r *Result) SetRetries(v uint32) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PassSG returns list of Storage Groups that passed audit PoR stage.
|
// PassSG returns list of Storage Groups that passed audit PoR stage.
|
||||||
func (r *Result) PassSG() []*oid.ID {
|
func (r *Result) PassSG() []oid.ID {
|
||||||
mV2 := (*audit.DataAuditResult)(r).
|
mV2 := (*audit.DataAuditResult)(r).
|
||||||
GetPassSG()
|
GetPassSG()
|
||||||
|
|
||||||
|
@ -149,17 +149,17 @@ func (r *Result) PassSG() []*oid.ID {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
m := make([]*oid.ID, len(mV2))
|
m := make([]oid.ID, len(mV2))
|
||||||
|
|
||||||
for i := range mV2 {
|
for i := range mV2 {
|
||||||
m[i] = oid.NewIDFromV2(mV2[i])
|
m[i] = *oid.NewIDFromV2(&mV2[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPassSG sets list of Storage Groups that passed audit PoR stage.
|
// SetPassSG sets list of Storage Groups that passed audit PoR stage.
|
||||||
func (r *Result) SetPassSG(list []*oid.ID) {
|
func (r *Result) SetPassSG(list []oid.ID) {
|
||||||
mV2 := (*audit.DataAuditResult)(r).
|
mV2 := (*audit.DataAuditResult)(r).
|
||||||
GetPassSG()
|
GetPassSG()
|
||||||
|
|
||||||
|
@ -171,11 +171,11 @@ func (r *Result) SetPassSG(list []*oid.ID) {
|
||||||
if cap(mV2) >= ln {
|
if cap(mV2) >= ln {
|
||||||
mV2 = mV2[:0]
|
mV2 = mV2[:0]
|
||||||
} else {
|
} else {
|
||||||
mV2 = make([]*refs.ObjectID, 0, ln)
|
mV2 = make([]refs.ObjectID, ln)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < ln; i++ {
|
for i := 0; i < ln; i++ {
|
||||||
mV2 = append(mV2, list[i].ToV2())
|
mV2[i] = *list[i].ToV2()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ func (r *Result) SetPassSG(list []*oid.ID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FailSG returns list of Storage Groups that failed audit PoR stage.
|
// FailSG returns list of Storage Groups that failed audit PoR stage.
|
||||||
func (r *Result) FailSG() []*oid.ID {
|
func (r *Result) FailSG() []oid.ID {
|
||||||
mV2 := (*audit.DataAuditResult)(r).
|
mV2 := (*audit.DataAuditResult)(r).
|
||||||
GetFailSG()
|
GetFailSG()
|
||||||
|
|
||||||
|
@ -191,17 +191,17 @@ func (r *Result) FailSG() []*oid.ID {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
m := make([]*oid.ID, len(mV2))
|
m := make([]oid.ID, len(mV2))
|
||||||
|
|
||||||
for i := range mV2 {
|
for i := range mV2 {
|
||||||
m[i] = oid.NewIDFromV2(mV2[i])
|
m[i] = *oid.NewIDFromV2(&mV2[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetFailSG sets list of Storage Groups that failed audit PoR stage.
|
// SetFailSG sets list of Storage Groups that failed audit PoR stage.
|
||||||
func (r *Result) SetFailSG(list []*oid.ID) {
|
func (r *Result) SetFailSG(list []oid.ID) {
|
||||||
mV2 := (*audit.DataAuditResult)(r).
|
mV2 := (*audit.DataAuditResult)(r).
|
||||||
GetFailSG()
|
GetFailSG()
|
||||||
|
|
||||||
|
@ -213,11 +213,11 @@ func (r *Result) SetFailSG(list []*oid.ID) {
|
||||||
if cap(mV2) >= ln {
|
if cap(mV2) >= ln {
|
||||||
mV2 = mV2[:0]
|
mV2 = mV2[:0]
|
||||||
} else {
|
} else {
|
||||||
mV2 = make([]*refs.ObjectID, 0, ln)
|
mV2 = make([]refs.ObjectID, ln)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < ln; i++ {
|
for i := 0; i < ln; i++ {
|
||||||
mV2 = append(mV2, list[i].ToV2())
|
mV2[i] = *list[i].ToV2()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,11 @@ func TestResult(t *testing.T) {
|
||||||
r.SetRetries(retries)
|
r.SetRetries(retries)
|
||||||
require.Equal(t, retries, r.Retries())
|
require.Equal(t, retries, r.Retries())
|
||||||
|
|
||||||
passSG := []*oid.ID{oidtest.ID(), oidtest.ID()}
|
passSG := []oid.ID{*oidtest.ID(), *oidtest.ID()}
|
||||||
r.SetPassSG(passSG)
|
r.SetPassSG(passSG)
|
||||||
require.Equal(t, passSG, r.PassSG())
|
require.Equal(t, passSG, r.PassSG())
|
||||||
|
|
||||||
failSG := []*oid.ID{oidtest.ID(), oidtest.ID()}
|
failSG := []oid.ID{*oidtest.ID(), *oidtest.ID()}
|
||||||
r.SetFailSG(failSG)
|
r.SetFailSG(failSG)
|
||||||
require.Equal(t, failSG, r.FailSG())
|
require.Equal(t, failSG, r.FailSG())
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ func Result() *audit.Result {
|
||||||
[]byte("node3"),
|
[]byte("node3"),
|
||||||
[]byte("node4"),
|
[]byte("node4"),
|
||||||
})
|
})
|
||||||
x.SetPassSG([]*oid.ID{oidtest.ID(), oidtest.ID()})
|
x.SetPassSG([]oid.ID{*oidtest.ID(), *oidtest.ID()})
|
||||||
x.SetFailSG([]*oid.ID{oidtest.ID(), oidtest.ID()})
|
x.SetFailSG([]oid.ID{*oidtest.ID(), *oidtest.ID()})
|
||||||
|
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue